Class JavaForRule

  • All Implemented Interfaces:
    GrammaticalRuleI, GrammarMatcher, java.io.Serializable

    public class JavaForRule
    extends java.lang.Object
    implements GrammaticalRuleI
    Parses a java-style for loop for(i=0;i<10;++i) x+=i;.
     <JavaForRule> ::=
       <for> <open> <expression> <sep> <expression> <sep> <expression> <close> <statement>
     
    Any of the expressions can be empty Successful parse will return a LoopNode.
    Author:
    Richard Morris
    See Also:
    Serialized Form
    • Constructor Detail

      • JavaForRule

        public JavaForRule​(SymbolToken forToken,
                           SymbolToken open,
                           GrammaticalRuleI expression,
                           SymbolToken sep,
                           SymbolToken close,
                           GrammaticalRuleI statement)
        Constructor.
        Parameters:
        forToken - token representing "for"
        open - opening bracket
        expression - rule for parsing an expression
        sep - separator between part of statement
        close - closing bracket
        statement - rule for parsing a statement
    • Method Detail

      • init

        public void init​(Jep jep)
        Description copied from interface: GrammarMatcher
        Delayed initialisation, this methods is called whenever components of the jep instance are changed.
        Specified by:
        init in interface GrammarMatcher
        Parameters:
        jep - the current jep instance.