public abstract class BnfGrammar extends Object implements org.vesalainen.grammar.BnfGrammarIntf
Nonterminal and terminal names can contain all ascii characters except control characters 0x00 - 0x1f, space 0x20, apostrophe ' 0x27, parenthesis ( 0x28 ) 0x29, star * 0x2a, ´ 0x2c, plus + 0x2b, question mark ? 0x3f, ` 0x60 and vertical bar | 0x7c.
Anonymous terminals are either strings starting and ending with apostrophe. E.g '[0-9]+' or if apostrophes need to exist in regular expression it is possible to use expression `[0-9]+´.
Note that in produced grammar anonymous terminals are always quoted with apostrophes!
| Modifier and Type | Field and Description |
|---|---|
protected static org.vesalainen.regex.Regex |
inputCheck |
| Constructor and Description |
|---|
BnfGrammar() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
anonymousTerminal(String name,
org.vesalainen.grammar.Grammar g) |
protected void |
bnf() |
protected String |
choice(List<String> choice,
org.vesalainen.grammar.Grammar g) |
protected List<String> |
choicePart(List<String> choices) |
protected List<String> |
choices(List<String> choices,
String symbol) |
protected List<String> |
choices(String cp1,
String cp2) |
protected void |
ln() |
protected void |
or() |
void |
parseBnf(CharSequence text,
org.vesalainen.grammar.Grammar g) |
List<String> |
parseRhs(String text,
org.vesalainen.grammar.Grammar g) |
protected abstract List<String> |
parseRhsString(String text,
org.vesalainen.grammar.Grammar g) |
protected String |
part(String nt,
char quantifier,
org.vesalainen.grammar.Grammar g) |
protected void |
products() |
protected char |
quantifier() |
protected char |
quantifier(char quantifier) |
protected char |
quantifierChar(char quantifier) |
protected void |
rule(String symbol,
List<String> seq,
org.vesalainen.grammar.Grammar g) |
protected void |
s() |
protected String |
seq(List<String> seq,
org.vesalainen.grammar.Grammar g) |
protected List<String> |
seqPart(List<String> seqs) |
protected List<String> |
seqs(List<String> seqs,
String symbol) |
protected List<String> |
seqs(String symbol) |
protected String |
symbol(String name) |
protected String |
symbolName(String name) |
protected void bnf()
protected String choice(List<String> choice, org.vesalainen.grammar.Grammar g) throws IOException
IOExceptionprotected String seq(List<String> seq, org.vesalainen.grammar.Grammar g) throws IOException
IOExceptionprotected String part(String nt, char quantifier, org.vesalainen.grammar.Grammar g) throws IOException
IOExceptionprotected char quantifier()
protected char quantifier(char quantifier)
protected char quantifierChar(char quantifier)
protected void s()
protected void ln()
protected void or()
protected void products()
public void parseBnf(CharSequence text, org.vesalainen.grammar.Grammar g)
parseBnf in interface org.vesalainen.grammar.BnfGrammarIntfpublic List<String> parseRhs(String text, org.vesalainen.grammar.Grammar g)
parseRhs in interface org.vesalainen.grammar.BnfGrammarIntfCopyright © 2015. All rights reserved.