lib/parser.rb
# Private: Parses a string token into either an a) symbol, or b) float.
#
# token - The string representation of any identifier or constant in Lisp
#
# Examples
#
#   parse_token("3")
#   # => 3.0
#
#   parse_token("define")
#   # => :define
#
# Returns the token as its true value, either a Symbol or a Number
Parses a string token into either an a) symbol, or b) float.
token - The string representation of any identifier or constant in Lisp

Examples





Returns the token as its true value, either a Symbol or a Number
Parses a string token into either an a ) symbol or b ) float . token - The string representation of any identifier or constant in Lisp Examples Returns the token as its true value either a Symbol or a Number
def parse_token(token)
    case token
      when NUMERIC_REGEX; token.to_f
      else; token.to_sym
    end
  end
def parse_token ( token ) case token when NUMERIC_REGEX ; token . to_f else ; token . to_sym end end
Private: Parses a string token into either an a) symbol, or b) float.
Private : Parses a string token into either an a ) symbol or b ) float .
token
<not_specific>