You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with CSS parsing, and I've come across this confusing issue:
∴irbirb(main):001:0> require"parslet"=>trueirb(main):002:0> Parslet.match('\*').parse('*')=>"*"@0irb(main):003:0> Parslet.match('/').parse('/')=>"/"@0irb(main):004:0> Parslet.match('/\*').parse('/*')Parslet::ParseFailed: Don't know what to do with "*" at line 1 char 2. from /Users/zmoazeni/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/cause.rb:63:in `raise'from/Users/zmoazeni/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/base.rb:46:in`parse' from (irb):4 from /Users/zmoazeni/.rbenv/versions/1.9.3-p385/bin/irb:12:in `<main>'irb(main):005:0> (Parslet.match('/') >> Parslet.match('\*')).parse('/*')=> "/*"@0irb(main):006:0> '/*' =~ Parslet.match('/\*').re=> 0
Am I doing something boneheaded with combining the regex Parslet.match('/\*') or is this a subtle bug?
The text was updated successfully, but these errors were encountered:
I'm new to Parslet as well, so I may be wrong on this, but I think match is supposed to match a single character class. For example, you'd get the same error if you wrote Parslet.match('01').parse('01')
If you can give up the regex functionality (and just do exact matching), you could try Parslet.str('/*').parse('/*')
Hi guys, you are (almost) right – match only works with regular expression strings that match a single character, eg. [a-z], [\n\t]. Like @jonathanhefner said, str seems to be the thing you are looking for. Cheers!
Hi there. I'm loving this library.
I'm working with CSS parsing, and I've come across this confusing issue:
Am I doing something boneheaded with combining the regex
Parslet.match('/\*')
or is this a subtle bug?The text was updated successfully, but these errors were encountered: