Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- cleanup: error tree is completely gone

  • Loading branch information...
commit f921d91b458ebb02d8ed1752a0f28e63fe3e6184 1 parent 25f47d5
@kschiess authored
View
8 example/email_parser.rb
@@ -4,6 +4,7 @@
$:.unshift File.dirname(__FILE__) + "/../lib"
require 'parslet'
+require 'parslet/convenience'
class EmailParser < Parslet::Parser
rule(:space) { match('\s').repeat(1) }
@@ -48,9 +49,4 @@ class EmailSanitizer < Parslet::Transform
STDOUT.puts "since you haven't specified any EMAIL_ADDR, for testing purposes we're using a.b.c.d@gmail.com"
end
-begin
- p sanitizer.apply(parser.parse(ARGV[0] || 'a.b.c.d@gmail.com'))
-rescue Parslet::ParseFailed => error
- puts error
- puts parser.error_tree
-end
+p sanitizer.apply(parser.parse_with_debug(ARGV[0] || 'a.b.c.d@gmail.com'))
View
3  example/json.rb
@@ -107,9 +107,6 @@ def self.parse(s)
out = transformer.apply(tree)
out
-
- rescue Parslet::ParseFailed => e
- puts e, parser.root.error_tree
end
end
View
7 lib/parslet/atoms/entity.rb
@@ -29,12 +29,7 @@ def parslet
def to_s_inner(prec)
name.to_s.upcase
- end
-
- def error_tree
- parslet.error_tree
- end
-
+ end
private
def raise_not_implemented
trace = caller.reject {|l| l =~ %r{#{Regexp.escape(__FILE__)}}} # blatantly stolen from dependencies.rb in activesupport
View
4 lib/parslet/atoms/named.rb
@@ -25,10 +25,6 @@ def apply(source, context)
def to_s_inner(prec)
"#{name}:#{parslet.to_s(prec)}"
end
-
- def error_tree
- parslet.error_tree
- end
private
def produce_return_value(val)
{ name => flatten(val, true) }
View
4 lib/parslet/parser.rb
@@ -61,10 +61,6 @@ def try(source, context)
root.try(source, context)
end
- def error_tree
- root.error_tree
- end
-
def to_s_inner(prec)
root.to_s(prec)
end
View
4 lib/parslet/rig/rspec.rb
@@ -7,8 +7,8 @@
block ?
block.call(result) :
(as == result || as.nil?)
- rescue Parslet::ParseFailed
- trace = parser.error_tree.ascii_tree if opts && opts[:trace]
+ rescue Parslet::ParseFailed => ex
+ trace = ex.cause.ascii_tree if opts && opts[:trace]
false
end
end
View
9 spec/parslet/atoms/named_spec.rb
@@ -1,13 +1,4 @@
require 'spec_helper'
describe Parslet::Atoms::Named do
- let(:hosted) { flexmock(:parslet, :error_tree => :hosted_tree) }
- let(:parslet) { Parslet::Atoms::Named.new(hosted, 'name')}
-
- describe "<- #error_tree" do
- let(:result) { parslet.error_tree }
- it "should return the hosted parslet's tree" do
- result.should == :hosted_tree
- end
- end
end
Please sign in to comment.
Something went wrong with that request. Please try again.