ebnf 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/ebnf +2 -2
- data/etc/sparql.ebnf +288 -0
- data/etc/sparql.html +1753 -0
- data/etc/sparql.ll1.sxp +7197 -0
- data/etc/sparql.rb +45633 -0
- data/etc/sparql.sxp +362 -0
- data/etc/turtle.html +519 -0
- data/lib/ebnf/ll1.rb +16 -11
- metadata +9 -3
data/lib/ebnf/ll1.rb
CHANGED
@@ -46,15 +46,18 @@ module EBNF
|
|
46
46
|
#
|
47
47
|
# @return [EBNF] self
|
48
48
|
# @see http://en.wikipedia.org/wiki/LL_parser#Constructing_an_LL.281.29_parsing_table
|
49
|
-
# @param [Symbol]
|
49
|
+
# @param [Array<Symbol>] starts
|
50
50
|
# Set of symbols which are start rules
|
51
|
-
def first_follow(
|
51
|
+
def first_follow(*starts)
|
52
52
|
# Add _eof to follow all start rules
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
@starts = starts
|
54
|
+
if @start = starts.first
|
55
|
+
starts.each do |start|
|
56
|
+
start_rule = find_rule(start)
|
57
|
+
raise "No rule found for start symbol #{start}" unless start_rule
|
58
|
+
start_rule.add_follow([:_eof])
|
59
|
+
start_rule.start = true
|
60
|
+
end
|
58
61
|
end
|
59
62
|
|
60
63
|
# Comprehnsion rule, create shorter versions of all non-terminal sequences. This is necessary as the FF rules reference w', which is a comprehension.
|
@@ -204,10 +207,12 @@ module EBNF
|
|
204
207
|
@branch = {}
|
205
208
|
@already = []
|
206
209
|
@agenda = []
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
210
|
+
@starts.each do |start|
|
211
|
+
do_production(start)
|
212
|
+
while !@agenda.empty?
|
213
|
+
x = @agenda.shift
|
214
|
+
do_production(x)
|
215
|
+
end
|
211
216
|
end
|
212
217
|
|
213
218
|
if !@errors.empty?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebnf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sxp
|
@@ -134,7 +134,13 @@ files:
|
|
134
134
|
- etc/ebnf.ll1.sxp
|
135
135
|
- etc/ebnf.rb
|
136
136
|
- etc/ebnf.sxp
|
137
|
+
- etc/sparql.ebnf
|
138
|
+
- etc/sparql.html
|
139
|
+
- etc/sparql.ll1.sxp
|
140
|
+
- etc/sparql.rb
|
141
|
+
- etc/sparql.sxp
|
137
142
|
- etc/turtle.ebnf
|
143
|
+
- etc/turtle.html
|
138
144
|
- etc/turtle.ll1.sxp
|
139
145
|
- etc/turtle.rb
|
140
146
|
- etc/turtle.sxp
|
@@ -169,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
175
|
version: '0'
|
170
176
|
requirements: []
|
171
177
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.4.
|
178
|
+
rubygems_version: 2.4.3
|
173
179
|
signing_key:
|
174
180
|
specification_version: 4
|
175
181
|
summary: EBNF parser and parser generator.
|