regex-treetop 1.4.8
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.
- data/LICENSE +19 -0
 - data/README.md +164 -0
 - data/Rakefile +19 -0
 - data/bin/tt +112 -0
 - data/doc/contributing_and_planned_features.markdown +103 -0
 - data/doc/grammar_composition.markdown +65 -0
 - data/doc/index.markdown +90 -0
 - data/doc/pitfalls_and_advanced_techniques.markdown +51 -0
 - data/doc/semantic_interpretation.markdown +189 -0
 - data/doc/site.rb +112 -0
 - data/doc/sitegen.rb +65 -0
 - data/doc/syntactic_recognition.markdown +100 -0
 - data/doc/using_in_ruby.markdown +21 -0
 - data/examples/lambda_calculus/arithmetic.rb +551 -0
 - data/examples/lambda_calculus/arithmetic.treetop +97 -0
 - data/examples/lambda_calculus/arithmetic_node_classes.rb +7 -0
 - data/examples/lambda_calculus/arithmetic_test.rb +54 -0
 - data/examples/lambda_calculus/lambda_calculus +0 -0
 - data/examples/lambda_calculus/lambda_calculus.rb +718 -0
 - data/examples/lambda_calculus/lambda_calculus.treetop +132 -0
 - data/examples/lambda_calculus/lambda_calculus_node_classes.rb +5 -0
 - data/examples/lambda_calculus/lambda_calculus_test.rb +89 -0
 - data/examples/lambda_calculus/test_helper.rb +18 -0
 - data/lib/treetop.rb +16 -0
 - data/lib/treetop/bootstrap_gen_1_metagrammar.rb +45 -0
 - data/lib/treetop/compiler.rb +6 -0
 - data/lib/treetop/compiler/grammar_compiler.rb +44 -0
 - data/lib/treetop/compiler/lexical_address_space.rb +17 -0
 - data/lib/treetop/compiler/metagrammar.rb +3392 -0
 - data/lib/treetop/compiler/metagrammar.treetop +454 -0
 - data/lib/treetop/compiler/node_classes.rb +21 -0
 - data/lib/treetop/compiler/node_classes/anything_symbol.rb +18 -0
 - data/lib/treetop/compiler/node_classes/atomic_expression.rb +14 -0
 - data/lib/treetop/compiler/node_classes/character_class.rb +28 -0
 - data/lib/treetop/compiler/node_classes/choice.rb +31 -0
 - data/lib/treetop/compiler/node_classes/declaration_sequence.rb +24 -0
 - data/lib/treetop/compiler/node_classes/grammar.rb +28 -0
 - data/lib/treetop/compiler/node_classes/inline_module.rb +27 -0
 - data/lib/treetop/compiler/node_classes/nonterminal.rb +13 -0
 - data/lib/treetop/compiler/node_classes/optional.rb +19 -0
 - data/lib/treetop/compiler/node_classes/parenthesized_expression.rb +9 -0
 - data/lib/treetop/compiler/node_classes/parsing_expression.rb +146 -0
 - data/lib/treetop/compiler/node_classes/parsing_rule.rb +55 -0
 - data/lib/treetop/compiler/node_classes/predicate.rb +45 -0
 - data/lib/treetop/compiler/node_classes/predicate_block.rb +16 -0
 - data/lib/treetop/compiler/node_classes/regex.rb +23 -0
 - data/lib/treetop/compiler/node_classes/repetition.rb +55 -0
 - data/lib/treetop/compiler/node_classes/sequence.rb +71 -0
 - data/lib/treetop/compiler/node_classes/terminal.rb +20 -0
 - data/lib/treetop/compiler/node_classes/transient_prefix.rb +9 -0
 - data/lib/treetop/compiler/node_classes/treetop_file.rb +9 -0
 - data/lib/treetop/compiler/ruby_builder.rb +113 -0
 - data/lib/treetop/ruby_extensions.rb +2 -0
 - data/lib/treetop/ruby_extensions/string.rb +42 -0
 - data/lib/treetop/runtime.rb +5 -0
 - data/lib/treetop/runtime/compiled_parser.rb +118 -0
 - data/lib/treetop/runtime/interval_skip_list.rb +4 -0
 - data/lib/treetop/runtime/interval_skip_list/head_node.rb +15 -0
 - data/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +200 -0
 - data/lib/treetop/runtime/interval_skip_list/node.rb +164 -0
 - data/lib/treetop/runtime/syntax_node.rb +114 -0
 - data/lib/treetop/runtime/terminal_parse_failure.rb +16 -0
 - data/lib/treetop/runtime/terminal_syntax_node.rb +17 -0
 - data/lib/treetop/version.rb +9 -0
 - metadata +138 -0
 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Treetop
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Runtime
         
     | 
