Module openj9.dtfj

Class SectionParserGrammar

    • Constructor Detail

      • SectionParserGrammar

        public SectionParserGrammar​(String sectionName)
    • Method Detail

      • match

        protected boolean match​(String type,
                                boolean required)
                         throws ParserException
        The match performs one additional function:
        if the mismatch is due to an unrecognised javacore tag, that erroneous tag can be interpreted as garbage for now, so the latter is consumed without further processing.
        However, beware of considering all mismatches to be garbage. It is possible that the mismatch is due to a VALID javacore tag that pertains to another language rule. In this case, an argument to the method decides whether to handle it as an error (i.e., match was required) or let it fall through to the next grammar rule (match was optional).
        Parameters:
        type - to match
        required - will generate an error, otherwise false ignores the mismatch.
        Returns:
        true if matched, false otherwise.
        Throws:
        ParserException
      • matchRequired

        protected boolean matchRequired​(String type)
                                 throws ParserException
        Match a type, and generate an error if a mismatch occurs. This is usually used for grammar matches that are required.
        Parameters:
        type -
        Throws:
        ParserException
      • matchOptional

        protected boolean matchOptional​(String type)
                                 throws ParserException
        Match a type, but do not generate an error if mismatch occurs. This is usually used when a terminal in a grammar rule is optional.
        Parameters:
        type -
        Throws:
        ParserException
      • isValidSectionTag

        protected boolean isValidSectionTag​(String tag)
        Parameters:
        tag -
      • isValidJavaCoreTag

        protected boolean isValidJavaCoreTag​(IParserToken token)
        Parameters:
        token -
      • getCurrentFileLineNumber

        public int getCurrentFileLineNumber()
                                     throws ParserException
        Returns the current line number being parsed, or -1 if no parsing is occurring (parsing is finished, etc..).
        Returns:
        current line number of line being parsed, or -1 if there is nothing left to parse.
        Throws:
        ParserException
      • getErrors

        public Iterator getErrors()
        Specified by:
        getErrors in interface ISectionParser
        Returns:
        non null Iterator to a list of errors encountered during parsing.