|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.bnf.Bnf
public class Bnf
This class can read a file that is similar to BNF (Backus-Naur form). It is made specially to support SQL grammar.
Constructor Summary | |
---|---|
Bnf()
|
Method Summary | |
---|---|
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. |
java.util.StringTokenizer |
getTokenizer(java.lang.String s)
Get the tokenizer for the given syntax. |
void |
linkStatements()
Cross-link all statements with each other. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bnf()
Method Detail |
---|
public static Bnf getInstance(java.io.Reader csv) throws java.sql.SQLException, java.io.IOException
csv
- if not specified, the help.csv is used
java.sql.SQLException
java.io.IOException
public void visit(BnfVisitor visitor, java.lang.String s)
visitor
- the visitors
- the syntax to parsepublic static java.lang.String getRuleMapKey(java.lang.String token)
token
- the token
public RuleHead getRuleHead(java.lang.String title)
title
- the title
public 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 statement
public void linkStatements()
public void updateTopic(java.lang.String topic, DbContextRule rule)
topic
- the topicrule
- the database context rulepublic java.util.ArrayList<RuleHead> getStatements()
public java.util.StringTokenizer getTokenizer(java.lang.String s)
s
- the syntax
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |