Class RParsec::Operators
In: rparsec/operators.rb
Parent: Object

This class helps building lexer and parser for operators. The case that one operator (++ for example) contains another operator (+) is automatically handled so client code don‘t have to worry about ambiguity.

Methods

[]   lexer   new   parser   sort  

Public Class methods

To create an instance of Operators for the given operators. The block parameter, if present, is used to convert the token text to another object when the token is recognized during grammar parsing phase.

Sort an array of operators so that contained operator appears after containers. When no containment exist between two operators, the shorter one takes precedence.

Public Instance methods

[](op)

Alias for parser

Get the lexer that lexes operators. If an operator is specified, the lexer for that operator is returned.

Get the parser for the given operator.

[Validate]