walrat 0.1 → 0.3.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/walrat/additions/proc.rb +2 -21
- data/lib/walrat/additions/regexp.rb +3 -22
- data/lib/walrat/additions/string.rb +2 -34
- data/lib/walrat/additions/symbol.rb +3 -22
- data/lib/walrat/and_predicate.rb +2 -21
- data/lib/walrat/array_result.rb +2 -21
- data/lib/walrat/continuation_wrapper_exception.rb +2 -21
- data/lib/walrat/grammar.rb +9 -27
- data/lib/walrat/left_recursion_exception.rb +2 -21
- data/lib/walrat/location_tracking.rb +5 -26
- data/lib/walrat/match_data_wrapper.rb +2 -21
- data/lib/walrat/memoizing.rb +3 -23
- data/lib/walrat/memoizing_cache.rb +3 -23
- data/lib/walrat/no_parameter_marker.rb +3 -22
- data/lib/walrat/node.rb +4 -23
- data/lib/walrat/not_predicate.rb +2 -21
- data/lib/walrat/parse_error.rb +2 -21
- data/lib/walrat/parser_state.rb +2 -21
- data/lib/walrat/parslet.rb +2 -21
- data/lib/walrat/parslet_choice.rb +2 -21
- data/lib/walrat/parslet_combination.rb +2 -21
- data/lib/walrat/parslet_combining.rb +22 -90
- data/lib/walrat/parslet_merge.rb +2 -21
- data/lib/walrat/parslet_omission.rb +2 -21
- data/lib/walrat/parslet_repetition.rb +2 -21
- data/lib/walrat/parslet_repetition_default.rb +2 -21
- data/lib/walrat/parslet_sequence.rb +2 -21
- data/lib/walrat/predicate.rb +2 -21
- data/lib/walrat/proc_parslet.rb +2 -21
- data/lib/walrat/regexp_parslet.rb +2 -21
- data/lib/walrat/skipped_substring_exception.rb +2 -21
- data/lib/walrat/string_enumerator.rb +2 -23
- data/lib/walrat/string_parslet.rb +2 -21
- data/lib/walrat/string_result.rb +3 -22
- data/lib/walrat/symbol_parslet.rb +2 -21
- data/lib/walrat/version.rb +4 -23
- data/lib/walrat.rb +3 -28
- metadata +54 -54
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: f8f1e0bbb60d1d2b79e9ef31d0954f1f079de3715afd62c4e679c2cad86702c6
         | 
| 4 | 
            +
              data.tar.gz: e727e9a09ca8c10855300002c03f575a7461aa97f97dc1194a01e292dff66d60
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: 68b5f1039daff17d1893427b772d33e58d410c614c30b6eb11e86cdf296fc8b1d3ed7ea434c00df5897e96eb308fa181d7d98744e700a2657ac2040dfda5d51c
         | 
| 7 | 
            +
              data.tar.gz: 0a86baa4827d5e1172c36b355cbb6c1c1d790090e1b0ecb5da229a80d55f3e89d40569b914739ca5a31b0d0492d4ac47a4cddf6f0ec50b2fd436aac04db871ab
         | 
| @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
| @@ -1,29 +1,10 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 5 | 
            +
            require 'walrat/parslet_combining'
         | 
| 24 6 |  | 
| 25 7 | 
             
            class Regexp
         | 
| 26 | 
            -
              require 'walrat/parslet_combining'
         | 
| 27 8 | 
             
              include Walrat::ParsletCombining
         | 
| 28 9 |  | 
| 29 10 | 
             
              # Returns a RegexpParslet based on the receiver
         | 
| @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
| @@ -62,19 +43,6 @@ class String | |
| 62 43 | 
             
                i ? unpack('C*')[0...i].pack('C*').chars.to_a.length : nil
         | 
| 63 44 | 
             
              end
         | 
| 64 45 |  | 
| 65 | 
            -
              # multi-byte friendly [] implementation
         | 
| 66 | 
            -
              def [](range, other = Walrat::NoParameterMarker.instance)
         | 
| 67 | 
            -
                if other == Walrat::NoParameterMarker.instance
         | 
| 68 | 
            -
                  if range.kind_of? Range
         | 
| 69 | 
            -
                    chars.to_a[range].join
         | 
| 70 | 
            -
                  else
         | 
| 71 | 
            -
                    old_range range
         | 
| 72 | 
            -
                  end
         | 
| 73 | 
            -
                else
         | 
| 74 | 
            -
                  old_range range, other
         | 
| 75 | 
            -
                end
         | 
| 76 | 
            -
              end
         | 
| 77 | 
            -
             | 
| 78 46 | 
             
              # Returns a character-level enumerator for the receiver.
         | 
| 79 47 | 
             
              def enumerator
         | 
| 80 48 | 
             
                Walrat::StringEnumerator.new self
         | 
| @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
| @@ -31,7 +12,7 @@ class Symbol | |
| 31 12 | 
             
              # They can also be used to allow self-references within rules and productions
         | 
| 32 13 | 
             
              # (recursion); for example:
         | 
