Absimpa v196

absimpa
Class Sequence<N,C extends java.lang.Enum<C>>

java.lang.Object
  extended by absimpa.Grammar<N,C>
      extended by absimpa.Sequence<N,C>

public class Sequence<N,C extends java.lang.Enum<C>>
extends Grammar<N,C>

is a grammar to recognize a sequence of child grammars. In BNF notation this would typically be written like the right side of

 A -> B C D E

The parser created from this grammar parses on a first come first serve basis, meaning that a sequence like A? A B can not parse the token sequence A B, due to the fact that the optional A matches immediately, leaving only the B of the input to be parsed, which does not match on the 2nd A of the rule. But notice that the rule A A? B is equivalent and can match A B just fine.


Constructor Summary
Sequence(Grammar<N,C> p)
           
 
Method Summary
 java.lang.String _ruleString()
           
 Sequence<N,C> add(Grammar<N,C> grammar)
           
 
Methods inherited from class absimpa.Grammar
compile, getName, opt, opt, rep, ruleString, setName, setNodeFactory, star, star, toBNF, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sequence

public Sequence(Grammar<N,C> p)
Method Detail

add

public Sequence<N,C> add(Grammar<N,C> grammar)

_ruleString

public java.lang.String _ruleString()

Absimpa v196