Class RParsec::Keywords
In: rparsec/keywords.rb
Parent: Object

This class helps building lexers and parsers for keywords.

Methods

Attributes

keyword_symbol  [R]  The symbol used to identify a keyword token
lexer  [R]  The lexer that parses all the keywords represented

Public Class methods

To create an instance that lexes the given keywords case insensitively. default_lexer is used to lex a token first, the token text is then compared with the given keywords. If it matches any of the keyword, a keyword token is generated instead using keyword_symbol. The block parameter, if present, is used to convert the token text to another object when the token is recognized during parsing phase.

To create an instance that lexes the given keywords case sensitively. default_lexer is used to lex a token first, the token text is then compared with the given keywords. If it matches any of the keyword, a keyword token is generated instead using keyword_symbol. The block parameter, if present, is used to convert the token text to another object when the token is recognized during grammar parsing phase.

Public Instance methods

[](key)

Alias for parser

Do we lex case sensitively?

Get the parser that recognizes the token of the given keyword during the parsing phase.

[Validate]