| 33 14 | 
             
              #
         | 
| 34 | 
            -
              #   rule :thing & :thing.optional & :other_thing
         | 
| 15 | 
            +
              #   rule :thing, :thing & :thing.optional & :other_thing
         | 
| 35 16 | 
             
              #
         | 
| 36 17 | 
             
              # Basically these SymbolParslets allow deferred evaluation of a rule or
         | 
| 37 18 | 
             
              # production (deferred until parsing takes place) rather than being evaluated
         | 
    
        data/lib/walrat/and_predicate.rb
    CHANGED
    
    | @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
    
        data/lib/walrat/array_result.rb
    CHANGED
    
    | @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
| @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
    
        data/lib/walrat/grammar.rb
    CHANGED
    
    | @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 | 
             
            require 'walrat/additions/string.rb'
         | 
| @@ -131,16 +112,17 @@ module Walrat | |
| 131 112 |  | 
| 132 113 | 
             
                  # Defines a rule and stores it
         | 
| 133 114 | 
             
                  #
         | 
| 134 | 
            -
                  # Expects an object that responds to the  | 
| 135 | 
            -
                  # | 
| 136 | 
            -
                  #  | 
| 137 | 
            -
                  # rule more than once will raise an | 
| 115 | 
            +
                  # Expects an object that responds to the to_parseable message.
         | 
| 116 | 
            +
                  #
         | 
| 117 | 
            +
                  # As this is intended to work with Parsing Expression Grammars, each rule
         | 
| 118 | 
            +
                  # may only be defined once. Defining a rule more than once will raise an
         | 
| 119 | 
            +
                  # ArgumentError.
         | 
| 138 120 | 
             
                  def rule symbol, parseable
         | 
| 139 121 | 
             
                    raise ArgumentError, 'nil symbol' if symbol.nil?
         | 
| 140 122 | 
             
                    raise ArgumentError, 'nil parseable' if parseable.nil?
         | 
| 141 123 | 
             
                    raise ArgumentError,
         | 
| 142 124 | 
             
                      "rule '#{symbol}' already defined" if rules.has_key? symbol
         | 
| 143 | 
            -
                    rules[symbol] = parseable
         | 
| 125 | 
            +
                    rules[symbol] = parseable.to_parseable
         | 
| 144 126 | 
             
                  end
         | 
| 145 127 |  | 
| 146 128 | 
             
                  # Dynamically creates a Node subclass inside the namespace of the current
         | 
| @@ -201,7 +183,7 @@ module Walrat | |
| 201 183 | 
             
                      productions.has_key?(rule_name)
         | 
| 202 184 | 
             
                    raise ArgumentError, "non-existent rule '#{rule_name}'" unless
         | 
| 203 185 | 
             
                      rules.has_key?(rule_name)
         | 
| 204 | 
            -
                    results =  | 
| 186 | 
            +
                    results = [:lexeme] if results.empty?
         | 
| 205 187 | 
             
                    const_get(rule_name.to_s.to_class_name).production *results
         | 
| 206 188 | 
             
                    productions[rule_name] = results
         | 
| 207 189 | 
             
                  end
         | 
| @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
| @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
| @@ -112,14 +93,12 @@ module Walrat | |
| 112 93 | 
             
                # true if the receiver is rightmost or equal.
         | 
| 113 94 | 
             
                # If the other object is farther to the right returns false.
         | 
| 114 95 | 
             
                def rightmost? other
         | 
| 115 | 
            -
                  if  | 
| 96 | 
            +
                  if line_end > other.line_end
         | 
| 116 97 | 
             
                    true
         | 
| 117 | 
            -
                  elsif other.line_end >  | 
| 98 | 
            +
                  elsif other.line_end > line_end
         | 
| 118 99 | 
             
                    false
         | 
| 119 | 
            -
                  elsif self.column_end >= other.column_end
         | 
| 120 | 
            -
                    true
         | 
| 121 100 | 
             
                  else
         | 
| 122 | 
            -
                     | 
| 101 | 
            +
                    column_end >= other.column_end
         | 
| 123 102 | 
             
                  end
         | 
| 124 103 | 
             
                end
         | 
| 125 104 | 
             
              end # module LocationTracking
         | 
| @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
    
        data/lib/walrat/memoizing.rb
    CHANGED
    
    | @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
| @@ -30,7 +11,7 @@ module Walrat | |
| 30 11 | 
             
                # appropriate to use a memoizer then it will be invoked, otherwise control
         | 
| 31 12 | 
             
                # will fall through to the real parse method. Turning off memoizing is as
         | 
| 32 13 | 
             
                # simple as not passing a value with the :memoizer key in the options hash.
         | 
| 33 | 
            -
                # This method defined  | 
| 14 | 
            +
                # This method is defined in a separate module so that it can easily be
         | 
| 34 15 | 
             
                # mixed in with all Parslets, ParsletCombinations and Predicates.
         | 
| 35 16 | 
             
                def memoizing_parse(string, options = {})
         | 
| 36 17 | 
             
                  # will use memoizer if available and not instructed to ignore it
         | 
