Module: Omnium::Lexer::TokenHelper

Includes:
Common
Included in:
Core
Defined in:
lib/omnium/lexer/token_helper.rb

Constant Summary

Constants included from Common

Common::NIL_VALUE_TOKENS, Common::PARAMETERISED_TOKENS, Common::RESERVED_KEYWORDS, Common::TOKENS, Common::VALUE_BASED_TOKENS

Class Method Summary collapse

Methods included from Common

define_token_predicate_method, define_token_type_method, token_entity

Class Method Details

.define_new_token_method(type, value, arity = 0) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/omnium/lexer/token_helper.rb', line 8

def define_new_token_method(type, value, arity = 0)
  method_name = "new_#{type}_token"

  if arity == 0
    define_method(method_name) { Token.new(type, value) }
  else
    define_method(method_name) { |argument| Token.new(type, argument) }
  end
end