def parse(str)
      if str.nil? || str == ""
        raise ParserError.new("Empty input",0,"")
      end

      s = StringScanner.new str
      @tokens = []

      until s.eos?
        s.skip(/\s+/) ? nil :
          s.scan(/\A[-+]?[0-9]*\.[0-9]+(e[-+]?[0-9]+)?/i) ? (@tokens << [:FLOAT, s.matched]) :
          s.scan(/\A[-+]?(0|[1-9]\d*)/)      ? (@tokens << [:INTEGER, s.matched]) :
          s.scan(/\A\.(?=\s)/)               ? (@tokens << ['.', '.']) :
          s.scan(/\A[a-z\-.\/_:*<>+=$#][a-z\-.\/_:$*<>+=0-9]*/i) ? (@tokens << [:SYMBOL, s.matched]) :
          s.scan(/\A"(([^\\"]|\\.)*)"/)        ? (@tokens << [:STRING, _unescape_string(s.matched.slice(1...-1))])  :
          s.scan(/\A./)                      ? (a = s.matched; @tokens << [a, a]) :
          (raise ParserError.new("Scanner error",s.pos,s.peek(5)))
      end
      @tokens.push [false, 'END']

      return do_parse.map do |i|
        normalize(i)
      end
    end
def parse(str)
      if str.nil? || str == ""
        raise ParserError.new("Empty input",0,"")
      end

      s = StringScanner.new str
      @tokens = []

      until s.eos?
        s.skip(/\s+/) ? nil :
          s.scan(/\A[-+]?[0-9]*\.[0-9]+(e[-+]?[0-9]+)?/i) ? (@tokens << [:FLOAT, s.matched]) :
          s.scan(/\A[-+]?(0|[1-9]\d*)/)      ? (@tokens << [:INTEGER, s.matched]) :
          s.scan(/\A\.(?=\s)/)               ? (@tokens << ['.', '.']) :
          s.scan(/\A[a-z\-.\/_:*<>+=$#][a-z\-.\/_:$*<>+=0-9]*/i) ? (@tokens << [:SYMBOL, s.matched]) :
          s.scan(/\A"(([^\\"]|\\.)*)"/)        ? (@tokens << [:STRING, _unescape_string(s.matched.slice(1...-1))])  :
          s.scan(/\A./)                      ? (a = s.matched; @tokens << [a, a]) :
          (raise ParserError.new("Scanner error",s.pos,s.peek(5)))
      end
      @tokens.push [false, 'END']

      return do_parse.map do |i|
        normalize(i)
      end
    end
parse s-expression string and return sexp objects.