Class: Nydp::Builtin::ParseInString

Inherits:
Object
  • Object
show all
Includes:
Base, Singleton
Defined in:
lib/nydp/builtin/parse_in_string.rb

Instance Method Summary collapse

Methods included from Base

#call, #handle_error, ignore_errors, #inspect, #name, #nydp_type, #to_s

Methods included from Helper

#cons, #list, #literal?, #pair?, #sig, #sym, #sym?

Methods included from Converter

#n2r, #r2n, #rubify

Instance Method Details

#builtin_call(arg) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/nydp/builtin/parse_in_string.rb', line 4

def builtin_call arg
  parser = Nydp.new_parser
  tokens = Nydp.new_tokeniser Nydp::StringReader.new "parse-in-string", arg.to_s
  parser.embedded(tokens)
rescue StandardError => e
  new_msg = "parse error: #{e.message._nydp_inspect} in\n#{Nydp.indent_text arg.to_s}"
  raise Nydp::Error.new new_msg
end