Search in sources :

Example 21 with ILineRule

use of com.ibm.dtfj.javacore.parser.framework.tag.ILineRule in project openj9 by eclipse.

the class SectionParserGrammar method getLineRuleResults.

/**
 * @param type
 *
 * @throws ParserException
 */
protected IAttributeValueMap getLineRuleResults(IParserToken token) throws ParserException {
    IAttributeValueMap results = null;
    if (token != null) {
        ILineRule lineRule = fTagParser.getLineRule(token.getType());
        token = lookAhead(1);
        if (token != null && token.getType().equals(IGeneralTokenTypes.UNPARSED_STRING)) {
            consume();
            if (lineRule != null) {
                results = lineRule.parseLine(token.getValue(), token.getLineNumber(), token.getOffset());
            }
        }
    } else {
        handleError("Cannot get line rule for a null token.");
    }
    return results;
}
Also used : ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule)

Example 22 with ILineRule

use of com.ibm.dtfj.javacore.parser.framework.tag.ILineRule in project openj9 by eclipse.

the class EnvironmentTagParser method addProcessIDRule.

/**
 * Add rule for the process id (2CIPROCESSID tag)
 */
private void addProcessIDRule() {
    ILineRule lineRule = new LineRule() {

        public void processLine(String source, int startingOffset) {
            // pid is in decimal then hex, we only need the first one.
            consumeUntilFirstMatch(CommonPatternMatchers.whitespace);
            addToken(PID_STRING, CommonPatternMatchers.dec);
        }
    };
    addTag(T_1CIPROCESSID, lineRule);
}
Also used : LineRule(com.ibm.dtfj.javacore.parser.framework.tag.LineRule) ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule) ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule)

Example 23 with ILineRule

use of com.ibm.dtfj.javacore.parser.framework.tag.ILineRule in project openj9 by eclipse.

the class EnvironmentTagParser method addEnvironmentVars.

private void addEnvironmentVars() {
    ILineRule lineRule = new LineRule() {

        public void processLine(String source, int startingOffset) {
            consumeUntilFirstMatch(CommonPatternMatchers.whitespace);
            addToken(ENV_NAME, NOT_EQUALS);
            if (consumeUntilFirstMatch(CommonPatternMatchers.equals)) {
                addToken(ENV_VALUE, CommonPatternMatchers.allButLineFeed);
            }
        }
    };
    addTag(T_2CIENVVAR, lineRule);
}
Also used : LineRule(com.ibm.dtfj.javacore.parser.framework.tag.LineRule) ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule) ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule)

Example 24 with ILineRule

use of com.ibm.dtfj.javacore.parser.framework.tag.ILineRule in project openj9 by eclipse.

the class EnvironmentTagParser method addJITModesRule.

/**
 * Add rule for the JIT modes (2CICMDLINE tag)
 */
private void addJITModesRule() {
    ILineRule lineRule = new LineRule() {

        public void processLine(String source, int startingOffset) {
            // command line is on a single line, can include whitespace, separators etc
            // Java 7.0 - can get [not available]
            addToken(JIT_MODE, CommonPatternMatchers.allButLineFeed);
        }
    };
    addTag(T_1CIJITMODES, lineRule);
}
Also used : LineRule(com.ibm.dtfj.javacore.parser.framework.tag.LineRule) ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule) ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule)

Example 25 with ILineRule

use of com.ibm.dtfj.javacore.parser.framework.tag.ILineRule in project openj9 by eclipse.

the class EnvironmentTagParser method addUserArgs.

/**
 * Add rule for an individual user args line (2CIUSERARG tag)
 */
private void addUserArgs() {
    final Matcher hexEnd = CommonPatternMatchers.generateMatcher(" 0x\\p{XDigit}+[\\r\\n]*$");
    ILineRule lineRule = new LineRule() {

        public void processLine(String source, int startingOffset) {
            // each user arg setting is on a separate line, comprising a string after
            // some whitespace, with optional extra information (hex address) following
            consumeUntilFirstMatch(CommonPatternMatchers.whitespace);
            if (addAllCharactersAsTokenUntilFirstMatch(ARG_STRING, hexEnd) != null) {
                addPrefixedHexToken(ARG_EXTRA);
            } else {
                addToken(ARG_STRING, CommonPatternMatchers.allButLineFeed);
            }
        }
    };
    addTag(T_2CIUSERARG, lineRule);
}
Also used : LineRule(com.ibm.dtfj.javacore.parser.framework.tag.LineRule) ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule) Matcher(java.util.regex.Matcher) ILineRule(com.ibm.dtfj.javacore.parser.framework.tag.ILineRule)

Aggregations

ILineRule (com.ibm.dtfj.javacore.parser.framework.tag.ILineRule)46 LineRule (com.ibm.dtfj.javacore.parser.framework.tag.LineRule)31 PointerSizeLineRule (com.ibm.dtfj.javacore.parser.j9.section.common.PointerSizeLineRule)6 IParserToken (com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken)1 Matcher (java.util.regex.Matcher)1