class ZbnfParser.PrescriptParser
extends java.lang.Object
ZbnfParser.PrescriptParser.SubParser
.Modifier and Type | Class and Description |
---|---|
(package private) class |
ZbnfParser.PrescriptParser.SubParser
To parse nested syntax, for every level a subparser is created.
|
Modifier and Type | Field and Description |
---|---|
(package private) int[] |
idxWholeParserStoreForInsertionsFromOuterToInnerLevels
This array contains some indices to insert the parseResultsFromOuterToInnerLevels for successfull parsed components.
|
protected StringPartScan |
input
The actual input stream.
|
(package private) ZbnfParseResultItem[] |
parentInWholeParserStoreForInsertionsFromOuterToInnerLevels |
(package private) ZbnfParser.PrescriptParser |
parentPrescriptParser |
(package private) ZbnfParserStore |
parseResultToOtherComponent
An additional parser store to accumulate parse results, which are transfered into the next deeper level of any next component.
|
(package private) ZbnfParserStore |
parserStoreInPrescript
The parse result buffer is a own reference in each subParser.
|
protected int |
posInputbase
Position where the input String is located in the whole input.
|
(package private) ZbnfParser.ParseResultlet |
resultlet |
protected int[] |
srcColumnOption |
protected int |
srcLineOption
Position in source on the first parsed item in an option, used if a component is used inside the option
and only a constant character item is given before.
|
protected long |
srcPosOption |
(package private) java.lang.String |
sReportParentComponents
A string representing the parent components.
|
(package private) java.lang.String |
sSemanticIdent |
Modifier | Constructor and Description |
---|---|
protected |
PrescriptParser(ZbnfParser.PrescriptParser parent,
ZbnfSyntaxPrescript syntax,
java.lang.String sSemantic,
StringPartScan input,
int posInputbase) |
Modifier and Type | Method and Description |
---|---|
boolean |
parsePrescript1(java.lang.String sSemanticForStoring,
ZbnfSyntaxPrescript parentSyntaxItem,
ZbnfParserStore.ParseResultItemImplement parentResultItem,
ZbnfParserStore parserStoreInPrescriptP,
ZbnfParserStore parseResultsFromOtherComponents,
boolean bSkipSpaceAndComment,
boolean bDoNotStoreData,
int nRecursion)
Parses the syntax-prescript assigned with this class.
|
final ZbnfParser.ParseResultlet resultlet
protected final StringPartScan input
protected final int posInputbase
protected int srcLineOption
protected final int[] srcColumnOption
protected long srcPosOption
final ZbnfParser.PrescriptParser parentPrescriptParser
ZbnfParserStore parserStoreInPrescript
<...?-...>
,
the parseResultBuffer is a local instance here.ZbnfParserStore parseResultToOtherComponent
int[] idxWholeParserStoreForInsertionsFromOuterToInnerLevels
ZbnfParseResultItem[] parentInWholeParserStoreForInsertionsFromOuterToInnerLevels
final java.lang.String sSemanticIdent
final java.lang.String sReportParentComponents
protected PrescriptParser(ZbnfParser.PrescriptParser parent, ZbnfSyntaxPrescript syntax, java.lang.String sSemantic, StringPartScan input, int posInputbase)
public boolean parsePrescript1(java.lang.String sSemanticForStoring, ZbnfSyntaxPrescript parentSyntaxItem, ZbnfParserStore.ParseResultItemImplement parentResultItem, ZbnfParserStore parserStoreInPrescriptP, ZbnfParserStore parseResultsFromOtherComponents, boolean bSkipSpaceAndComment, boolean bDoNotStoreData, int nRecursion) throws java.text.ParseException
ZbnfParser
.
It is running in a while()-loop. The loop breaks at end of syntax-prescript or
if no path in syntax prescript matches to the input. Inside the method
ZbnfParser.PrescriptParser.SubParser#parse_Component(StringPartScan, int, String, String, boolean, boolean, boolean)
this method may be called recursively, if the syntax prescript contains <syntax...>.<syntax...>
.
A semantic itself is given if the prescript starts with <?syntax>
at example in
option brackets [<?syntax>...
or repeat brackets {<?syntax>...
or also possible at start of an nested prescript ::=<?syntax>...
Everytime at first the whitespaces and comments are skipped over before the matching of the input
to the syntax prescript is tested. The mode of skipping whitespace and comments may be setted
by calling setSkippingComment(), setSkippingWhitespace() and setSkippingEndlineComment(), see there.sSemanticForErrorP
- The semantic superior semantic. This semantic is used for error report.resultType
- type of the result item of this component. It may one of ParserStore.kOption etc or
a less positiv or negativ number used for repetition and backward repetition.sSemanticForStoring
- The semantic given at the calling item. It may be
<component?>
by using the component.component::=<?semantic>
. This is the regulary case for mostly calls
of syntax component, especially in ZBNF via the simple <syntax>
.
component::=<?>
.
For transforming ZBNF a SyntaxPrescript see @see SyntaxPrescript.convertSyntaxDefinition(StringPart spInput)
If not own semantic of the component is defined, bSkipSpaceAndComment
- if true, than white spaces or comments are possible at actual input positions
and should be skipped before test a non-terminate syntax
and should be skipped after test a terminate syntax if its failed.parseResultsFromOuterLevel
- addParseResultsFromOuterLevel
- List of Buffers with a outer parse result, it should be written
in the parseResult buffer after insertion of parseResult.addAlternative() for this component.java.text.ParseException