public class Bnf extends Object
| 构造器和说明 |
|---|
Bnf() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addAlias(String name,
String replacement)
Add an alias for a rule.
|
static Bnf |
getInstance(Reader csv)
Create an instance using the grammar specified in the CSV file.
|
HashMap<String,String> |
getNextTokenList(String query)
Get the list of tokens that can follow.
|
RuleHead |
getRuleHead(String title)
Get the rule head for the given title.
|
static String |
getRuleMapKey(String token)
Convert convert ruleLink to rule_link.
|
ArrayList<RuleHead> |
getStatements()
Get the list of possible statements.
|
static StringTokenizer |
getTokenizer(String s)
Get the tokenizer for the given syntax.
|
void |
linkStatements()
Cross-link all statements with each other.
|
static boolean |
startWithSpace(String s)
Check whether the statement starts with a whitespace.
|
void |
updateTopic(String topic,
DbContextRule rule)
Update a topic with a context specific rule.
|
void |
visit(BnfVisitor visitor,
String s)
Parse the syntax and let the rule call the visitor.
|
public static Bnf getInstance(Reader csv) throws SQLException, IOException
csv - if not specified, the help.csv is usedSQLExceptionIOExceptionpublic void addAlias(String name, String replacement)
name - for example "procedure"replacement - for example "@func@"public void visit(BnfVisitor visitor, String s)
visitor - the visitors - the syntax to parsepublic static boolean startWithSpace(String s)
s - the statementpublic static String getRuleMapKey(String token)
token - the tokenpublic RuleHead getRuleHead(String title)
title - the titlepublic HashMap<String,String> getNextTokenList(String query)
key: 1#SELECT, value: ELECT key: 1#SET, value: ET
query - the start of the statementpublic void linkStatements()
public void updateTopic(String topic, DbContextRule rule)
topic - the topicrule - the database context rulepublic ArrayList<RuleHead> getStatements()
public static StringTokenizer getTokenizer(String s)
s - the syntaxCopyright © 2017. All rights reserved.