treetop 1.5.3 → 1.6.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile +12 -0
- data/History.txt +18 -0
- data/README.md +4 -0
- data/Rakefile +20 -40
- data/Treetop.tmbundle/Preferences/Comments.tmPreferences +28 -0
- data/Treetop.tmbundle/Snippets/grammar ___ end.tmSnippet +20 -0
- data/Treetop.tmbundle/Snippets/rule ___ end.tmSnippet +18 -0
- data/Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/designable.nib +1524 -0
- data/Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/keyedobjects.nib +0 -0
- data/Treetop.tmbundle/Support/syntax_tree_viewer.rb +117 -0
- data/Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage +358 -0
- data/Treetop.tmbundle/info.plist +10 -0
- data/doc/pitfalls_and_advanced_techniques.markdown +7 -1
- data/doc/syntactic_recognition.markdown +7 -2
- data/doc/tt.1 +1 -1
- data/examples/indented_blocks/indented_blocks.tt +73 -0
- data/examples/indented_blocks/indented_blocks_test.rb +24 -0
- data/lib/treetop/compiler/grammar_compiler.rb +6 -3
- data/lib/treetop/compiler/metagrammar.rb +301 -159
- data/lib/treetop/compiler/metagrammar.treetop +96 -13
- data/lib/treetop/compiler/node_classes/anything_symbol.rb +10 -2
- data/lib/treetop/compiler/node_classes/atomic_expression.rb +2 -2
- data/lib/treetop/compiler/node_classes/character_class.rb +10 -2
- data/lib/treetop/compiler/node_classes/choice.rb +11 -7
- data/lib/treetop/compiler/node_classes/nonterminal.rb +6 -2
- data/lib/treetop/compiler/node_classes/parenthesized_expression.rb +5 -1
- data/lib/treetop/compiler/node_classes/parsing_expression.rb +10 -1
- data/lib/treetop/compiler/node_classes/parsing_rule.rb +1 -1
- data/lib/treetop/compiler/node_classes/predicate.rb +8 -1
- data/lib/treetop/compiler/node_classes/predicate_block.rb +7 -0
- data/lib/treetop/compiler/node_classes/repetition.rb +28 -8
- data/lib/treetop/compiler/node_classes/sequence.rb +5 -1
- data/lib/treetop/compiler/node_classes/terminal.rb +36 -22
- data/lib/treetop/compiler/ruby_builder.rb +2 -2
- data/lib/treetop/ruby_extensions/string.rb +0 -6
- data/lib/treetop/runtime/compiled_parser.rb +33 -14
- data/lib/treetop/runtime/syntax_node.rb +24 -15
- data/lib/treetop/runtime/terminal_parse_failure.rb +4 -3
- data/lib/treetop/runtime/terminal_syntax_node.rb +4 -4
- data/lib/treetop/version.rb +2 -2
- data/treetop.gemspec +25 -165
- metadata +43 -98
- data/doc/site.rb +0 -112
- data/doc/sitegen.rb +0 -65
- data/examples/lambda_calculus/lambda_calculus +0 -0
- data/spec/compiler/and_predicate_spec.rb +0 -36
- data/spec/compiler/anything_symbol_spec.rb +0 -44
- data/spec/compiler/character_class_spec.rb +0 -301
- data/spec/compiler/choice_spec.rb +0 -80
- data/spec/compiler/circular_compilation_spec.rb +0 -30
- data/spec/compiler/failure_propagation_functional_spec.rb +0 -21
- data/spec/compiler/grammar_compiler_spec.rb +0 -113
- data/spec/compiler/grammar_spec.rb +0 -41
- data/spec/compiler/multibyte_chars_spec.rb +0 -38
- data/spec/compiler/namespace_spec.rb +0 -42
- data/spec/compiler/nonterminal_symbol_spec.rb +0 -40
- data/spec/compiler/not_predicate_spec.rb +0 -38
- data/spec/compiler/occurrence_range_spec.rb +0 -189
- data/spec/compiler/one_or_more_spec.rb +0 -35
- data/spec/compiler/optional_spec.rb +0 -37
- data/spec/compiler/parenthesized_expression_spec.rb +0 -19
- data/spec/compiler/parsing_rule_spec.rb +0 -61
- data/spec/compiler/repeated_subrule_spec.rb +0 -29
- data/spec/compiler/semantic_predicate_spec.rb +0 -175
- data/spec/compiler/sequence_spec.rb +0 -129
- data/spec/compiler/terminal_spec.rb +0 -170
- data/spec/compiler/terminal_symbol_spec.rb +0 -37
- data/spec/compiler/test_grammar.treetop +0 -7
- data/spec/compiler/test_grammar.tt +0 -7
- data/spec/compiler/test_grammar_do.treetop +0 -7
- data/spec/compiler/test_grammar_magic_coding.treetop +0 -8
- data/spec/compiler/test_grammar_magic_encoding.treetop +0 -8
- data/spec/compiler/tt_compiler_spec.rb +0 -224
- data/spec/compiler/zero_or_more_spec.rb +0 -56
- data/spec/composition/a.treetop +0 -11
- data/spec/composition/b.treetop +0 -11
- data/spec/composition/c.treetop +0 -10
- data/spec/composition/d.treetop +0 -10
- data/spec/composition/f.treetop +0 -17
- data/spec/composition/grammar_composition_spec.rb +0 -40
- data/spec/composition/subfolder/e_includes_c.treetop +0 -15
- data/spec/ruby_extensions/string_spec.rb +0 -32
- data/spec/runtime/compiled_parser_spec.rb +0 -123
- data/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
- data/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
- data/spec/runtime/interval_skip_list/insert_and_delete_node_spec.rb +0 -385
- data/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
- data/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
- data/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
- data/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -35
- data/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -163
- data/spec/runtime/interval_skip_list/spec_helper.rb +0 -91
- data/spec/runtime/syntax_node_spec.rb +0 -77
- data/spec/spec_helper.rb +0 -115
metadata
CHANGED
@@ -1,115 +1,101 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: treetop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Sobo
|
8
8
|
- Clifford Heath
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: polyglot
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0.3'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0.3'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: jeweler
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '2.0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '2.0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: activesupport
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
45
31
|
requirements:
|
46
|
-
- -
|
32
|
+
- - ">="
|
47
33
|
- !ruby/object:Gem::Version
|
48
|
-
version: '4
|
34
|
+
version: '4'
|
49
35
|
type: :development
|
50
36
|
prerelease: false
|
51
37
|
version_requirements: !ruby/object:Gem::Requirement
|
52
38
|
requirements:
|
53
|
-
- -
|
39
|
+
- - ">="
|
54
40
|
- !ruby/object:Gem::Version
|
55
|
-
version: '4
|
41
|
+
version: '4'
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
43
|
name: i18n
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
59
45
|
requirements:
|
60
|
-
- - ~>
|
46
|
+
- - "~>"
|
61
47
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0
|
48
|
+
version: '1.0'
|
63
49
|
type: :development
|
64
50
|
prerelease: false
|
65
51
|
version_requirements: !ruby/object:Gem::Requirement
|
66
52
|
requirements:
|
67
|
-
- - ~>
|
53
|
+
- - "~>"
|
68
54
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0
|
55
|
+
version: '1.0'
|
70
56
|
- !ruby/object:Gem::Dependency
|
71
57
|
name: rr
|
72
58
|
requirement: !ruby/object:Gem::Requirement
|
73
59
|
requirements:
|
74
|
-
- - ~>
|
60
|
+
- - "~>"
|
75
61
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
62
|
+
version: '3.0'
|
77
63
|
type: :development
|
78
64
|
prerelease: false
|
79
65
|
version_requirements: !ruby/object:Gem::Requirement
|
80
66
|
requirements:
|
81
|
-
- - ~>
|
67
|
+
- - "~>"
|
82
68
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
69
|
+
version: '3.0'
|
84
70
|
- !ruby/object:Gem::Dependency
|
85
71
|
name: rspec
|
86
72
|
requirement: !ruby/object:Gem::Requirement
|
87
73
|
requirements:
|
88
|
-
- - ~>
|
74
|
+
- - "~>"
|
89
75
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
76
|
+
version: '3'
|
91
77
|
type: :development
|
92
78
|
prerelease: false
|
93
79
|
version_requirements: !ruby/object:Gem::Requirement
|
94
80
|
requirements:
|
95
|
-
- - ~>
|
81
|
+
- - "~>"
|
96
82
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
83
|
+
version: '3'
|
98
84
|
- !ruby/object:Gem::Dependency
|
99
85
|
name: rake
|
100
86
|
requirement: !ruby/object:Gem::Requirement
|
101
87
|
requirements:
|
102
|
-
- -
|
88
|
+
- - ">="
|
103
89
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
90
|
+
version: '11'
|
105
91
|
type: :development
|
106
92
|
prerelease: false
|
107
93
|
version_requirements: !ruby/object:Gem::Requirement
|
108
94
|
requirements:
|
109
|
-
- -
|
95
|
+
- - ">="
|
110
96
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
112
|
-
description:
|
97
|
+
version: '11'
|
98
|
+
description: A Parsing Expression Grammar (PEG) Parser generator DSL for Ruby
|
113
99
|
email: cliffordheath@gmail.com
|
114
100
|
executables:
|
115
101
|
- tt
|
@@ -118,25 +104,34 @@ extra_rdoc_files:
|
|
118
104
|
- LICENSE
|
119
105
|
- README.md
|
120
106
|
files:
|
107
|
+
- Gemfile
|
108
|
+
- History.txt
|
121
109
|
- LICENSE
|
122
110
|
- README.md
|
123
111
|
- Rakefile
|
112
|
+
- Treetop.tmbundle/Preferences/Comments.tmPreferences
|
113
|
+
- Treetop.tmbundle/Snippets/grammar ___ end.tmSnippet
|
114
|
+
- Treetop.tmbundle/Snippets/rule ___ end.tmSnippet
|
115
|
+
- Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/designable.nib
|
116
|
+
- Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/keyedobjects.nib
|
117
|
+
- Treetop.tmbundle/Support/syntax_tree_viewer.rb
|
118
|
+
- Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage
|
119
|
+
- Treetop.tmbundle/info.plist
|
124
120
|
- bin/tt
|
125
121
|
- doc/contributing_and_planned_features.markdown
|
126
122
|
- doc/grammar_composition.markdown
|
127
123
|
- doc/index.markdown
|
128
124
|
- doc/pitfalls_and_advanced_techniques.markdown
|
129
125
|
- doc/semantic_interpretation.markdown
|
130
|
-
- doc/site.rb
|
131
|
-
- doc/sitegen.rb
|
132
126
|
- doc/syntactic_recognition.markdown
|
133
127
|
- doc/tt.1
|
134
128
|
- doc/using_in_ruby.markdown
|
129
|
+
- examples/indented_blocks/indented_blocks.tt
|
130
|
+
- examples/indented_blocks/indented_blocks_test.rb
|
135
131
|
- examples/lambda_calculus/arithmetic.rb
|
136
132
|
- examples/lambda_calculus/arithmetic.treetop
|
137
133
|
- examples/lambda_calculus/arithmetic_node_classes.rb
|
138
134
|
- examples/lambda_calculus/arithmetic_test.rb
|
139
|
-
- examples/lambda_calculus/lambda_calculus
|
140
135
|
- examples/lambda_calculus/lambda_calculus.rb
|
141
136
|
- examples/lambda_calculus/lambda_calculus.treetop
|
142
137
|
- examples/lambda_calculus/lambda_calculus_node_classes.rb
|
@@ -183,78 +178,28 @@ files:
|
|
183
178
|
- lib/treetop/runtime/terminal_parse_failure.rb
|
184
179
|
- lib/treetop/runtime/terminal_syntax_node.rb
|
185
180
|
- lib/treetop/version.rb
|
186
|
-
- spec/compiler/and_predicate_spec.rb
|
187
|
-
- spec/compiler/anything_symbol_spec.rb
|
188
|
-
- spec/compiler/character_class_spec.rb
|
189
|
-
- spec/compiler/choice_spec.rb
|
190
|
-
- spec/compiler/circular_compilation_spec.rb
|
191
|
-
- spec/compiler/failure_propagation_functional_spec.rb
|
192
|
-
- spec/compiler/grammar_compiler_spec.rb
|
193
|
-
- spec/compiler/grammar_spec.rb
|
194
|
-
- spec/compiler/multibyte_chars_spec.rb
|
195
|
-
- spec/compiler/namespace_spec.rb
|
196
|
-
- spec/compiler/nonterminal_symbol_spec.rb
|
197
|
-
- spec/compiler/not_predicate_spec.rb
|
198
|
-
- spec/compiler/occurrence_range_spec.rb
|
199
|
-
- spec/compiler/one_or_more_spec.rb
|
200
|
-
- spec/compiler/optional_spec.rb
|
201
|
-
- spec/compiler/parenthesized_expression_spec.rb
|
202
|
-
- spec/compiler/parsing_rule_spec.rb
|
203
|
-
- spec/compiler/repeated_subrule_spec.rb
|
204
|
-
- spec/compiler/semantic_predicate_spec.rb
|
205
|
-
- spec/compiler/sequence_spec.rb
|
206
|
-
- spec/compiler/terminal_spec.rb
|
207
|
-
- spec/compiler/terminal_symbol_spec.rb
|
208
|
-
- spec/compiler/test_grammar.treetop
|
209
|
-
- spec/compiler/test_grammar.tt
|
210
|
-
- spec/compiler/test_grammar_do.treetop
|
211
|
-
- spec/compiler/test_grammar_magic_coding.treetop
|
212
|
-
- spec/compiler/test_grammar_magic_encoding.treetop
|
213
|
-
- spec/compiler/tt_compiler_spec.rb
|
214
|
-
- spec/compiler/zero_or_more_spec.rb
|
215
|
-
- spec/composition/a.treetop
|
216
|
-
- spec/composition/b.treetop
|
217
|
-
- spec/composition/c.treetop
|
218
|
-
- spec/composition/d.treetop
|
219
|
-
- spec/composition/f.treetop
|
220
|
-
- spec/composition/grammar_composition_spec.rb
|
221
|
-
- spec/composition/subfolder/e_includes_c.treetop
|
222
|
-
- spec/ruby_extensions/string_spec.rb
|
223
|
-
- spec/runtime/compiled_parser_spec.rb
|
224
|
-
- spec/runtime/interval_skip_list/delete_spec.rb
|
225
|
-
- spec/runtime/interval_skip_list/expire_range_spec.rb
|
226
|
-
- spec/runtime/interval_skip_list/insert_and_delete_node_spec.rb
|
227
|
-
- spec/runtime/interval_skip_list/insert_spec.rb
|
228
|
-
- spec/runtime/interval_skip_list/interval_skip_list_spec.graffle
|
229
|
-
- spec/runtime/interval_skip_list/interval_skip_list_spec.rb
|
230
|
-
- spec/runtime/interval_skip_list/palindromic_fixture.rb
|
231
|
-
- spec/runtime/interval_skip_list/palindromic_fixture_spec.rb
|
232
|
-
- spec/runtime/interval_skip_list/spec_helper.rb
|
233
|
-
- spec/runtime/syntax_node_spec.rb
|
234
|
-
- spec/spec_helper.rb
|
235
181
|
- treetop.gemspec
|
236
182
|
homepage: https://github.com/cjheath/treetop
|
237
183
|
licenses:
|
238
184
|
- MIT
|
239
185
|
metadata: {}
|
240
|
-
post_install_message:
|
186
|
+
post_install_message:
|
241
187
|
rdoc_options: []
|
242
188
|
require_paths:
|
243
189
|
- lib
|
244
190
|
required_ruby_version: !ruby/object:Gem::Requirement
|
245
191
|
requirements:
|
246
|
-
- -
|
192
|
+
- - ">="
|
247
193
|
- !ruby/object:Gem::Version
|
248
194
|
version: '0'
|
249
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
196
|
requirements:
|
251
|
-
- -
|
197
|
+
- - ">="
|
252
198
|
- !ruby/object:Gem::Version
|
253
199
|
version: '0'
|
254
200
|
requirements: []
|
255
|
-
|
256
|
-
|
257
|
-
signing_key:
|
201
|
+
rubygems_version: 3.2.22
|
202
|
+
signing_key:
|
258
203
|
specification_version: 4
|
259
204
|
summary: A Ruby-based text parsing and interpretation DSL
|
260
205
|
test_files: []
|
data/doc/site.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'erector'
|
3
|
-
require "#{File.dirname(__FILE__)}/sitegen"
|
4
|
-
require 'fileutils'
|
5
|
-
require 'bluecloth'
|
6
|
-
|
7
|
-
class Layout < Erector::Widget
|
8
|
-
def content
|
9
|
-
html do
|
10
|
-
head do
|
11
|
-
link :rel => "stylesheet",
|
12
|
-
:type => "text/css",
|
13
|
-
:href => "./screen.css"
|
14
|
-
|
15
|
-
rawtext %(
|
16
|
-
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
17
|
-
</script>
|
18
|
-
<script type="text/javascript">
|
19
|
-
_uacct = "UA-3418876-1";
|
20
|
-
urchinTracker();
|
21
|
-
</script>
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
body do
|
26
|
-
div :id => 'top' do
|
27
|
-
div :id => 'main_navigation' do
|
28
|
-
main_navigation
|
29
|
-
end
|
30
|
-
end
|
31
|
-
div :id => 'middle' do
|
32
|
-
div :id => 'main_content' do
|
33
|
-
main_content
|
34
|
-
end
|
35
|
-
end
|
36
|
-
div :id => 'bottom' do
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def main_navigation
|
44
|
-
ul do
|
45
|
-
li { link_to "Documentation", SyntacticRecognition, Documentation }
|
46
|
-
li { link_to "Contribute", Contribute }
|
47
|
-
li { link_to "Home", Index }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def main_content
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
class Index < Layout
|
56
|
-
def main_content
|
57
|
-
bluecloth "index.markdown"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
class Documentation < Layout
|
62
|
-
abstract
|
63
|
-
|
64
|
-
def main_content
|
65
|
-
div :id => 'secondary_navigation' do
|
66
|
-
ul do
|
67
|
-
li { link_to 'Syntax', SyntacticRecognition }
|
68
|
-
li { link_to 'Semantics', SemanticInterpretation }
|
69
|
-
li { link_to 'Using In Ruby', UsingInRuby }
|
70
|
-
li { link_to 'Advanced Techniques', PitfallsAndAdvancedTechniques }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
div :id => 'documentation_content' do
|
75
|
-
documentation_content
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
class SyntacticRecognition < Documentation
|
81
|
-
def documentation_content
|
82
|
-
bluecloth "syntactic_recognition.markdown"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
class SemanticInterpretation < Documentation
|
87
|
-
def documentation_content
|
88
|
-
bluecloth "semantic_interpretation.markdown"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
class UsingInRuby < Documentation
|
93
|
-
def documentation_content
|
94
|
-
bluecloth "using_in_ruby.markdown"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
class PitfallsAndAdvancedTechniques < Documentation
|
99
|
-
def documentation_content
|
100
|
-
bluecloth "pitfalls_and_advanced_techniques.markdown"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
|
105
|
-
class Contribute < Layout
|
106
|
-
def main_content
|
107
|
-
bluecloth "contributing_and_planned_features.markdown"
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
|
112
|
-
Layout.generate_site
|
data/doc/sitegen.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
class Layout < Erector::Widget
|
2
|
-
|
3
|
-
class << self
|
4
|
-
def inherited(page_class)
|
5
|
-
puts page_class
|
6
|
-
(@@page_classes ||= []) << page_class
|
7
|
-
end
|
8
|
-
|
9
|
-
def generate_site
|
10
|
-
FileUtils.mkdir_p(site_dir)
|
11
|
-
@@page_classes.each do |page_class|
|
12
|
-
page_class.generate_html unless page_class.abstract?
|
13
|
-
puts page_class
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def generate_html
|
18
|
-
File.open(absolute_path, 'w') do |file|
|
19
|
-
file.write(new.to_html)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def absolute_path
|
24
|
-
absolutize(relative_path)
|
25
|
-
end
|
26
|
-
|
27
|
-
def relative_path
|
28
|
-
"#{name.gsub('::', '_').underscore}.html"
|
29
|
-
end
|
30
|
-
|
31
|
-
def absolutize(relative_path)
|
32
|
-
File.join(site_dir, relative_path)
|
33
|
-
end
|
34
|
-
|
35
|
-
def abstract
|
36
|
-
@abstract = true
|
37
|
-
end
|
38
|
-
|
39
|
-
def abstract?
|
40
|
-
@abstract
|
41
|
-
end
|
42
|
-
|
43
|
-
def site_dir
|
44
|
-
File.join(File.dirname(__FILE__), "site")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def bluecloth(relative_path)
|
49
|
-
File.open(File.join(File.dirname(__FILE__), relative_path)) do |file|
|
50
|
-
rawtext BlueCloth.new(file.read).to_html
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def absolutize(relative_path)
|
55
|
-
self.class.absolutize(relative_path)
|
56
|
-
end
|
57
|
-
|
58
|
-
def link_to(link_text, page_class, section_class=nil)
|
59
|
-
if instance_of?(page_class) || section_class && is_a?(section_class)
|
60
|
-
text link_text
|
61
|
-
else
|
62
|
-
a link_text, :href => page_class.relative_path
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
File without changes
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module AndPredicateSpec
|
4
|
-
describe "An &-predicated terminal symbol" do
|
5
|
-
testing_expression '&"foo"'
|
6
|
-
|
7
|
-
it "successfully parses input matching the terminal symbol, returning an epsilon syntax node" do
|
8
|
-
parse('foo', :consume_all_input => false) do |result|
|
9
|
-
result.should_not be_nil
|
10
|
-
result.interval.should == (0...0)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "A sequence of a terminal and an and another &-predicated terminal" do
|
16
|
-
testing_expression '"foo" &"bar"'
|
17
|
-
|
18
|
-
it "matches input matching both terminals, but only consumes the first" do
|
19
|
-
parse('foobar', :consume_all_input => false) do |result|
|
20
|
-
result.should_not be_nil
|
21
|
-
result.text_value.should == 'foo'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it "fails to parse input matching only the first terminal, with a terminal failure recorded at index 3" do
|
26
|
-
parse('foo') do |result|
|
27
|
-
result.should be_nil
|
28
|
-
terminal_failures = parser.terminal_failures
|
29
|
-
terminal_failures.size.should == 1
|
30
|
-
failure = terminal_failures[0]
|
31
|
-
failure.index.should == 3
|
32
|
-
failure.expected_string.should == 'bar'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module AnythingSymbolSpec
|
4
|
-
class Foo < Treetop::Runtime::SyntaxNode
|
5
|
-
end
|
6
|
-
|
7
|
-
describe "an anything symbol followed by a node class declaration and a block" do
|
8
|
-
testing_expression '. <AnythingSymbolSpec::Foo> { def a_method; end }'
|
9
|
-
|
10
|
-
it "matches any single character in a big range, returning an instance of the declared node class that responds to methods defined in the inline module" do
|
11
|
-
(33..127).each do |digit|
|
12
|
-
parse(digit.chr) do |result|
|
13
|
-
result.should_not be_nil
|
14
|
-
result.should be_an_instance_of(Foo)
|
15
|
-
result.should respond_to(:a_method)
|
16
|
-
result.interval.should == (0...1)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it "fails to parse epsilon" do
|
22
|
-
parse('').should be_nil
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module ModFoo
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "an anything symbol followed by a module declaration and a block" do
|
30
|
-
testing_expression '. <AnythingSymbolSpec::ModFoo> { def a_method; end }'
|
31
|
-
|
32
|
-
it "matches any single character in a big range, returning an instance of SyntaxNode extended by the declared module that responds to methods defined in the inline module" do
|
33
|
-
(33..127).each do |digit|
|
34
|
-
parse(digit.chr) do |result|
|
35
|
-
result.should_not be_nil
|
36
|
-
result.should be_an_instance_of(Treetop::Runtime::SyntaxNode)
|
37
|
-
result.should be_a_kind_of(ModFoo)
|
38
|
-
result.should respond_to(:a_method)
|
39
|
-
result.interval.should == (0...1)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|