vanilla 1.15.1 → 1.16
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/lib/vanilla.rb +2 -1
- data/lib/vanilla/renderers/base.rb +2 -2
- data/lib/vanilla/routes.rb +5 -18
- data/lib/vanilla/snip_reference_parser.rb +87 -64
- data/pristine_app/Gemfile.lock +2 -2
- data/pristine_app/README +11 -0
- data/pristine_app/soups/dynasnips/current_snip.rb +7 -7
- data/pristine_app/soups/tutorial/vanilla-rb.snip +2 -2
- data/pristine_app/soups/tutorial/vanilla.snip +1 -1
- data/test/dynasnip_test.rb +13 -0
- data/test/dynasnips/link_to_current_snip_test.rb +19 -0
- data/test/dynasnips/link_to_test.rb +27 -0
- data/test/dynasnips/page_title_test.rb +19 -0
- data/test/{base_renderer_test.rb → renderers/base_renderer_test.rb} +0 -0
- data/test/{erb_renderer_test.rb → renderers/erb_renderer_test.rb} +0 -0
- data/test/{haml_renderer_test.rb → renderers/haml_renderer_test.rb} +0 -0
- data/test/{markdown_renderer_test.rb → renderers/markdown_renderer_test.rb} +0 -0
- data/test/{raw_renderer_test.rb → renderers/raw_renderer_test.rb} +0 -0
- data/test/{ruby_renderer_test.rb → renderers/ruby_renderer_test.rb} +0 -0
- data/test/{snip_reference_test.rb → snip_inclusion_test.rb} +1 -1
- data/test/snip_reference_parser_test.rb +110 -42
- data/test/vanilla_presenting_test.rb +1 -5
- metadata +46 -57
- data/lib/vanilla/snip_reference.rb +0 -754
- data/lib/vanilla/snip_reference.treetop +0 -67
- data/pristine_app/tmp/restart.txt +0 -0
- data/test/soup/blah.snip +0 -4
- data/test/soup/blah.snip.erb +0 -4
- data/test/soup/blah.snip.haml +0 -4
- data/test/soup/blah.snip.markdown +0 -4
- data/test/soup/blah.snip.rb +0 -4
- data/test/soup/blah.snip.textile +0 -4
- data/test/soup/current_snip.snip +0 -14
- data/test/soup/layout.snip +0 -4
- data/test/soup/test.snip +0 -3
- data/test/soup/test_dyna.snip +0 -7
@@ -2,8 +2,6 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
context "When presenting" do
|
4
4
|
setup do
|
5
|
-
require File.expand_path("../../pristine_app/soups/dynasnips/link_to", __FILE__)
|
6
|
-
@app.soup << LinkTo.snip_attributes
|
7
5
|
set_main_template "<tag>{current_snip}</tag>"
|
8
6
|
create_snip :name => "test", :content => "blah {other_snip}", :part => 'part content'
|
9
7
|
create_snip :name => "other_snip", :content => "blah!"
|
@@ -103,9 +101,7 @@ context "When presenting" do
|
|
103
101
|
context "and a custom default renderer has been provided" do
|
104
102
|
should "use that renderer" do
|
105
103
|
@app = Vanilla::App.new(:soup => soup_path, :default_renderer => ::Vanilla::Renderers::Bold)
|
106
|
-
|
107
|
-
@app.soup << CurrentSnip.snip_attributes
|
108
|
-
create_snip :name => "layout", :content => "{current_snip}", :render_as => "base"
|
104
|
+
create_snip :name => "layout", :content => "{test}", :render_as => "base"
|
109
105
|
create_snip :name => "test", :content => "test"
|
110
106
|
assert_response_body "<b>test</b>", "/test"
|
111
107
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 47
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 1.15.1
|
8
|
+
- 16
|
9
|
+
version: "1.16"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- James Adam
|
@@ -15,10 +14,13 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-
|
17
|
+
date: 2011-05-03 00:00:00 +01:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
21
|
+
prerelease: false
|
22
|
+
type: :runtime
|
23
|
+
name: rack
|
22
24
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
25
|
none: false
|
24
26
|
requirements:
|
@@ -31,10 +33,10 @@ dependencies:
|
|
31
33
|
- 1
|
32
34
|
version: 0.9.1
|
33
35
|
requirement: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
34
37
|
prerelease: false
|
35
|
-
name: rack
|
36
38
|
type: :runtime
|
37
|
-
|
39
|
+
name: soup
|
38
40
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
41
|
none: false
|
40
42
|
requirements:
|
@@ -47,10 +49,10 @@ dependencies:
|
|
47
49
|
- 6
|
48
50
|
version: 1.0.6
|
49
51
|
requirement: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
50
53
|
prerelease: false
|
51
|
-
name: soup
|
52
54
|
type: :runtime
|
53
|
-
|
55
|
+
name: ratom
|
54
56
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
55
57
|
none: false
|
56
58
|
requirements:
|
@@ -63,10 +65,10 @@ dependencies:
|
|
63
65
|
- 5
|
64
66
|
version: 0.3.5
|
65
67
|
requirement: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
66
69
|
prerelease: false
|
67
|
-
name: ratom
|
68
70
|
type: :runtime
|
69
|
-
|
71
|
+
name: RedCloth
|
70
72
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
73
|
none: false
|
72
74
|
requirements:
|
@@ -79,10 +81,10 @@ dependencies:
|
|
79
81
|
- 1
|
80
82
|
version: 4.1.1
|
81
83
|
requirement: *id004
|
84
|
+
- !ruby/object:Gem::Dependency
|
82
85
|
prerelease: false
|
83
|
-
name: RedCloth
|
84
86
|
type: :runtime
|
85
|
-
|
87
|
+
name: BlueCloth
|
86
88
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
87
89
|
none: false
|
88
90
|
requirements:
|
@@ -95,56 +97,56 @@ dependencies:
|
|
95
97
|
- 0
|
96
98
|
version: 1.0.0
|
97
99
|
requirement: *id005
|
100
|
+
- !ruby/object:Gem::Dependency
|
98
101
|
prerelease: false
|
99
|
-
name: BlueCloth
|
100
102
|
type: :runtime
|
101
|
-
|
103
|
+
name: haml
|
102
104
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
103
105
|
none: false
|
104
106
|
requirements:
|
105
107
|
- - ">="
|
106
108
|
- !ruby/object:Gem::Version
|
107
|
-
hash:
|
109
|
+
hash: 3
|
108
110
|
segments:
|
109
|
-
-
|
110
|
-
|
111
|
-
- 1
|
112
|
-
version: 1.4.1
|
111
|
+
- 0
|
112
|
+
version: "0"
|
113
113
|
requirement: *id006
|
114
|
+
- !ruby/object:Gem::Dependency
|
114
115
|
prerelease: false
|
115
|
-
name: treetop
|
116
116
|
type: :runtime
|
117
|
-
|
117
|
+
name: parslet
|
118
118
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
119
119
|
none: false
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
hash:
|
123
|
+
hash: 31
|
124
124
|
segments:
|
125
|
+
- 1
|
126
|
+
- 2
|
125
127
|
- 0
|
126
|
-
version:
|
128
|
+
version: 1.2.0
|
127
129
|
requirement: *id007
|
128
|
-
prerelease: false
|
129
|
-
name: haml
|
130
|
-
type: :runtime
|
131
130
|
- !ruby/object:Gem::Dependency
|
131
|
+
prerelease: false
|
132
|
+
type: :development
|
133
|
+
name: kintama
|
132
134
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
133
135
|
none: false
|
134
136
|
requirements:
|
135
137
|
- - ">="
|
136
138
|
- !ruby/object:Gem::Version
|
137
|
-
hash:
|
139
|
+
hash: 23
|
138
140
|
segments:
|
139
141
|
- 0
|
140
142
|
- 1
|
141
|
-
-
|
142
|
-
version: 0.1.
|
143
|
+
- 6
|
144
|
+
version: 0.1.6
|
143
145
|
requirement: *id008
|
146
|
+
- !ruby/object:Gem::Dependency
|
144
147
|
prerelease: false
|
145
|
-
name: kintama
|
146
148
|
type: :development
|
147
|
-
|
149
|
+
name: mocha
|
148
150
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
149
151
|
none: false
|
150
152
|
requirements:
|
@@ -155,9 +157,6 @@ dependencies:
|
|
155
157
|
- 0
|
156
158
|
version: "0"
|
157
159
|
requirement: *id009
|
158
|
-
prerelease: false
|
159
|
-
name: mocha
|
160
|
-
type: :development
|
161
160
|
description:
|
162
161
|
email: james@lazyatom.com.com
|
163
162
|
executables:
|
@@ -169,25 +168,18 @@ extra_rdoc_files:
|
|
169
168
|
files:
|
170
169
|
- Rakefile
|
171
170
|
- README
|
172
|
-
- test/base_renderer_test.rb
|
173
171
|
- test/dynasnip_test.rb
|
174
|
-
- test/
|
175
|
-
- test/
|
176
|
-
- test/
|
177
|
-
- test/
|
178
|
-
- test/
|
172
|
+
- test/dynasnips/link_to_current_snip_test.rb
|
173
|
+
- test/dynasnips/link_to_test.rb
|
174
|
+
- test/dynasnips/page_title_test.rb
|
175
|
+
- test/renderers/base_renderer_test.rb
|
176
|
+
- test/renderers/erb_renderer_test.rb
|
177
|
+
- test/renderers/haml_renderer_test.rb
|
178
|
+
- test/renderers/markdown_renderer_test.rb
|
179
|
+
- test/renderers/raw_renderer_test.rb
|
180
|
+
- test/renderers/ruby_renderer_test.rb
|
181
|
+
- test/snip_inclusion_test.rb
|
179
182
|
- test/snip_reference_parser_test.rb
|
180
|
-
- test/snip_reference_test.rb
|
181
|
-
- test/soup/blah.snip
|
182
|
-
- test/soup/blah.snip.erb
|
183
|
-
- test/soup/blah.snip.haml
|
184
|
-
- test/soup/blah.snip.markdown
|
185
|
-
- test/soup/blah.snip.rb
|
186
|
-
- test/soup/blah.snip.textile
|
187
|
-
- test/soup/current_snip.snip
|
188
|
-
- test/soup/layout.snip
|
189
|
-
- test/soup/test.snip
|
190
|
-
- test/soup/test_dyna.snip
|
191
183
|
- test/test_helper.rb
|
192
184
|
- test/vanilla_app_test.rb
|
193
185
|
- test/vanilla_presenting_test.rb
|
@@ -206,8 +198,6 @@ files:
|
|
206
198
|
- lib/vanilla/renderers.rb
|
207
199
|
- lib/vanilla/request.rb
|
208
200
|
- lib/vanilla/routes.rb
|
209
|
-
- lib/vanilla/snip_reference.rb
|
210
|
-
- lib/vanilla/snip_reference.treetop
|
211
201
|
- lib/vanilla/snip_reference_parser.rb
|
212
202
|
- lib/vanilla/static.rb
|
213
203
|
- lib/vanilla.rb
|
@@ -247,7 +237,6 @@ files:
|
|
247
237
|
- pristine_app/soups/tutorial/tutorial.snip.markdown
|
248
238
|
- pristine_app/soups/tutorial/vanilla-rb.snip
|
249
239
|
- pristine_app/soups/tutorial/vanilla.snip
|
250
|
-
- pristine_app/tmp/restart.txt
|
251
240
|
has_rdoc: true
|
252
241
|
homepage: http://github.com/lazyatom/vanilla-rb
|
253
242
|
licenses: []
|
@@ -279,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
268
|
requirements: []
|
280
269
|
|
281
270
|
rubyforge_project: vanilla
|
282
|
-
rubygems_version: 1.
|
271
|
+
rubygems_version: 1.3.7
|
283
272
|
signing_key:
|
284
273
|
specification_version: 3
|
285
274
|
summary: A bliki-type web content thing.
|
@@ -1,754 +0,0 @@
|
|
1
|
-
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
-
|
3
|
-
|
4
|
-
module SnipReference
|
5
|
-
include Treetop::Runtime
|
6
|
-
|
7
|
-
def root
|
8
|
-
@root ||= :snip_call
|
9
|
-
end
|
10
|
-
|
11
|
-
module SnipCall0
|
12
|
-
def spaces
|
13
|
-
elements[0]
|
14
|
-
end
|
15
|
-
|
16
|
-
def argument_list
|
17
|
-
elements[1]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
module SnipCall1
|
22
|
-
end
|
23
|
-
|
24
|
-
def _nt_snip_call
|
25
|
-
start_index = index
|
26
|
-
if node_cache[:snip_call].has_key?(index)
|
27
|
-
cached = node_cache[:snip_call][index]
|
28
|
-
if cached
|
29
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
30
|
-
@index = cached.interval.end
|
31
|
-
end
|
32
|
-
return cached
|
33
|
-
end
|
34
|
-
|
35
|
-
i0, s0 = index, []
|
36
|
-
if has_terminal?("{", false, index)
|
37
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
38
|
-
@index += 1
|
39
|
-
else
|
40
|
-
terminal_parse_failure("{")
|
41
|
-
r1 = nil
|
42
|
-
end
|
43
|
-
s0 << r1
|
44
|
-
if r1
|
45
|
-
r2 = _nt_snip_name
|
46
|
-
s0 << r2
|
47
|
-
if r2
|
48
|
-
i4, s4 = index, []
|
49
|
-
r5 = _nt_spaces
|
50
|
-
s4 << r5
|
51
|
-
if r5
|
52
|
-
r6 = _nt_argument_list
|
53
|
-
s4 << r6
|
54
|
-
end
|
55
|
-
if s4.last
|
56
|
-
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
57
|
-
r4.extend(SnipCall0)
|
58
|
-
else
|
59
|
-
@index = i4
|
60
|
-
r4 = nil
|
61
|
-
end
|
62
|
-
if r4
|
63
|
-
r3 = r4
|
64
|
-
else
|
65
|
-
r3 = instantiate_node(SyntaxNode,input, index...index)
|
66
|
-
end
|
67
|
-
s0 << r3
|
68
|
-
if r3
|
69
|
-
if has_terminal?("}", false, index)
|
70
|
-
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
71
|
-
@index += 1
|
72
|
-
else
|
73
|
-
terminal_parse_failure("}")
|
74
|
-
r7 = nil
|
75
|
-
end
|
76
|
-
s0 << r7
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
if s0.last
|
81
|
-
r0 = instantiate_node(SnipCall,input, i0...index, s0)
|
82
|
-
r0.extend(SnipCall1)
|
83
|
-
else
|
84
|
-
@index = i0
|
85
|
-
r0 = nil
|
86
|
-
end
|
87
|
-
|
88
|
-
node_cache[:snip_call][start_index] = r0
|
89
|
-
|
90
|
-
r0
|
91
|
-
end
|
92
|
-
|
93
|
-
module SnipName0
|
94
|
-
def word1
|
95
|
-
elements[0]
|
96
|
-
end
|
97
|
-
|
98
|
-
def word2
|
99
|
-
elements[2]
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def _nt_snip_name
|
104
|
-
start_index = index
|
105
|
-
if node_cache[:snip_name].has_key?(index)
|
106
|
-
cached = node_cache[:snip_name][index]
|
107
|
-
if cached
|
108
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
109
|
-
@index = cached.interval.end
|
110
|
-
end
|
111
|
-
return cached
|
112
|
-
end
|
113
|
-
|
114
|
-
i0 = index
|
115
|
-
i1, s1 = index, []
|
116
|
-
r2 = _nt_word
|
117
|
-
s1 << r2
|
118
|
-
if r2
|
119
|
-
if has_terminal?(".", false, index)
|
120
|
-
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
121
|
-
@index += 1
|
122
|
-
else
|
123
|
-
terminal_parse_failure(".")
|
124
|
-
r3 = nil
|
125
|
-
end
|
126
|
-
s1 << r3
|
127
|
-
if r3
|
128
|
-
r4 = _nt_word
|
129
|
-
s1 << r4
|
130
|
-
end
|
131
|
-
end
|
132
|
-
if s1.last
|
133
|
-
r1 = instantiate_node(SnipNameWithAttribute,input, i1...index, s1)
|
134
|
-
r1.extend(SnipName0)
|
135
|
-
else
|
136
|
-
@index = i1
|
137
|
-
r1 = nil
|
138
|
-
end
|
139
|
-
if r1
|
140
|
-
r0 = r1
|
141
|
-
else
|
142
|
-
r5 = _nt_word
|
143
|
-
r5.extend(SnipName)
|
144
|
-
if r5
|
145
|
-
r0 = r5
|
146
|
-
else
|
147
|
-
@index = i0
|
148
|
-
r0 = nil
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
node_cache[:snip_name][start_index] = r0
|
153
|
-
|
154
|
-
r0
|
155
|
-
end
|
156
|
-
|
157
|
-
module ArgumentList0
|
158
|
-
def argument_separator
|
159
|
-
elements[0]
|
160
|
-
end
|
161
|
-
|
162
|
-
def argument_list
|
163
|
-
elements[1]
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
module ArgumentList1
|
168
|
-
def argument
|
169
|
-
elements[0]
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
def _nt_argument_list
|
175
|
-
start_index = index
|
176
|
-
if node_cache[:argument_list].has_key?(index)
|
177
|
-
cached = node_cache[:argument_list][index]
|
178
|
-
if cached
|
179
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
180
|
-
@index = cached.interval.end
|
181
|
-
end
|
182
|
-
return cached
|
183
|
-
end
|
184
|
-
|
185
|
-
i0, s0 = index, []
|
186
|
-
r1 = _nt_argument
|
187
|
-
s0 << r1
|
188
|
-
if r1
|
189
|
-
i3, s3 = index, []
|
190
|
-
r4 = _nt_argument_separator
|
191
|
-
s3 << r4
|
192
|
-
if r4
|
193
|
-
r5 = _nt_argument_list
|
194
|
-
s3 << r5
|
195
|
-
end
|
196
|
-
if s3.last
|
197
|
-
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
198
|
-
r3.extend(ArgumentList0)
|
199
|
-
else
|
200
|
-
@index = i3
|
201
|
-
r3 = nil
|
202
|
-
end
|
203
|
-
if r3
|
204
|
-
r2 = r3
|
205
|
-
else
|
206
|
-
r2 = instantiate_node(SyntaxNode,input, index...index)
|
207
|
-
end
|
208
|
-
s0 << r2
|
209
|
-
end
|
210
|
-
if s0.last
|
211
|
-
r0 = instantiate_node(ArgumentList,input, i0...index, s0)
|
212
|
-
r0.extend(ArgumentList1)
|
213
|
-
else
|
214
|
-
@index = i0
|
215
|
-
r0 = nil
|
216
|
-
end
|
217
|
-
|
218
|
-
node_cache[:argument_list][start_index] = r0
|
219
|
-
|
220
|
-
r0
|
221
|
-
end
|
222
|
-
|
223
|
-
def _nt_argument
|
224
|
-
start_index = index
|
225
|
-
if node_cache[:argument].has_key?(index)
|
226
|
-
cached = node_cache[:argument][index]
|
227
|
-
if cached
|
228
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
229
|
-
@index = cached.interval.end
|
230
|
-
end
|
231
|
-
return cached
|
232
|
-
end
|
233
|
-
|
234
|
-
i0 = index
|
235
|
-
r1 = _nt_hash_argument
|
236
|
-
r1.extend(HashArgument)
|
237
|
-
if r1
|
238
|
-
r0 = r1
|
239
|
-
else
|
240
|
-
r2 = _nt_unquoted_words
|
241
|
-
r2.extend(NormalArgument)
|
242
|
-
if r2
|
243
|
-
r0 = r2
|
244
|
-
else
|
245
|
-
r3 = _nt_quoted_word
|
246
|
-
r3.extend(NormalArgument)
|
247
|
-
if r3
|
248
|
-
r0 = r3
|
249
|
-
else
|
250
|
-
r4 = _nt_empty_argument
|
251
|
-
r4.extend(EmptyArgument)
|
252
|
-
if r4
|
253
|
-
r0 = r4
|
254
|
-
else
|
255
|
-
@index = i0
|
256
|
-
r0 = nil
|
257
|
-
end
|
258
|
-
end
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
node_cache[:argument][start_index] = r0
|
263
|
-
|
264
|
-
r0
|
265
|
-
end
|
266
|
-
|
267
|
-
module ArgumentSeparator0
|
268
|
-
def optional_spaces
|
269
|
-
elements[1]
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
def _nt_argument_separator
|
274
|
-
start_index = index
|
275
|
-
if node_cache[:argument_separator].has_key?(index)
|
276
|
-
cached = node_cache[:argument_separator][index]
|
277
|
-
if cached
|
278
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
279
|
-
@index = cached.interval.end
|
280
|
-
end
|
281
|
-
return cached
|
282
|
-
end
|
283
|
-
|
284
|
-
i0, s0 = index, []
|
285
|
-
if has_terminal?(",", false, index)
|
286
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
287
|
-
@index += 1
|
288
|
-
else
|
289
|
-
terminal_parse_failure(",")
|
290
|
-
r1 = nil
|
291
|
-
end
|
292
|
-
s0 << r1
|
293
|
-
if r1
|
294
|
-
r2 = _nt_optional_spaces
|
295
|
-
s0 << r2
|
296
|
-
end
|
297
|
-
if s0.last
|
298
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
299
|
-
r0.extend(ArgumentSeparator0)
|
300
|
-
else
|
301
|
-
@index = i0
|
302
|
-
r0 = nil
|
303
|
-
end
|
304
|
-
|
305
|
-
node_cache[:argument_separator][start_index] = r0
|
306
|
-
|
307
|
-
r0
|
308
|
-
end
|
309
|
-
|
310
|
-
module HashArgument0
|
311
|
-
def word_or_symbol
|
312
|
-
elements[0]
|
313
|
-
end
|
314
|
-
|
315
|
-
def optional_spaces1
|
316
|
-
elements[1]
|
317
|
-
end
|
318
|
-
|
319
|
-
def hash_argument_separator
|
320
|
-
elements[2]
|
321
|
-
end
|
322
|
-
|
323
|
-
def optional_spaces2
|
324
|
-
elements[3]
|
325
|
-
end
|
326
|
-
|
327
|
-
def word
|
328
|
-
elements[4]
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
|
-
def _nt_hash_argument
|
333
|
-
start_index = index
|
334
|
-
if node_cache[:hash_argument].has_key?(index)
|
335
|
-
cached = node_cache[:hash_argument][index]
|
336
|
-
if cached
|
337
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
338
|
-
@index = cached.interval.end
|
339
|
-
end
|
340
|
-
return cached
|
341
|
-
end
|
342
|
-
|
343
|
-
i0, s0 = index, []
|
344
|
-
r1 = _nt_word_or_symbol
|
345
|
-
s0 << r1
|
346
|
-
if r1
|
347
|
-
r2 = _nt_optional_spaces
|
348
|
-
s0 << r2
|
349
|
-
if r2
|
350
|
-
r3 = _nt_hash_argument_separator
|
351
|
-
s0 << r3
|
352
|
-
if r3
|
353
|
-
r4 = _nt_optional_spaces
|
354
|
-
s0 << r4
|
355
|
-
if r4
|
356
|
-
r5 = _nt_word
|
357
|
-
s0 << r5
|
358
|
-
end
|
359
|
-
end
|
360
|
-
end
|
361
|
-
end
|
362
|
-
if s0.last
|
363
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
364
|
-
r0.extend(HashArgument0)
|
365
|
-
else
|
366
|
-
@index = i0
|
367
|
-
r0 = nil
|
368
|
-
end
|
369
|
-
|
370
|
-
node_cache[:hash_argument][start_index] = r0
|
371
|
-
|
372
|
-
r0
|
373
|
-
end
|
374
|
-
|
375
|
-
def _nt_hash_argument_separator
|
376
|
-
start_index = index
|
377
|
-
if node_cache[:hash_argument_separator].has_key?(index)
|
378
|
-
cached = node_cache[:hash_argument_separator][index]
|
379
|
-
if cached
|
380
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
381
|
-
@index = cached.interval.end
|
382
|
-
end
|
383
|
-
return cached
|
384
|
-
end
|
385
|
-
|
386
|
-
i0 = index
|
387
|
-
if has_terminal?("=>", false, index)
|
388
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
389
|
-
@index += 2
|
390
|
-
else
|
391
|
-
terminal_parse_failure("=>")
|
392
|
-
r1 = nil
|
393
|
-
end
|
394
|
-
if r1
|
395
|
-
r0 = r1
|
396
|
-
else
|
397
|
-
if has_terminal?(":", false, index)
|
398
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
399
|
-
@index += 1
|
400
|
-
else
|
401
|
-
terminal_parse_failure(":")
|
402
|
-
r2 = nil
|
403
|
-
end
|
404
|
-
if r2
|
405
|
-
r0 = r2
|
406
|
-
else
|
407
|
-
@index = i0
|
408
|
-
r0 = nil
|
409
|
-
end
|
410
|
-
end
|
411
|
-
|
412
|
-
node_cache[:hash_argument_separator][start_index] = r0
|
413
|
-
|
414
|
-
r0
|
415
|
-
end
|
416
|
-
|
417
|
-
def _nt_empty_argument
|
418
|
-
start_index = index
|
419
|
-
if node_cache[:empty_argument].has_key?(index)
|
420
|
-
cached = node_cache[:empty_argument][index]
|
421
|
-
if cached
|
422
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
423
|
-
@index = cached.interval.end
|
424
|
-
end
|
425
|
-
return cached
|
426
|
-
end
|
427
|
-
|
428
|
-
r0 = _nt_optional_spaces
|
429
|
-
|
430
|
-
node_cache[:empty_argument][start_index] = r0
|
431
|
-
|
432
|
-
r0
|
433
|
-
end
|
434
|
-
|
435
|
-
module WordOrSymbol0
|
436
|
-
def word
|
437
|
-
elements[1]
|
438
|
-
end
|
439
|
-
end
|
440
|
-
|
441
|
-
def _nt_word_or_symbol
|
442
|
-
start_index = index
|
443
|
-
if node_cache[:word_or_symbol].has_key?(index)
|
444
|
-
cached = node_cache[:word_or_symbol][index]
|
445
|
-
if cached
|
446
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
447
|
-
@index = cached.interval.end
|
448
|
-
end
|
449
|
-
return cached
|
450
|
-
end
|
451
|
-
|
452
|
-
i0, s0 = index, []
|
453
|
-
if has_terminal?('\G[:]', true, index)
|
454
|
-
r2 = true
|
455
|
-
@index += 1
|
456
|
-
else
|
457
|
-
r2 = nil
|
458
|
-
end
|
459
|
-
if r2
|
460
|
-
r1 = r2
|
461
|
-
else
|
462
|
-
r1 = instantiate_node(SyntaxNode,input, index...index)
|
463
|
-
end
|
464
|
-
s0 << r1
|
465
|
-
if r1
|
466
|
-
r3 = _nt_word
|
467
|
-
s0 << r3
|
468
|
-
end
|
469
|
-
if s0.last
|
470
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
471
|
-
r0.extend(WordOrSymbol0)
|
472
|
-
else
|
473
|
-
@index = i0
|
474
|
-
r0 = nil
|
475
|
-
end
|
476
|
-
|
477
|
-
node_cache[:word_or_symbol][start_index] = r0
|
478
|
-
|
479
|
-
r0
|
480
|
-
end
|
481
|
-
|
482
|
-
def _nt_word
|
483
|
-
start_index = index
|
484
|
-
if node_cache[:word].has_key?(index)
|
485
|
-
cached = node_cache[:word][index]
|
486
|
-
if cached
|
487
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
488
|
-
@index = cached.interval.end
|
489
|
-
end
|
490
|
-
return cached
|
491
|
-
end
|
492
|
-
|
493
|
-
i0 = index
|
494
|
-
r1 = _nt_unquoted_word
|
495
|
-
if r1
|
496
|
-
r0 = r1
|
497
|
-
else
|
498
|
-
r2 = _nt_quoted_word
|
499
|
-
if r2
|
500
|
-
r0 = r2
|
501
|
-
else
|
502
|
-
@index = i0
|
503
|
-
r0 = nil
|
504
|
-
end
|
505
|
-
end
|
506
|
-
|
507
|
-
node_cache[:word][start_index] = r0
|
508
|
-
|
509
|
-
r0
|
510
|
-
end
|
511
|
-
|
512
|
-
def _nt_unquoted_word
|
513
|
-
start_index = index
|
514
|
-
if node_cache[:unquoted_word].has_key?(index)
|
515
|
-
cached = node_cache[:unquoted_word][index]
|
516
|
-
if cached
|
517
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
518
|
-
@index = cached.interval.end
|
519
|
-
end
|
520
|
-
return cached
|
521
|
-
end
|
522
|
-
|
523
|
-
s0, i0 = [], index
|
524
|
-
loop do
|
525
|
-
if has_terminal?('\G[a-zA-Z0-9_\\-]', true, index)
|
526
|
-
r1 = true
|
527
|
-
@index += 1
|
528
|
-
else
|
529
|
-
r1 = nil
|
530
|
-
end
|
531
|
-
if r1
|
532
|
-
s0 << r1
|
533
|
-
else
|
534
|
-
break
|
535
|
-
end
|
536
|
-
end
|
537
|
-
if s0.empty?
|
538
|
-
@index = i0
|
539
|
-
r0 = nil
|
540
|
-
else
|
541
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
542
|
-
end
|
543
|
-
|
544
|
-
node_cache[:unquoted_word][start_index] = r0
|
545
|
-
|
546
|
-
r0
|
547
|
-
end
|
548
|
-
|
549
|
-
module QuotedWord0
|
550
|
-
end
|
551
|
-
|
552
|
-
module QuotedWord1
|
553
|
-
end
|
554
|
-
|
555
|
-
def _nt_quoted_word
|
556
|
-
start_index = index
|
557
|
-
if node_cache[:quoted_word].has_key?(index)
|
558
|
-
cached = node_cache[:quoted_word][index]
|
559
|
-
if cached
|
560
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
561
|
-
@index = cached.interval.end
|
562
|
-
end
|
563
|
-
return cached
|
564
|
-
end
|
565
|
-
|
566
|
-
i0 = index
|
567
|
-
i1, s1 = index, []
|
568
|
-
if has_terminal?("\"", false, index)
|
569
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
570
|
-
@index += 1
|
571
|
-
else
|
572
|
-
terminal_parse_failure("\"")
|
573
|
-
r2 = nil
|
574
|
-
end
|
575
|
-
s1 << r2
|
576
|
-
if r2
|
577
|
-
r3 = _nt_unquoted_words
|
578
|
-
s1 << r3
|
579
|
-
if r3
|
580
|
-
if has_terminal?("\"", false, index)
|
581
|
-
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
582
|
-
@index += 1
|
583
|
-
else
|
584
|
-
terminal_parse_failure("\"")
|
585
|
-
r4 = nil
|
586
|
-
end
|
587
|
-
s1 << r4
|
588
|
-
end
|
589
|
-
end
|
590
|
-
if s1.last
|
591
|
-
r1 = instantiate_node(QuotedWord,input, i1...index, s1)
|
592
|
-
r1.extend(QuotedWord0)
|
593
|
-
else
|
594
|
-
@index = i1
|
595
|
-
r1 = nil
|
596
|
-
end
|
597
|
-
if r1
|
598
|
-
r0 = r1
|
599
|
-
else
|
600
|
-
i5, s5 = index, []
|
601
|
-
if has_terminal?("'", false, index)
|
602
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
603
|
-
@index += 1
|
604
|
-
else
|
605
|
-
terminal_parse_failure("'")
|
606
|
-
r6 = nil
|
607
|
-
end
|
608
|
-
s5 << r6
|
609
|
-
if r6
|
610
|
-
r7 = _nt_unquoted_words
|
611
|
-
s5 << r7
|
612
|
-
if r7
|
613
|
-
if has_terminal?("'", false, index)
|
614
|
-
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
615
|
-
@index += 1
|
616
|
-
else
|
617
|
-
terminal_parse_failure("'")
|
618
|
-
r8 = nil
|
619
|
-
end
|
620
|
-
s5 << r8
|
621
|
-
end
|
622
|
-
end
|
623
|
-
if s5.last
|
624
|
-
r5 = instantiate_node(QuotedWord,input, i5...index, s5)
|
625
|
-
r5.extend(QuotedWord1)
|
626
|
-
else
|
627
|
-
@index = i5
|
628
|
-
r5 = nil
|
629
|
-
end
|
630
|
-
if r5
|
631
|
-
r0 = r5
|
632
|
-
else
|
633
|
-
@index = i0
|
634
|
-
r0 = nil
|
635
|
-
end
|
636
|
-
end
|
637
|
-
|
638
|
-
node_cache[:quoted_word][start_index] = r0
|
639
|
-
|
640
|
-
r0
|
641
|
-
end
|
642
|
-
|
643
|
-
def _nt_unquoted_words
|
644
|
-
start_index = index
|
645
|
-
if node_cache[:unquoted_words].has_key?(index)
|
646
|
-
cached = node_cache[:unquoted_words][index]
|
647
|
-
if cached
|
648
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
649
|
-
@index = cached.interval.end
|
650
|
-
end
|
651
|
-
return cached
|
652
|
-
end
|
653
|
-
|
654
|
-
s0, i0 = [], index
|
655
|
-
loop do
|
656
|
-
if has_terminal?('\G[a-zA-Z0-9_\\- ]', true, index)
|
657
|
-
r1 = true
|
658
|
-
@index += 1
|
659
|
-
else
|
660
|
-
r1 = nil
|
661
|
-
end
|
662
|
-
if r1
|
663
|
-
s0 << r1
|
664
|
-
else
|
665
|
-
break
|
666
|
-
end
|
667
|
-
end
|
668
|
-
if s0.empty?
|
669
|
-
@index = i0
|
670
|
-
r0 = nil
|
671
|
-
else
|
672
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
673
|
-
end
|
674
|
-
|
675
|
-
node_cache[:unquoted_words][start_index] = r0
|
676
|
-
|
677
|
-
r0
|
678
|
-
end
|
679
|
-
|
680
|
-
def _nt_optional_spaces
|
681
|
-
start_index = index
|
682
|
-
if node_cache[:optional_spaces].has_key?(index)
|
683
|
-
cached = node_cache[:optional_spaces][index]
|
684
|
-
if cached
|
685
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
686
|
-
@index = cached.interval.end
|
687
|
-
end
|
688
|
-
return cached
|
689
|
-
end
|
690
|
-
|
691
|
-
s0, i0 = [], index
|
692
|
-
loop do
|
693
|
-
if has_terminal?('\G[ ]', true, index)
|
694
|
-
r1 = true
|
695
|
-
@index += 1
|
696
|
-
else
|
697
|
-
r1 = nil
|
698
|
-
end
|
699
|
-
if r1
|
700
|
-
s0 << r1
|
701
|
-
else
|
702
|
-
break
|
703
|
-
end
|
704
|
-
end
|
705
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
706
|
-
|
707
|
-
node_cache[:optional_spaces][start_index] = r0
|
708
|
-
|
709
|
-
r0
|
710
|
-
end
|
711
|
-
|
712
|
-
def _nt_spaces
|
713
|
-
start_index = index
|
714
|
-
if node_cache[:spaces].has_key?(index)
|
715
|
-
cached = node_cache[:spaces][index]
|
716
|
-
if cached
|
717
|
-
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
718
|
-
@index = cached.interval.end
|
719
|
-
end
|
720
|
-
return cached
|
721
|
-
end
|
722
|
-
|
723
|
-
s0, i0 = [], index
|
724
|
-
loop do
|
725
|
-
if has_terminal?('\G[ ]', true, index)
|
726
|
-
r1 = true
|
727
|
-
@index += 1
|
728
|
-
else
|
729
|
-
r1 = nil
|
730
|
-
end
|
731
|
-
if r1
|
732
|
-
s0 << r1
|
733
|
-
else
|
734
|
-
break
|
735
|
-
end
|
736
|
-
end
|
737
|
-
if s0.empty?
|
738
|
-
@index = i0
|
739
|
-
r0 = nil
|
740
|
-
else
|
741
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
742
|
-
end
|
743
|
-
|
744
|
-
node_cache[:spaces][start_index] = r0
|
745
|
-
|
746
|
-
r0
|
747
|
-
end
|
748
|
-
|
749
|
-
end
|
750
|
-
|
751
|
-
class SnipReferenceParser < Treetop::Runtime::CompiledParser
|
752
|
-
include SnipReference
|
753
|
-
end
|
754
|
-
|