class ZbnfParserStore
extends java.lang.Object
Syntax | SyntaxPrescript. | ParserStore. | add... |
---|---|---|---|
Terminal Symbols | String | kTerminalSymbol | add?? |
[<?Semantic> | <kMaxAlternate | addOption | |
<syntax?semantic> | kComponent | add?? | |
<?semantic> | kOnlySemantic | add?? | |
[...] | kSingleOption | add?? | |
{... | kRepetition | add?? | |
{..?...} | kRepetitionRepeat | add?? | |
<#?semantic> | kIntegerNumber | add?? | |
<#-?semantic> | kIntegerNumber | add?? | |
<#x?semantic> | kIntegerNumber | add?? | |
<#f?semantic> | kFloatNumber | add?? | |
<$?semantic> | kIdentifier | add?? | |
<*endchars?semantic> | kString | add?? | |
<!regex?semantic> | kString | add?? | |
<""?semantic> | kString | add?? | |
<''?semantic> | kString | add?? | |
<*""endchars?semantic> | kString | add?? |
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ZbnfParserStore.BuilderTreeNodeXml |
private static class |
ZbnfParserStore.ConvertWikiStyle |
(package private) static class |
ZbnfParserStore.ParseResultItemImplement
One item to store in the list.
|
static interface |
ZbnfParserStore.PrepareXmlNode |
Modifier and Type | Field and Description |
---|---|
private int[] |
column
Temporary store for column.
|
(package private) static ZbnfParserStore.ConvertWikiStyle |
convertWikiformat
The index to read out the parse results.
|
(package private) ZbnfParserStore.ParseResultItemImplement |
item
The last item, useable for set...
|
(package private) java.util.ArrayList<ZbnfParserStore.ParseResultItemImplement> |
items
List of items to store, instaceof ParseResultItem
|
(package private) static int |
kComponent
Constant to detect the entry describes a component assigned to a non-teminal syntax symbol. -32766
|
(package private) static int |
kFloatNumber
Constant to detect an integer number. -32758
|
(package private) static int |
kIdentifier
Constant to detect an identifier. -32757
|
(package private) static int |
kIntegerNumber
Constant to detect an integer number. -32759
|
(package private) static int |
kMaxRepetition
A number between this constant an -1 detects, it is a repetition.
|
(package private) static int |
kOnlySemantic
Constant to detect the entry describes a single option. -32764
|
(package private) static int |
kOption
Constant to detect the entry describes a only semantiv entry. -32763
|
(package private) static int |
kString
Constant to detect an identifier. -32756
|
(package private) static int |
kTerminalSymbol
Constant to detect the entry describes a terminate symbol. -32767
|
static java.lang.String |
sVersion
Version, history and license.
|
Constructor and Description |
---|
ZbnfParserStore()
Constructs a new empty ParserStore.
|
Modifier and Type | Method and Description |
---|---|
(package private) ZbnfParserStore.ParseResultItemImplement |
add(java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
ZbnfSyntaxPrescript componentSyntax,
java.lang.CharSequence sInput,
int nAlternative,
long start,
long end,
int srcLine,
int srcColumn,
java.lang.String srcFile,
ZbnfParseResultItem parent)
Adds a new item
If this is a components item, on end
setAlternativeAndOffsetToEnd(int, int) should be called. |
(package private) ZbnfParserStore.ParseResultItemImplement |
addConstantSyntax(ZbnfSyntaxPrescript elementSyntax,
java.lang.String sInput,
long start,
long end,
int nLine,
int nColumn,
java.lang.String sFile,
ZbnfParseResultItem parent) |
(package private) void |
addFloatNumber(java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
double number,
ZbnfParseResultItem parent) |
(package private) void |
addIdentifier(java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
java.lang.String sIdent,
ZbnfParseResultItem parent,
int srcLine,
int srcColumn,
java.lang.String srcFile) |
(package private) void |
addIntegerNumber(java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
long number,
java.lang.String[] sNumber,
ZbnfParseResultItem parent) |
(package private) ZbnfParserStore.ParseResultItemImplement |
addRepetition(int countRepetition,
java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
long start,
long end,
int nLine,
int nColumn,
java.lang.String sFile,
ZbnfParseResultItem parent)
Sets the src of the parsing.
|
(package private) ZbnfParserStore.ParseResultItemImplement |
addRepetitionRepeat(int countRepetition,
java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
long start,
long end,
int nLine,
int nColumn,
java.lang.String sFile,
ZbnfParseResultItem parent) |
(package private) ZbnfParserStore.ParseResultItemImplement |
addSemantic(java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
ZbnfParseResultItem parent,
int srcLine,
int srcColumn,
java.lang.String srcFile) |
(package private) ZbnfParserStore.ParseResultItemImplement |
addString(java.lang.CharSequence src,
java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
StringPart spInput,
ZbnfParseResultItem parent,
int srcLine,
int srcColumn,
java.lang.String srcFile)
Adds a founded string to the parsers store.
|
(package private) ZbnfParserStore.ParseResultItemImplement |
addString(StringPart spInput,
java.lang.String sSemantic,
ZbnfSyntaxPrescript elementSyntax,
ZbnfParseResultItem parent)
Adds a founded string to the parsers store.
|
ZbnfParseResultItem |
getFirstParseResult()
Returns the first parse result item to start stepping to the results.
|
(package private) ZbnfParseResultItem |
getItem(int idx) |
java.util.Iterator<ZbnfParserStore.ParseResultItemImplement> |
getIterator()
Gets the next item to step through the items.
|
(package private) int |
getNextPosition()
Gets the position for the next entry, useable for rewind().
|
(package private) int |
insert(ZbnfParserStore addStore,
int idxStore,
ZbnfParseResultItem parent)
adds items form another ParserStore.
|
(package private) void |
setAlternativeAndOffsetToEnd(int idxStore,
int alternative)
Sets the spread of the item (@link
ZbnfParserStore.ParseResultItemImplement.offsetAfterEnd
and the number of the alternative into a existing item. |
(package private) void |
setCurrentPosition(int pos)
Removes all entries start from position.
|
(package private) void |
stop()
It's a debug helper.
|
java.lang.String |
toString() |
(package private) void |
writeContentAsList(java.lang.Appendable out)
This is called from
ZbnfParser.writeResultAsTextList(Appendable) as wrapper. |
public static final java.lang.String sVersion
addIdentifier(String, ZbnfSyntaxPrescript, String, ZbnfParseResultItem, int, int, String)
and writeContentAsList(Appendable)
: enhanced to store the source of numeric values.
ZbnfParserStore.ParseResultItemImplement.elementSyntax
renamed from "parentSyntaxElement". It is not the parent.
ZbnfSyntaxPrescript
add(String, ZbnfSyntaxPrescript, ZbnfSyntaxPrescript, CharSequence, int, long, long, int, int, String, ZbnfParseResultItem)
and other add: Change of ZbnfParserStore.ParseResultItemImplement.offsetAfterEnd
in the parent's items is removed.
This was an old concept, no more necessary, and confusing.
setAlternativeAndOffsetToEnd(int, int)
: Here important change, see description.
ZbnfParserStore.ParseResultItemImplement.componentSyntax()
now references immediately from the result
to the component for syntax. This gives more information. The data are not too much
because there are lesser Syntax definitions as result items.
ParseResultItemImplement#parentSyntaxElement
from syntaxElement to prevent confusion.
The meaning of that element was originally, before 2019, that of ZbnfParserStore.ParseResultItemImplement.componentSyntax()
but with lesser usage. It was a inconsequently change.
ZbnfParserStore.ParseResultItemImplement.getSuperItemType()
uses the change in ZbnfSyntaxPrescript.sSuperItemType
writeContentAsList(Appendable)
as output to check (usual data debug).
ZbnfParserStore.ParseResultItemImplement.getText()
improved while testing ZBNF/testAllConecpts (from 2009).BuilderTreeNodeXml#createXmlNode(XmlNode, ParseResultItemImplement)
: On repetition item an XmlNode for {<?semantic>...
should be created anywhere, because elsewhere only one node exists.
ZbnfParserStore.ParseResultItemImplement.syntaxItem()
.
ZbnfParserStore.BuilderTreeNodeXml
with attributes ZbnfParserStore.BuilderTreeNodeXml.bXmlSrcline
and bXmlSrctext controls whether srcline="xx" and srctext="text" will be written to a XML output.
StringPart.getLineAndColumn(int[])
instead getLineCt() and StringPart.getCurrentColumn()
because it is faster.
ZbnfParserStore.ParseResultItemImplement.sFile
,
for information in written results, especially with ZbnfJavaOutput
.
#createXmlNode(XmlNode, ParseResultItemImplement)
: writes src-line, src-col
and start of src in the xml element.
#buildTreeNodeRepresentationXml(XmlNode, ParseResultItemImplement, boolean)
now
returns and works with the interface reference XmlNode
instead the implementation instance reference
XmlNodeSimple
. The implementation is the same. All references are adapted.
ZbnfParserStore.PrepareXmlNode
, ZbnfParserStore.ConvertWikiStyle
,
#buildTreeNodeRepresentationXml(XmlNode, ParseResultItemImplement, boolean)
: All capabilities
which were located in ZbnfXmlOutput
are implemented here. The class ZbnfXmlOutput
is not necessary
any more because the intrinsic format of data stored as parse result is XML now.
ZbnfParserStore.ParseResultItemImplement.getText()
to get a textual projection of the content. used for XML presentation.
ZbnfParserStore.ParseResultItemImplement.treeNodeXml
.
It refers to an tree-like result store, whereby the XmlNodeSimple
is used as node.
Therewith the conversion to XML is obviously. As well too, the access to treed data able to use for direct
text conversion using org.vishia.zbatch.ZbatchExecuter
.
A new method #buildTreeNodeRepresentationXml(XmlNodeSimple, ParseResultItemImplement, boolean)
is offered to use.
static final int kTerminalSymbol
static final int kComponent
static final int kOnlySemantic
static final int kOption
static final int kIntegerNumber
static final int kFloatNumber
static final int kIdentifier
static final int kString
static final int kMaxRepetition
ZbnfParserStore.ParseResultItemImplement item
final java.util.ArrayList<ZbnfParserStore.ParseResultItemImplement> items
private final int[] column
static ZbnfParserStore.ConvertWikiStyle convertWikiformat
public ZbnfParseResultItem getFirstParseResult()
ZbnfParserStore.ParseResultItemImplement add(java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, ZbnfSyntaxPrescript componentSyntax, java.lang.CharSequence sInput, int nAlternative, long start, long end, int srcLine, int srcColumn, java.lang.String srcFile, ZbnfParseResultItem parent)
setAlternativeAndOffsetToEnd(int, int)
should be called.sSemantic
- sInput
- nAlternative
- start
- end
- nLine
- nColumn
- void setAlternativeAndOffsetToEnd(int idxStore, int alternative)
ZbnfParserStore.ParseResultItemImplement.offsetAfterEnd
and the number of the alternative into a existing item.
The item is to be added on begin of parsing the part, and the
number of alternative is to be added at the end of it.
The number of alternative is ascertained only at the end. Also at the end
it is possible to add the offsetAfterEnd-offset. It is done here.
If the item isn't a type of alternative, a RuntimeException is thrown.
idxStore
- The index where find the alternative item in the storealternative
- The number of founded, alternative from 1, 0 if it is the empty option.ZbnfParserStore.ParseResultItemImplement addRepetition(int countRepetition, java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, long start, long end, int nLine, int nColumn, java.lang.String sFile, ZbnfParseResultItem parent)
sInput
- the parsed textZbnfParserStore.ParseResultItemImplement addRepetitionRepeat(int countRepetition, java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, long start, long end, int nLine, int nColumn, java.lang.String sFile, ZbnfParseResultItem parent)
ZbnfParserStore.ParseResultItemImplement addConstantSyntax(ZbnfSyntaxPrescript elementSyntax, java.lang.String sInput, long start, long end, int nLine, int nColumn, java.lang.String sFile, ZbnfParseResultItem parent)
ZbnfParserStore.ParseResultItemImplement addSemantic(java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, ZbnfParseResultItem parent, int srcLine, int srcColumn, java.lang.String srcFile)
ZbnfParserStore.ParseResultItemImplement addString(StringPart spInput, java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, ZbnfParseResultItem parent)
spInput
- ZbnfParserStore.ParseResultItemImplement addString(java.lang.CharSequence src, java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, StringPart spInput, ZbnfParseResultItem parent, int srcLine, int srcColumn, java.lang.String srcFile)
spInput
- void addIdentifier(java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, java.lang.String sIdent, ZbnfParseResultItem parent, int srcLine, int srcColumn, java.lang.String srcFile)
void addIntegerNumber(java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, long number, java.lang.String[] sNumber, ZbnfParseResultItem parent)
void addFloatNumber(java.lang.String sSemantic, ZbnfSyntaxPrescript elementSyntax, double number, ZbnfParseResultItem parent)
ZbnfParseResultItem getItem(int idx)
int insert(ZbnfParserStore addStore, int idxStore, ZbnfParseResultItem parent)
addStore
- int getNextPosition()
void setCurrentPosition(int pos)
pos
- following position after last valid result. If pos is negative, no action is done.public java.util.Iterator<ZbnfParserStore.ParseResultItemImplement> getIterator()
void writeContentAsList(java.lang.Appendable out) throws java.io.IOException
ZbnfParser.writeResultAsTextList(Appendable)
as wrapper.out
- java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
void stop()