| 
      
 3 
     | 
    
         
            +
                class TerminalParseFailure
         
     | 
| 
      
 4 
     | 
    
         
            +
                  attr_reader :index, :expected_string
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize(index, expected_string)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @index = index
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @expected_string = expected_string
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def to_s
         
     | 
| 
      
 12 
     | 
    
         
            +
                    "String matching #{expected_string} expected."
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Treetop
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Runtime
         
     | 
| 
      
 3 
     | 
    
         
            +
                class TerminalSyntaxNode < SyntaxNode
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def initialize(input, interval)
         
     | 
| 
      
 6 
     | 
    
         
            +
                    super(input, interval, [])
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def inspect(indent="")
         
     | 
| 
      
 10 
     | 
    
         
            +
            	indent+
         
     | 
| 
      
 11 
     | 
    
         
            +
            	  self.class.to_s.sub(/.*:/,'') +
         
     | 
| 
      
 12 
     | 
    
         
            +
            	  " offset=#{interval.first}" +
         
     | 
| 
      
 13 
     | 
    
         
            +
            	  " #{text_value.inspect}"
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,138 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: regex-treetop
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 5 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 6 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 4
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 8
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 1.4.8
         
     | 
| 
      
 10 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 11 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Nathan Sobo
         
     | 
| 
      
 13 
     | 
    
         
            +
            autorequire: treetop
         
     | 
| 
      
 14 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 15 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2011-01-19 00:00:00 +00:00
         
     | 
| 
      
 18 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 19 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 21 
     | 
    
         
            +
              name: polyglot
         
     | 
| 
      
 22 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 23 
     | 
    
         
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 24 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 25 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 27 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 28 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 29 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 30 
     | 
    
         
            +
                    - 5
         
     | 
| 
      
 31 
     | 
    
         
            +
                    version: 0.2.5
         
     | 
| 
      
 32 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 33 
     | 
    
         
            +
              version_requirements: *id001
         
     | 
| 
      
 34 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 35 
     | 
    
         
            +
            email: nathansobo@gmail.com
         
     | 
| 
      
 36 
     | 
    
         
            +
            executables: 
         
     | 
| 
      
 37 
     | 
    
         
            +
            - tt
         
     | 
| 
      
 38 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 43 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 44 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 45 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 46 
     | 
    
         
            +
            - lib/treetop/bootstrap_gen_1_metagrammar.rb
         
     | 
| 
      
 47 
     | 
    
         
            +
            - lib/treetop/compiler/grammar_compiler.rb
         
     | 
| 
      
 48 
     | 
    
         
            +
            - lib/treetop/compiler/lexical_address_space.rb
         
     | 
| 
      
 49 
     | 
    
         
            +
            - lib/treetop/compiler/metagrammar.rb
         
     | 
| 
      
 50 
     | 
    
         
            +
            - lib/treetop/compiler/metagrammar.treetop
         
     | 
| 
      
 51 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/anything_symbol.rb
         
     | 
| 
      
 52 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/atomic_expression.rb
         
     | 
| 
      
 53 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/character_class.rb
         
     | 
| 
      
 54 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/choice.rb
         
     | 
| 
      
 55 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/declaration_sequence.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/grammar.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/inline_module.rb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/nonterminal.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/optional.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/parenthesized_expression.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/parsing_expression.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/parsing_rule.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/predicate.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/predicate_block.rb
         
     | 
| 
      
 65 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/regex.rb
         
     | 
| 
      
 66 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/repetition.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/sequence.rb
         
     | 
| 
      
 68 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/terminal.rb
         
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/transient_prefix.rb
         
     | 
| 
      
 70 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes/treetop_file.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - lib/treetop/compiler/node_classes.rb
         
     | 
