pegarus 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/LICENSE +22 -0
  2. data/README +24 -0
  3. data/Rakefile +70 -0
  4. data/lib/pegarus/ast/always.rb +7 -0
  5. data/lib/pegarus/ast/any.rb +13 -0
  6. data/lib/pegarus/ast/any_range.rb +13 -0
  7. data/lib/pegarus/ast/character.rb +13 -0
  8. data/lib/pegarus/ast/character_range.rb +13 -0
  9. data/lib/pegarus/ast/choice.rb +7 -0
  10. data/lib/pegarus/ast/concatenation.rb +7 -0
  11. data/lib/pegarus/ast/difference.rb +7 -0
  12. data/lib/pegarus/ast/grammar.rb +56 -0
  13. data/lib/pegarus/ast/if.rb +9 -0
  14. data/lib/pegarus/ast/never.rb +7 -0
  15. data/lib/pegarus/ast/pattern.rb +127 -0
  16. data/lib/pegarus/ast/product.rb +12 -0
  17. data/lib/pegarus/ast/set.rb +13 -0
  18. data/lib/pegarus/ast/unless.rb +9 -0
  19. data/lib/pegarus/ast/variable.rb +15 -0
  20. data/lib/pegarus/ast.rb +16 -0
  21. data/lib/pegarus/compatibility.rb +25 -0
  22. data/lib/pegarus/evaluator.rb +93 -0
  23. data/lib/pegarus/machine/compiler.rb +18 -0
  24. data/lib/pegarus/machine/generator.rb +8 -0
  25. data/lib/pegarus/machine/instructions.rb +65 -0
  26. data/lib/pegarus/machine/interpreter.rb +31 -0
  27. data/lib/pegarus/machine/state.rb +29 -0
  28. data/lib/pegarus/machine.rb +15 -0
  29. data/lib/pegarus/parser/parse_error.rb +3 -0
  30. data/lib/pegarus/parser.rb +1 -0
  31. data/lib/pegarus/rubinius/compiler.rb +220 -0
  32. data/lib/pegarus/rubinius/generator.rb +48 -0
  33. data/lib/pegarus/rubinius.rb +4 -0
  34. data/lib/pegarus/version.rb +3 -0
  35. data/lib/pegarus.rb +3 -0
  36. data/spec/ast/choice_spec.rb +9 -0
  37. data/spec/ast/concatenation_spec.rb +9 -0
  38. data/spec/ast/difference_spec.rb +9 -0
  39. data/spec/ast/grammar_spec.rb +54 -0
  40. data/spec/ast/if_spec.rb +8 -0
  41. data/spec/ast/pattern_spec.rb +123 -0
  42. data/spec/ast/product_spec.rb +28 -0
  43. data/spec/ast/unless_spec.rb +8 -0
  44. data/spec/ast/variable_spec.rb +4 -0
  45. data/spec/custom/guards/engine.rb +27 -0
  46. data/spec/machine/instructions/call_spec.rb +21 -0
  47. data/spec/machine/instructions/capture_spec.rb +15 -0
  48. data/spec/machine/instructions/char_spec.rb +34 -0
  49. data/spec/machine/instructions/choice_spec.rb +15 -0
  50. data/spec/machine/instructions/commit_spec.rb +21 -0
  51. data/spec/machine/instructions/fail_spec.rb +34 -0
  52. data/spec/machine/instructions/jump_spec.rb +15 -0
  53. data/spec/machine/instructions/return_spec.rb +16 -0
  54. data/spec/matching/evaluator/any_spec.rb +6 -0
  55. data/spec/matching/evaluator/character_spec.rb +6 -0
  56. data/spec/matching/evaluator/choice_spec.rb +6 -0
  57. data/spec/matching/evaluator/concatenation_spec.rb +6 -0
  58. data/spec/matching/evaluator/difference_spec.rb +6 -0
  59. data/spec/matching/evaluator/if_spec.rb +6 -0
  60. data/spec/matching/evaluator/product_spec.rb +6 -0
  61. data/spec/matching/evaluator/setup.rb +4 -0
  62. data/spec/matching/evaluator/unless_spec.rb +6 -0
  63. data/spec/matching/machine/any_spec.rb +6 -0
  64. data/spec/matching/machine/character_spec.rb +6 -0
  65. data/spec/matching/machine/choice_spec.rb +6 -0
  66. data/spec/matching/machine/concatenation_spec.rb +6 -0
  67. data/spec/matching/machine/difference_spec.rb +6 -0
  68. data/spec/matching/machine/if_spec.rb +6 -0
  69. data/spec/matching/machine/product_spec.rb +6 -0
  70. data/spec/matching/machine/setup.rb +4 -0
  71. data/spec/matching/machine/unless_spec.rb +6 -0
  72. data/spec/matching/rubinius/any_spec.rb +8 -0
  73. data/spec/matching/rubinius/character_spec.rb +8 -0
  74. data/spec/matching/rubinius/choice_spec.rb +8 -0
  75. data/spec/matching/rubinius/concatenation_spec.rb +8 -0
  76. data/spec/matching/rubinius/difference_spec.rb +8 -0
  77. data/spec/matching/rubinius/if_spec.rb +8 -0
  78. data/spec/matching/rubinius/product_spec.rb +8 -0
  79. data/spec/matching/rubinius/setup.rb +4 -0
  80. data/spec/matching/rubinius/unless_spec.rb +8 -0
  81. data/spec/matching/shared/any.rb +13 -0
  82. data/spec/matching/shared/character.rb +17 -0
  83. data/spec/matching/shared/choice.rb +16 -0
  84. data/spec/matching/shared/concatenation.rb +16 -0
  85. data/spec/matching/shared/difference.rb +2 -0
  86. data/spec/matching/shared/if.rb +16 -0
  87. data/spec/matching/shared/product.rb +2 -0
  88. data/spec/matching/shared/unless.rb +16 -0
  89. data/spec/spec_helper.rb +12 -0
  90. metadata +166 -0
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pegarus
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Brian Ford
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-24 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: |
22
+ Pegarus is, broadly, an implementation of LPEG on Rubinius. LPEG implements a
23
+ Parsing Expression Grammar using a parsing machine rather than the Packrat
24
+ algorithm. (See "A Text Pattern-Matching Tool based on Parsing Expression
25
+ Grammars" by Roberto Ierusalimschy.)
26
+
27
+ Pegarus actually implements an abstract syntax tree (AST) for the PEG. There
28
+ are various options to execute the AST against a subject string. One option is
29
+ a simple AST-walking evaluator. A second option is an implementation of the
30
+ LPEG parsing machine. A third option is a compiler that targets Rubinius
31
+ bytecode.
32
+
33
+ email: brixen@gmail.com
34
+ executables: []
35
+
36
+ extensions: []
37
+
38
+ extra_rdoc_files:
39
+ - README
40
+ - LICENSE
41
+ files:
42
+ - lib/pegarus/ast/always.rb
43
+ - lib/pegarus/ast/any.rb
44
+ - lib/pegarus/ast/any_range.rb
45
+ - lib/pegarus/ast/character.rb
46
+ - lib/pegarus/ast/character_range.rb
47
+ - lib/pegarus/ast/choice.rb
48
+ - lib/pegarus/ast/concatenation.rb
49
+ - lib/pegarus/ast/difference.rb
50
+ - lib/pegarus/ast/grammar.rb
51
+ - lib/pegarus/ast/if.rb
52
+ - lib/pegarus/ast/never.rb
53
+ - lib/pegarus/ast/pattern.rb
54
+ - lib/pegarus/ast/product.rb
55
+ - lib/pegarus/ast/set.rb
56
+ - lib/pegarus/ast/unless.rb
57
+ - lib/pegarus/ast/variable.rb
58
+ - lib/pegarus/ast.rb
59
+ - lib/pegarus/compatibility.rb
60
+ - lib/pegarus/evaluator.rb
61
+ - lib/pegarus/machine/compiler.rb
62
+ - lib/pegarus/machine/generator.rb
63
+ - lib/pegarus/machine/instructions.rb
64
+ - lib/pegarus/machine/interpreter.rb
65
+ - lib/pegarus/machine/state.rb
66
+ - lib/pegarus/machine.rb
67
+ - lib/pegarus/parser/parse_error.rb
68
+ - lib/pegarus/parser.rb
69
+ - lib/pegarus/rubinius/compiler.rb
70
+ - lib/pegarus/rubinius/generator.rb
71
+ - lib/pegarus/rubinius.rb
72
+ - lib/pegarus/version.rb
73
+ - lib/pegarus.rb
74
+ - spec/ast/choice_spec.rb
75
+ - spec/ast/concatenation_spec.rb
76
+ - spec/ast/difference_spec.rb
77
+ - spec/ast/grammar_spec.rb
78
+ - spec/ast/if_spec.rb
79
+ - spec/ast/pattern_spec.rb
80
+ - spec/ast/product_spec.rb
81
+ - spec/ast/unless_spec.rb
82
+ - spec/ast/variable_spec.rb
83
+ - spec/custom/guards/engine.rb
84
+ - spec/machine/instructions/call_spec.rb
85
+ - spec/machine/instructions/capture_spec.rb
86
+ - spec/machine/instructions/char_spec.rb
87
+ - spec/machine/instructions/choice_spec.rb
88
+ - spec/machine/instructions/commit_spec.rb
89
+ - spec/machine/instructions/fail_spec.rb
90
+ - spec/machine/instructions/jump_spec.rb
91
+ - spec/machine/instructions/return_spec.rb
92
+ - spec/matching/evaluator/any_spec.rb
93
+ - spec/matching/evaluator/character_spec.rb
94
+ - spec/matching/evaluator/choice_spec.rb
95
+ - spec/matching/evaluator/concatenation_spec.rb
96
+ - spec/matching/evaluator/difference_spec.rb
97
+ - spec/matching/evaluator/if_spec.rb
98
+ - spec/matching/evaluator/product_spec.rb
99
+ - spec/matching/evaluator/setup.rb
100
+ - spec/matching/evaluator/unless_spec.rb
101
+ - spec/matching/machine/any_spec.rb
102
+ - spec/matching/machine/character_spec.rb
103
+ - spec/matching/machine/choice_spec.rb
104
+ - spec/matching/machine/concatenation_spec.rb
105
+ - spec/matching/machine/difference_spec.rb
106
+ - spec/matching/machine/if_spec.rb
107
+ - spec/matching/machine/product_spec.rb
108
+ - spec/matching/machine/setup.rb
109
+ - spec/matching/machine/unless_spec.rb
110
+ - spec/matching/rubinius/any_spec.rb
111
+ - spec/matching/rubinius/character_spec.rb
112
+ - spec/matching/rubinius/choice_spec.rb
113
+ - spec/matching/rubinius/concatenation_spec.rb
114
+ - spec/matching/rubinius/difference_spec.rb
115
+ - spec/matching/rubinius/if_spec.rb
116
+ - spec/matching/rubinius/product_spec.rb
117
+ - spec/matching/rubinius/setup.rb
118
+ - spec/matching/rubinius/unless_spec.rb
119
+ - spec/matching/shared/any.rb
120
+ - spec/matching/shared/character.rb
121
+ - spec/matching/shared/choice.rb
122
+ - spec/matching/shared/concatenation.rb
123
+ - spec/matching/shared/difference.rb
124
+ - spec/matching/shared/if.rb
125
+ - spec/matching/shared/product.rb
126
+ - spec/matching/shared/unless.rb
127
+ - spec/spec_helper.rb
128
+ - Rakefile
129
+ - README
130
+ - LICENSE
131
+ has_rdoc: true
132
+ homepage: http://github.com/brixen/pegarus
133
+ licenses: []
134
+
135
+ post_install_message:
136
+ rdoc_options:
137
+ - --title
138
+ - Pegarus Gem
139
+ - --main
140
+ - README
141
+ - --line-numbers
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ segments:
149
+ - 0
150
+ version: "0"
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ segments:
156
+ - 0
157
+ version: "0"
158
+ requirements: []
159
+
160
+ rubyforge_project:
161
+ rubygems_version: 1.3.6
162
+ signing_key:
163
+ specification_version: 2
164
+ summary: Pegarus is an implementation of LPEG in Ruby.
165
+ test_files: []
166
+