| @@ -52,4 +33,3 @@ module Walrat | |
| 52 33 | 
             
                end
         | 
| 53 34 | 
             
              end # module Memoizing
         | 
| 54 35 | 
             
            end # module Walrat
         | 
| 55 | 
            -
             | 
| @@ -1,26 +1,8 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 5 | 
            +
            require 'singleton'
         | 
| 24 6 |  | 
| 25 7 | 
             
            module Walrat
         | 
| 26 8 | 
             
              # The MemoizingCache class memoizes the outcomes of parse operations. The
         | 
| @@ -38,7 +20,6 @@ module Walrat | |
| 38 20 | 
             
              class MemoizingCache
         | 
| 39 21 | 
             
                # Singleton class that serves as a default value for unset keys in a Hash.
         | 
| 40 22 | 
             
                class NoValueForKey
         | 
| 41 | 
            -
                  require 'singleton'
         | 
| 42 23 | 
             
                  include Singleton
         | 
| 43 24 | 
             
                end
         | 
| 44 25 |  | 
| @@ -74,7 +55,6 @@ module Walrat | |
| 74 55 |  | 
| 75 56 | 
             
                  # construct a unique identifier
         | 
| 76 57 | 
             
                  identifier = [options[:parseable], options[:line_start], options[:column_start]]
         | 
| 77 | 
            -
                  identifier << options[:origin] if options.has_key? :origin
         | 
| 78 58 | 
             
                  identifier << options[:skipping_override] if options.has_key? :skipping_override
         | 
| 79 59 |  | 
| 80 60 | 
             
                  if (result = @cache[identifier]) != NoValueForKey.instance
         | 
| @@ -1,30 +1,11 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 5 | 
            +
            require 'singleton'
         | 
| 24 6 |  | 
| 25 7 | 
             
            module Walrat
         | 
| 26 8 | 
             
              class NoParameterMarker
         | 
| 27 | 
            -
                require 'singleton'
         | 
| 28 9 | 
             
                include Singleton
         | 
| 29 10 | 
             
              end # class NoParameterMarker
         | 
| 30 11 | 
             
            end # module Walrat
         | 
    
        data/lib/walrat/node.rb
    CHANGED
    
    | @@ -1,29 +1,10 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
| 25 6 | 
             
            module Walrat
         | 
| 26 | 
            -
              # Make subclasses of this for  | 
| 7 | 
            +
              # Make subclasses of this for use in Abstract Syntax Trees (ASTs).
         | 
| 27 8 | 
             
              class Node
         | 
| 28 9 | 
             
                include Walrat::LocationTracking
         | 
| 29 10 |  | 
| @@ -50,7 +31,7 @@ module Walrat | |
| 50 31 | 
             
                  results.each { |result| attr_reader result }
         | 
| 51 32 |  | 
| 52 33 | 
             
                  # set up initializer
         | 
| 53 | 
            -
                  initialize_body = "def initialize #{results.map { |symbol| symbol.to_s}.join(', ')}\n"
         | 
| 34 | 
            +
                  initialize_body = "def initialize #{results.map { |symbol| symbol.to_s }.join(', ')}\n"
         | 
| 54 35 | 
             
                  initialize_body << %Q{  @string_value = ""\n}
         | 
| 55 36 | 
             
                  results.each do |result|
         | 
| 56 37 | 
             
                    initialize_body << "  @#{result} = #{result}\n"
         | 
    
        data/lib/walrat/not_predicate.rb
    CHANGED
    
    | @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  | 
    
        data/lib/walrat/parse_error.rb
    CHANGED
    
    | @@ -1,24 +1,5 @@ | |
| 1 | 
            -
            # Copyright 2007- | 
| 2 | 
            -
            #  | 
| 3 | 
            -
            # modification, are permitted provided that the following conditions are met:
         | 
| 4 | 
            -
            #
         | 
| 5 | 
            -
            # 1. Redistributions of source code must retain the above copyright notice,
         | 
| 6 | 
            -
            #    this list of conditions and the following disclaimer.
         | 
| 7 | 
            -
            # 2. Redistributions in binary form must reproduce the above copyright notice,
         | 
| 8 | 
            -
            #    this list of conditions and the following disclaimer in the documentation
         | 
| 9 | 
            -
            #    and/or other materials provided with the distribution.
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         | 
| 12 | 
            -
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
| 13 | 
            -
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         | 
| 14 | 
            -
            # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
         | 
| 15 | 
            -
            # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         | 
| 16 | 
            -
            # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         | 
| 17 | 
            -
            # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         | 
| 18 | 
            -
            # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         | 
| 19 | 
            -
            # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         | 
| 20 | 
            -
            # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         | 
| 21 | 
            -
            # POSSIBILITY OF SUCH DAMAGE.
         | 
| 1 | 
            +
            # Copyright 2007-present Greg Hurrell. All rights reserved.
         | 
| 2 | 
            +
            # Licensed under the terms of the BSD 2-clause license.
         | 
| 22 3 |  | 
| 23 4 | 
             
            require 'walrat'
         | 
| 24 5 |  |