Class: RParsec::Operators

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

new(ops, &block)

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(ops)

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

lexer(op=nil)

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

parser(op)

Get the parser for the given operator.

[Validate]