| 
      
 72 
     | 
    
         
            +
            - lib/treetop/compiler/ruby_builder.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - lib/treetop/compiler.rb
         
     | 
| 
      
 74 
     | 
    
         
            +
            - lib/treetop/ruby_extensions/string.rb
         
     | 
| 
      
 75 
     | 
    
         
            +
            - lib/treetop/ruby_extensions.rb
         
     | 
| 
      
 76 
     | 
    
         
            +
            - lib/treetop/runtime/compiled_parser.rb
         
     | 
| 
      
 77 
     | 
    
         
            +
            - lib/treetop/runtime/interval_skip_list/head_node.rb
         
     | 
| 
      
 78 
     | 
    
         
            +
            - lib/treetop/runtime/interval_skip_list/interval_skip_list.rb
         
     | 
| 
      
 79 
     | 
    
         
            +
            - lib/treetop/runtime/interval_skip_list/node.rb
         
     | 
| 
      
 80 
     | 
    
         
            +
            - lib/treetop/runtime/interval_skip_list.rb
         
     | 
| 
      
 81 
     | 
    
         
            +
            - lib/treetop/runtime/syntax_node.rb
         
     | 
| 
      
 82 
     | 
    
         
            +
            - lib/treetop/runtime/terminal_parse_failure.rb
         
     | 
| 
      
 83 
     | 
    
         
            +
            - lib/treetop/runtime/terminal_syntax_node.rb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - lib/treetop/runtime.rb
         
     | 
| 
      
 85 
     | 
    
         
            +
            - lib/treetop/version.rb
         
     | 
| 
      
 86 
     | 
    
         
            +
            - lib/treetop.rb
         
     | 
| 
      
 87 
     | 
    
         
            +
            - bin/tt
         
     | 
| 
      
 88 
     | 
    
         
            +
            - doc/contributing_and_planned_features.markdown
         
     | 
| 
      
 89 
     | 
    
         
            +
            - doc/grammar_composition.markdown
         
     | 
| 
      
 90 
     | 
    
         
            +
            - doc/index.markdown
         
     | 
| 
      
 91 
     | 
    
         
            +
            - doc/pitfalls_and_advanced_techniques.markdown
         
     | 
| 
      
 92 
     | 
    
         
            +
            - doc/semantic_interpretation.markdown
         
     | 
| 
      
 93 
     | 
    
         
            +
            - doc/site.rb
         
     | 
| 
      
 94 
     | 
    
         
            +
            - doc/sitegen.rb
         
     | 
| 
      
 95 
     | 
    
         
            +
            - doc/syntactic_recognition.markdown
         
     | 
| 
      
 96 
     | 
    
         
            +
            - doc/using_in_ruby.markdown
         
     | 
| 
      
 97 
     | 
    
         
            +
            - examples/lambda_calculus/arithmetic.rb
         
     | 
| 
      
 98 
     | 
    
         
            +
            - examples/lambda_calculus/arithmetic.treetop
         
     | 
| 
      
 99 
     | 
    
         
            +
            - examples/lambda_calculus/arithmetic_node_classes.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - examples/lambda_calculus/arithmetic_test.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - examples/lambda_calculus/lambda_calculus
         
     | 
| 
      
 102 
     | 
    
         
            +
            - examples/lambda_calculus/lambda_calculus.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - examples/lambda_calculus/lambda_calculus.treetop
         
     | 
| 
      
 104 
     | 
    
         
            +
            - examples/lambda_calculus/lambda_calculus_node_classes.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - examples/lambda_calculus/lambda_calculus_test.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - examples/lambda_calculus/test_helper.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            has_rdoc: false
         
     | 
| 
      
 108 
     | 
    
         
            +
            homepage: http://functionalform.blogspot.com
         
     | 
| 
      
 109 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 112 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 116 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 117 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 118 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 119 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 120 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 121 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 122 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 123 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 124 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 125 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 126 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 127 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 128 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 129 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 130 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 133 
     | 
    
         
            +
            rubygems_version: 1.3.6
         
     | 
| 
      
 134 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 135 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 136 
     | 
    
         
            +
            summary: A Ruby-based text parsing and interpretation DSL (with regex extensions by Tom Locke)
         
     | 
| 
      
 137 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     |