parslet
parslet copied to clipboard
A small PEG based parser library. See the Hacking page in the Wiki as well.
I think defining helper methods is good solution to simplify complex transform logics like we do that for the parser class. However we cannot do that; for exmaple: ```ruby #...
There are some cases that `str` and `match` atoms would be case-insensitve. For exmaple, parsing hexadecimal number: ```ruby (str('0x') | str('0X') >> hex_digit.repeat(1) ``` I think case-insensitive version of these...
Currently, parslet is tested on Ruby 2.5 or higher so I think required Ruby version should be specified. This PR to add `required_ruby_version` to the gemspec.
GitLab is planning to upgrade ruby version to 3.1 first, and later to 3.2. For the preparation, we're checking if dependencies are compatible with these versions. (See https://gitlab.com/gitlab-org/gitlab/-/issues/404750 for more...
We've recently started using Parselet, and have it found it to be great! The documentation is really good too, but the Github link to it is a little broken since...
http://kschiess.github.io/parslet/get-started.html > This is what parslet calls an #error_tree. I tried to call this method and saw `NoMethodError`, and finally found out `#error_tree` had been removed on f921d91. This sentence...
Hallo! Since version 2 (I believe) what used to get output as e.g. `{"unlock_item"=>{"target"=>{"word"=>"chest"}}}` (using `.as()`) is now: `{"unlock_item"=>{"target"=>{"word"=>{"line_cache"=>{"last_line_end"=>nil, "line_ends"=>[]}, "position"=>{"bytepos"=>7, "string"=>"unlock chest"}, "str"=>"chest"}}}}` Is there any way to remove...
I faced the problem with mixing parslets with unpredictable match length (never know which parslet will be longer). I made an example and solution for this case you can see...
```ruby require "parslet" class Parser < Parslet::Parser rule(:a) do str("a").repeat(1, 1) end root(:a) end p Parser.new.parse("a") # => "a"@0 ``` Expected: ``` ["a"@0] ```
```ruby require "parslet" class Parser < Parslet::Parser rule(:a) do str("a").as(:a).repeat(1, 1).repeat(1, 1) end root(:a) end p Parser.new.parse("a") ``` Actual: ``` [{:a=>"a"@0}] ``` Expected: ``` [[{:a=>"a"@0}]] ```