public class Bnf
extends java.lang.Object
| Constructor and Description |
|---|
Bnf() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAlias(java.lang.String name,
java.lang.String replacement)
Add an alias for a rule.
|
static Bnf |
getInstance(java.io.Reader csv)
Create an instance using the grammar specified in the CSV file.
|
java.util.HashMap<java.lang.String,java.lang.String> |
getNextTokenList(java.lang.String query)
Get the list of tokens that can follow.
|
RuleHead |
getRuleHead(java.lang.String title)
Get the rule head for the given title.
|
static java.lang.String |
getRuleMapKey(java.lang.String token)
Convert convert ruleLink to rule_link.
|
java.util.ArrayList<RuleHead> |
getStatements()
Get the list of possible statements.
|
static java.util.StringTokenizer |
getTokenizer(java.lang.String s)
Get the tokenizer for the given syntax.
|
void |
linkStatements()
Cross-link all statements with each other.
|
static boolean |
startWithSpace(java.lang.String s)
Check whether the statement starts with a whitespace.
|
void |
updateTopic(java.lang.String topic,
DbContextRule rule)
Update a topic with a context specific rule.
|
void |
visit(BnfVisitor visitor,
java.lang.String s)
Parse the syntax and let the rule call the visitor.
|
public static Bnf getInstance(java.io.Reader csv) throws java.sql.SQLException, java.io.IOException
csv - if not specified, the help.csv is usedjava.sql.SQLExceptionjava.io.IOExceptionpublic void addAlias(java.lang.String name,
java.lang.String replacement)
name - for example "procedure"replacement - for example "@func@"public void visit(BnfVisitor visitor, java.lang.String s)
visitor - the visitors - the syntax to parsepublic static boolean startWithSpace(java.lang.String s)
s - the statementpublic static java.lang.String getRuleMapKey(java.lang.String token)
token - the tokenpublic RuleHead getRuleHead(java.lang.String title)
title - the titlepublic java.util.HashMap<java.lang.String,java.lang.String> getNextTokenList(java.lang.String query)
key: 1#SELECT, value: ELECT key: 1#SET, value: ET
query - the start of the statementpublic void linkStatements()
public void updateTopic(java.lang.String topic,
DbContextRule rule)
topic - the topicrule - the database context rulepublic java.util.ArrayList<RuleHead> getStatements()
public static java.util.StringTokenizer getTokenizer(java.lang.String s)
s - the syntax