Interface GrammarRuleBuilder

    • Method Detail

      • is

        GrammarRuleBuilder is​(Object e)
        Allows to provide definition of a grammar rule.

        Note: this method can be called only once for a rule. If it is called more than once, an GrammarException will be thrown.

        Parameters:
        e - expression of grammar
        Returns:
        this (for method chaining)
        Throws:
        GrammarException - if definition has been already done
        IllegalArgumentException - if given argument is not a parsing expression
      • is

        GrammarRuleBuilder is​(Object e,
                              Object... rest)
        Convenience method equivalent to calling is(grammarBuilder.sequence(e, rest)).
        Parameters:
        e - expression of grammar
        rest - rest of expressions
        Returns:
        this (for method chaining)
        Throws:
        GrammarException - if definition has been already done
        IllegalArgumentException - if any of given arguments is not a parsing expression
        See Also:
        is(Object)
      • override

        GrammarRuleBuilder override​(Object e)
        Allows to override definition of a grammar rule.

        This method has the same effect as is(Object), except that it can be called more than once to redefine a rule from scratch.

        Parameters:
        e - expression of grammar
        Returns:
        this (for method chaining)
        Throws:
        IllegalArgumentException - if given argument is not a parsing expression
      • override

        GrammarRuleBuilder override​(Object e,
                                    Object... rest)
        Convenience method equivalent to calling override(grammarBuilder.sequence(e, rest)).
        Parameters:
        e - expression of grammar
        rest - rest of expressions
        Returns:
        this (for method chaining)
        Throws:
        IllegalArgumentException - if any of given arguments is not a parsing expression
        See Also:
        override(Object)
      • skip

        void skip()
        Indicates that grammar rule should not lead to creation of AST node - its children should be attached directly to its parent.
      • skipIfOneChild

        void skipIfOneChild()
        Indicates that grammar rule should not lead to creation of AST node if it has exactly one child.