org.h2.build.doc
Class BnfRailroad

java.lang.Object
  extended by org.h2.build.doc.BnfRailroad
All Implemented Interfaces:
BnfVisitor

public class BnfRailroad
extends java.lang.Object
implements BnfVisitor

A BNF visitor that generates HTML railroad diagrams.


Constructor Summary
BnfRailroad()
           
 
Method Summary
 java.lang.String getHtml(Bnf bnf, java.lang.String syntaxLines)
          Generate the HTML for the given syntax.
 void visitRuleElement(boolean keyword, java.lang.String name, Rule link)
          Visit a rule element.
 void visitRuleFixed(int type)
          Visit a fixed rule.
 void visitRuleList(boolean or, java.util.ArrayList<Rule> list)
          Visit a rule list.
 void visitRuleOptional(Rule rule)
          Visit an optional rule.
 void visitRuleRepeat(boolean comma, Rule rule)
          Visit a repeat rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BnfRailroad

public BnfRailroad()
Method Detail

getHtml

public java.lang.String getHtml(Bnf bnf,
                                java.lang.String syntaxLines)
Generate the HTML for the given syntax.

Parameters:
bnf - the BNF parser
syntaxLines - the syntax
Returns:
the HTML

visitRuleElement

public void visitRuleElement(boolean keyword,
                             java.lang.String name,
                             Rule link)
Description copied from interface: BnfVisitor
Visit a rule element.

Specified by:
visitRuleElement in interface BnfVisitor
Parameters:
keyword - whether this is a keyword
name - the element name
link - the linked rule if it's not a keyword

visitRuleRepeat

public void visitRuleRepeat(boolean comma,
                            Rule rule)
Description copied from interface: BnfVisitor
Visit a repeat rule.

Specified by:
visitRuleRepeat in interface BnfVisitor
Parameters:
comma - whether the comma is repeated as well
rule - the element to repeat

visitRuleFixed

public void visitRuleFixed(int type)
Description copied from interface: BnfVisitor
Visit a fixed rule.

Specified by:
visitRuleFixed in interface BnfVisitor
Parameters:
type - the type

visitRuleList

public void visitRuleList(boolean or,
                          java.util.ArrayList<Rule> list)
Description copied from interface: BnfVisitor
Visit a rule list.

Specified by:
visitRuleList in interface BnfVisitor
Parameters:
or - true for OR, false for AND
list - the rules

visitRuleOptional

public void visitRuleOptional(Rule rule)
Description copied from interface: BnfVisitor
Visit an optional rule.

Specified by:
visitRuleOptional in interface BnfVisitor
Parameters:
rule - the rule