public class EBNFconvert
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Map<java.lang.String,EBNFread.EBNFdef> |
idx_cmpnDef
All syntax components sorted with syntax symbol name.
|
static java.lang.String |
sVersion
Version, history and license.
|
Constructor and Description |
---|
EBNFconvert() |
Modifier and Type | Method and Description |
---|---|
private void |
checkAllCmpn(EBNFread ebnf)
Checks for identifier definition:
If a EBNFdefinition is written as
syntaxdefXYZ ::= <identifier>
then the syntaxdef is added to the
#identifiers . |
private void |
checkCmpn(EBNFread.EBNFdef ebnfCmpn) |
(package private) void |
checkExpr(EBNFread.EBNFexpr expr,
EBNFread.EBNFdef cmpn,
int recursive) |
(package private) void |
checkitem(EBNFread.EBNFitem item,
EBNFread.EBNFdef cmpn,
int recursive) |
private void |
checkRepetition(java.lang.Appendable wr,
java.lang.String sCmpnBeforeRepeat,
EBNFread.EBNFexpr expr,
boolean bOnlyOneCmpn,
int level)
In EBNF a typical repetition is written like
COMPONENT { SEPARATOR COMPONENT }.
|
void |
convert(EBNFread ebnf,
java.lang.Appendable wr)
Invoked from a JZtxtcmd script.
|
private void |
convertExpr(java.lang.Appendable wr,
EBNFread.EBNFexpr expr,
int level) |
private java.lang.String |
convertItem(java.lang.Appendable wr,
java.lang.String sCmpnBeforeRepeat,
EBNFread.EBNFitem item,
EBNFread.EBNFdef inCmpn,
boolean bOnlyOneCmpn,
int level)
Converts one item from the read EBNF.
|
private void |
wrCmpnCall(java.lang.Appendable wr,
java.lang.String sCmpn,
boolean bOnlyOneCmpn,
EBNFread.EBNFdef inCmpn)
It writes a component call.
|
public static final java.lang.String sVersion
java.util.Map<java.lang.String,EBNFread.EBNFdef> idx_cmpnDef
public void convert(EBNFread ebnf, java.lang.Appendable wr)
ebnf
- parsed datawr
- FileWriterprivate void checkAllCmpn(EBNFread ebnf)
syntaxdefXYZ ::= <identifier>then the syntaxdef is added to the
#identifiers
. On usage with ... syntaxdefXYZ ...it is translated to
... <$?syntaxdefXYZ>
ebnf
- private void checkCmpn(EBNFread.EBNFdef ebnfCmpn)
void checkExpr(EBNFread.EBNFexpr expr, EBNFread.EBNFdef cmpn, int recursive)
void checkitem(EBNFread.EBNFitem item, EBNFread.EBNFdef cmpn, int recursive)
private void convertExpr(java.lang.Appendable wr, EBNFread.EBNFexpr expr, int level) throws java.io.IOException
java.io.IOException
private java.lang.String convertItem(java.lang.Appendable wr, java.lang.String sCmpnBeforeRepeat, EBNFread.EBNFitem item, EBNFread.EBNFdef inCmpn, boolean bOnlyOneCmpn, int level) throws java.io.IOException
EBNFitem::= '<*'?literal>' ## 'literal' | <""?literal> ## "literal" | \<<*\>?comment>\> ##| <$?cmpn> [? ::= ] ##ident::= breaks the loop, it is a new definition. | \[ \] ## [ simple option ] | \{ \} ## { repetition } Note: can be empty. | ( ) ##sub syntax with own structure . *
component { ...syntax... component }
: { <component> ? ...syntax...}
component
is not written but returned and checked for the next item if a repetition follows.
If it is not so, the component is written with #wrCmpnCall(Appendable, String)
-
EBNFalt
is a sub syntax of the item. It is converted with calling convertExpr(Appendable, org.vishia.zbnf.ebnfConvert.EBNFread.EBNFexpr, int)
.
wr
- sCmpnBeforeRepeat
- It is written as component like <?component>
using #wrCmpnCall(Appendable, String)
if this item is not a repetition. It is checked in #checkRepetition(Appendable, String, org.vishia.zbnf.ebnfConvert.EBNFread.EBNFexpr, int)
.item
- level
-
java.io.IOException
private void wrCmpnCall(java.lang.Appendable wr, java.lang.String sCmpn, boolean bOnlyOneCmpn, EBNFread.EBNFdef inCmpn) throws java.io.IOException
wr
- sCmpn
- java.io.IOException
private void checkRepetition(java.lang.Appendable wr, java.lang.String sCmpnBeforeRepeat, EBNFread.EBNFexpr expr, boolean bOnlyOneCmpn, int level) throws java.io.IOException
COMPONENT { SEPARATOR COMPONENT }.In Zbnf it is more simple, more clear and necessary to create data:
{ <COMPONENT> ? SEPARATOR }.After ? it is the backward branch.
wr
- sCmpnBeforeRepeat
- expr
- level
- java.io.IOException