java.lang.Object
com.ibm.dtfj.javacore.parser.j9.SectionParserGrammar
- All Implemented Interfaces:
ISectionParser
- Direct Known Subclasses:
SectionParser
,SovereignSectionParserPart
Parent section parser that implements most of the grammar based functionality used
by the concrete section parsers.
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected static final int
protected ILookAheadBuffer
protected static final int
protected String
protected J9TagManager
protected ITagParser
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
protected void
consume()
int
Returns the current line number being parsed, or -1 if no parsing is occurring (parsing is finished, etc..).protected IAttributeValueMap
getLineRuleResults
(IParserToken token) protected ILookAheadBuffer
protected void
protected void
handleError
(Exception e, int behaviour) protected void
handleError
(String message) protected void
handleError
(String message, int offset, int length) protected void
handleError
(String message, Exception e) protected void
handleErrorAtLineNumber
(int fileLineNumber, String message, Exception e) protected void
handleRequiredMismatch
(String expectedType, String actualType, String actualValue) protected void
handleUnknownMismatch
(String actualType, String actualValue) protected boolean
isValidJavaCoreTag
(IParserToken token) protected boolean
isValidSectionTag
(String tag) protected IParserToken
lookAhead
(int depth) protected boolean
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.protected boolean
matchOptional
(String type) Match a type, but do not generate an error if mismatch occurs.protected boolean
matchRequired
(String type) Match a type, and generate an error if a mismatch occurs.protected IAttributeValueMap
processTagLineOptional
(String tagName) protected IAttributeValueMap
processTagLineRequired
(String tagName) protected void
setLookAheadBuffer
(ILookAheadBuffer lookAheadBuffer) protected void
setLookAheadBuffer
(ILookAheadBuffer lookAheadBuffer, int depth) protected void
setTagManager
(J9TagManager tagManager) Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface com.ibm.dtfj.javacore.parser.framework.parser.ISectionParser
readIntoDTFJ
-
Field Details
-
FORCE_THROW
protected static final int FORCE_THROW- See Also:
-
fLookAheadBuffer
-
fSectionName
-
fTagManager
-
fTagParser
-
DEFAULT_DEPTH
protected static final int DEFAULT_DEPTH- See Also:
-
anyMatched
protected boolean anyMatched
-
-
Constructor Details
-
SectionParserGrammar
-
-
Method Details
-
setLookAheadBuffer
protected void setLookAheadBuffer(ILookAheadBuffer lookAheadBuffer, int depth) throws ParserException - Parameters:
lookAheadBuffer
-depth
-- Throws:
ParserException
-
setLookAheadBuffer
- Parameters:
lookAheadBuffer
-- Throws:
ParserException
-
getLookAheadBuffer
-
setTagManager
- Parameters:
tagManager
-- Throws:
NullPointerException
- if tag manager is null
-
handleRequiredMismatch
protected void handleRequiredMismatch(String expectedType, String actualType, String actualValue) throws ParserException - Parameters:
scanner
-- Throws:
ParserException
-
handleUnknownMismatch
- Throws:
ParserException
-
lookAhead
- Parameters:
depth
-- Throws:
ParserException
-
getSectionName
- Specified by:
getSectionName
in interfaceISectionParser
-
consume
- Parameters:
lookAheadBuffer
-- Throws:
ParserException
-
match
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 matchrequired
- will generate an error, otherwise false ignores the mismatch.- Returns:
- true if matched, false otherwise.
- Throws:
ParserException
-
getLineRuleResults
- Parameters:
type
-- Throws:
ParserException
-
matchRequired
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
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
-
processTagLineRequired
- Parameters:
tagName
-- Returns:
- attributevaluemap if tag line found and parsed, or null if not found.
- Throws:
ParserException
-
processTagLineOptional
- Parameters:
tagName
-- Returns:
- attributevaluemap if tag line found and parsed, or null if not found.
- Throws:
ParserException
-
isValidSectionTag
- Parameters:
tag
-
-
isValidJavaCoreTag
- Parameters:
token
-
-
getCurrentFileLineNumber
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
- Specified by:
getErrors
in interfaceISectionParser
- Returns:
- non null Iterator to a list of errors encountered during parsing.
-
handleError
- Parameters:
message
-- Throws:
ParserException
-
handleError
- Throws:
ParserException
-
handleErrorAtLineNumber
protected void handleErrorAtLineNumber(int fileLineNumber, String message, Exception e) throws ParserException - Parameters:
fileLineNumber
-message
-e
-- Throws:
ParserException
-
handleError
- Parameters:
message
-offset
-length
-- Throws:
ParserException
-
handleError
- Parameters:
e
-- Throws:
ParserException
-
handleError
- Parameters:
e
-behaviour
-- Throws:
ParserException
-
anyMatched
public boolean anyMatched()- Specified by:
anyMatched
in interfaceISectionParser
-