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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected static final intprotected ILookAheadBufferprotected static final intprotected Stringprotected J9TagManagerprotected ITagParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected voidconsume()intReturns the current line number being parsed, or -1 if no parsing is occurring (parsing is finished, etc..).protected IAttributeValueMapgetLineRuleResults(IParserToken token) protected ILookAheadBufferprotected voidprotected voidhandleError(Exception e, int behaviour) protected voidhandleError(String message) protected voidhandleError(String message, int offset, int length) protected voidhandleError(String message, Exception e) protected voidhandleErrorAtLineNumber(int fileLineNumber, String message, Exception e) protected voidhandleRequiredMismatch(String expectedType, String actualType, String actualValue) protected voidhandleUnknownMismatch(String actualType, String actualValue) protected booleanisValidJavaCoreTag(IParserToken token) protected booleanisValidSectionTag(String tag) protected IParserTokenlookAhead(int depth) protected booleanThe 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 booleanmatchOptional(String type) Match a type, but do not generate an error if mismatch occurs.protected booleanmatchRequired(String type) Match a type, and generate an error if a mismatch occurs.protected IAttributeValueMapprocessTagLineOptional(String tagName) protected IAttributeValueMapprocessTagLineRequired(String tagName) protected voidsetLookAheadBuffer(ILookAheadBuffer lookAheadBuffer) protected voidsetLookAheadBuffer(ILookAheadBuffer lookAheadBuffer, int depth) protected voidsetTagManager(J9TagManager tagManager) Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getSectionNamein 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:
getErrorsin 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:
anyMatchedin interfaceISectionParser
-