class Rox::Core::TokenType
Constants
- BOOLEAN
- NOT_A_TYPE
- NUMBER
- STRING
- UNDEFINED
Attributes
pattern[RW]
text[RW]
Public Class Methods
from_token(token)
click to toggle source
# File lib/rox/core/roxx/token_type.rb, line 8 def self.from_token(token) unless token.nil? tested_token = token.downcase [TokenType::STRING, TokenType::NUMBER, TokenType::BOOLEAN, TokenType::UNDEFINED].each do |token_type| return token_type unless token_type.pattern.match(tested_token).nil? end end TokenType::NOT_A_TYPE end
new(text, pattern)
click to toggle source
# File lib/rox/core/roxx/token_type.rb, line 18 def initialize(text, pattern) @text = text @pattern = Regexp.new(pattern) end