com.singularsys.jep.misc

## Class OperatorAsFunctionGrammarMatcher

- java.lang.Object
- - com.singularsys.jep.misc.OperatorAsFunctionGrammarMatcher

- All Implemented Interfaces:
    GrammarMatcher, java.io.Serializable

      public class OperatorAsFunctionGrammarMatcher
      extends java.lang.Object
      implements GrammarMatcher

  A GrammarMatcher which matches functions in the form ' +(x,y)' where + is an operator.
  Since:
    3.5
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OperatorAsFunctionGrammarMatcher(Token open, Token close, Token comma, java.util.List<Operator> operators)` Create a OperatorAsFunctionGrammarMatcher

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Token` | `errorToken(Lookahead2Iterator<Token> it)` Generate a token to use in GrammarExecptions
    `void` | `init(Jep jep)` Delayed initialisation, this methods is called whenever components of the jep instance are changed.
    `Node` | `match(Lookahead2Iterator<Token> it, GrammarParser parser)` Attempt to match a function, calls the GrammarParser.parseSubExpression() to match function arguments.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OperatorAsFunctionGrammarMatcher

          public OperatorAsFunctionGrammarMatcher(Token open,
                                                  Token close,
                                                  Token comma,
                                                  java.util.List<Operator> operators)

      Create a OperatorAsFunctionGrammarMatcher
      Parameters:
        `open` - token representing an opening bracket
        `close` - token representing a closing bracket
        `comma` - token representing a list item separator
        `operators` - list of operators which will be matched

  - ### 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.

    - #### errorToken

          protected Token errorToken(Lookahead2Iterator<Token> it)

      Generate a token to use in GrammarExecptions
      Parameters:
        `it` - used to get current position
      Returns:
        a TerminatorToken

    - #### match

          public Node match(Lookahead2Iterator<Token> it,
                            GrammarParser parser)
                     throws ParseException

      Attempt to match a function, calls the GrammarParser.parseSubExpression() to match function arguments.
      Specified by:
        `match` in interface `GrammarMatcher`
      Parameters:
        `it` - An iterator inspecting the input
        `parser` - the parser to use when evaluating sub expressions
      Returns:
        if matched returns a node representing the content, return null is does not match
      Throws:
        `ParseException` - if there is a syntactical error in the input.

Copyright © 2018 Singular Systems http://www.singularsys.com/jep