Skip to content

Commit 2a591ad

Browse files
committed
Keep single-quote and double-quote strings separate. (Depends on updated support in SXP).
1 parent f998d3d commit 2a591ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+929
-13134
lines changed

Rakefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,27 @@ desc "Build meta files for ABNF, EBNF and ISO EBNF"
6060
task :meta => %w{lib/ebnf/ebnf/meta.rb lib/ebnf/isoebnf/meta.rb lib/ebnf/abnf/meta.rb lib/ebnf/abnf/core.rb}
6161

6262
file "lib/ebnf/abnf/meta.rb" => "etc/abnf.ebnf" do
63-
%x(bin/ebnf --input-format native --peg -f rb --mod-name ABNFMeta -o lib/ebnf/abnf/meta.rb etc/abnf.ebnf)
63+
%x(bin/ebnf --peg -f rb --mod-name ABNFMeta -o lib/ebnf/abnf/meta.rb etc/abnf.ebnf)
6464
end
6565

6666
file "lib/ebnf/abnf/core.rb" => "etc/abnf-core.ebnf" do
67-
%x(bin/ebnf --input-format native -f rb --mod-name ABNFCore -o lib/ebnf/abnf/core.rb etc/abnf-core.ebnf)
67+
%x(bin/ebnf -f rb --mod-name ABNFCore -o lib/ebnf/abnf/core.rb etc/abnf-core.ebnf)
6868
end
6969

7070
file "lib/ebnf/ebnf/meta.rb" => "etc/ebnf.peg.rb" do
7171
%x(cp etc/ebnf.peg.rb lib/ebnf/ebnf/meta.rb)
7272
end
7373

7474
file "lib/ebnf/isoebnf/meta.rb" => "etc/iso-ebnf.ebnf" do
75-
%x(bin/ebnf --input-format native --peg -f rb --mod-name ISOEBNFMeta -o lib/ebnf/isoebnf/meta.rb etc/iso-ebnf.ebnf)
75+
%x(bin/ebnf --peg -f rb --mod-name ISOEBNFMeta -o lib/ebnf/isoebnf/meta.rb etc/iso-ebnf.ebnf)
7676
end
7777

7878

7979
# Build SXP output with leading space to allow for Markdown formatting.
8080
rule ".sxp" => %w{.ebnf} do |t|
8181
puts "build #{t.name}"
8282
File.open(t.name, "w") do |f|
83-
IO.popen(%(bin/ebnf --input-format native #{t.source})).each_line do |line|
83+
IO.popen(%(bin/ebnf #{t.source})).each_line do |line|
8484
f.puts ' ' + line
8585
end
8686
end
@@ -89,32 +89,32 @@ end
8989
rule ".peg.sxp" => %w{.ebnf} do |t|
9090
puts "build #{t.name}"
9191
File.open(t.name, "w") do |f|
92-
IO.popen(%(bin/ebnf --input-format native --peg #{t.source})).each_line do |line|
92+
IO.popen(%(bin/ebnf --peg #{t.source})).each_line do |line|
9393
f.puts ' ' + line
9494
end
9595
end
9696
end
9797

9898
rule ".html" => %w{.ebnf} do |t|
9999
puts "build #{t.name}"
100-
%x(bin/ebnf --input-format native --format html -o #{t.name} #{t.source})
100+
%x(bin/ebnf --format html -o #{t.name} #{t.source})
101101
end
102102

103103
file "etc/ebnf.ll1.sxp" => "etc/ebnf.ebnf" do |t|
104104
puts "build #{t.name}"
105105
File.open(t.name, "w") do |f|
106-
IO.popen(%(bin/ebnf --input-format native --ll1 ebnf #{t.source})).each_line do |line|
106+
IO.popen(%(bin/ebnf --ll1 ebnf #{t.source})).each_line do |line|
107107
f.puts ' ' + line
108108
end
109109
end
110110
end
111111

112112
file "etc/ebnf.peg.rb" => "etc/ebnf.ebnf" do |t|
113113
puts "build #{t.name}"
114-
%x(bin/ebnf --input-format native --peg --mod-name EBNFMeta -f rb -o etc/ebnf.peg.rb etc/ebnf.ebnf)
114+
%x(bin/ebnf --peg --mod-name EBNFMeta -f rb -o etc/ebnf.peg.rb etc/ebnf.ebnf)
115115
end
116116

117117
file "etc/ebnf.ll1.rb" => "etc/ebnf.ebnf" do |t|
118118
puts "build #{t.name}"
119-
%x(bin/ebnf --input-format native --ll1 ebnf -f rb -o etc/ebnf.ll1.rb etc/ebnf.ebnf)
119+
%x(bin/ebnf --ll1 ebnf -f rb -o etc/ebnf.ll1.rb etc/ebnf.ebnf)
120120
end

etc/abnf.sxp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
(seq "x" (plus HEXDIG) (opt (alt (plus (seq "." (plus HEXDIG))) (seq "-" (plus HEXDIG))))))
2929
(terminal prose_val (seq "<" (star (range "#x20-#x3D#x3F-#x7E")) ">"))
3030
(terminal ALPHA (range "#x41-#x5A#x61-#x7A"))
31-
(terminal BIT (alt "0" "1"))
31+
(terminal BIT (alt '0' '1'))
3232
(terminal CHAR (range "#x01-#x7F"))
3333
(terminal CR (hex "#x0D"))
3434
(terminal CRLF (seq (opt CR) LF))

etc/ebnf.html

Lines changed: 13 additions & 13 deletions
Large diffs are not rendered by default.

etc/ebnf.ll1.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is automatically generated by ebnf version 2.3.4
1+
# This file is automatically generated by ebnf version 2.4.0
22
# Derived from etc/ebnf.ebnf
33
module Meta
44
START = :ebnf

etc/ebnf.ll1.sxp

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -2,181 +2,181 @@
22
(rule _empty "0" (first _eps) (seq))
33
(rule ebnf "1"
44
(start #t)
5-
(first "@pass" "@terminals" LHS _eps)
5+
(first '@pass' '@terminals' LHS _eps)
66
(follow _eof)
77
(cleanup star)
88
(alt _empty _ebnf_2))
99
(rule _ebnf_2 "1.2"
10-
(first "@pass" "@terminals" LHS)
10+
(first '@pass' '@terminals' LHS)
1111
(follow _eof)
1212
(cleanup merge)
1313
(seq _ebnf_1 ebnf))
1414
(rule _ebnf_1 "1.1"
15-
(first "@pass" "@terminals" LHS)
16-
(follow "@pass" "@terminals" LHS _eof)
15+
(first '@pass' '@terminals' LHS)
16+
(follow '@pass' '@terminals' LHS _eof)
1717
(alt declaration rule))
1818
(rule declaration "2"
19-
(first "@pass" "@terminals")
20-
(follow "@pass" "@terminals" LHS _eof)
21-
(alt "@terminals" pass))
22-
(rule rule "3" (first LHS) (follow "@pass" "@terminals" LHS _eof) (seq LHS expression))
19+
(first '@pass' '@terminals')
20+
(follow '@pass' '@terminals' LHS _eof)
21+
(alt '@terminals' pass))
22+
(rule rule "3" (first LHS) (follow '@pass' '@terminals' LHS _eof) (seq LHS expression))
2323
(rule expression "4"
24-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
25-
(follow ")" "@pass" "@terminals" LHS _eof)
24+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
25+
(follow ')' '@pass' '@terminals' LHS _eof)
2626
(seq alt))
2727
(rule alt "5"
28-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
29-
(follow ")" "@pass" "@terminals" LHS _eof)
28+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
29+
(follow ')' '@pass' '@terminals' LHS _eof)
3030
(seq seq _alt_1))
3131
(rule _alt_1 "5.1"
32-
(first _eps "|")
33-
(follow ")" "@pass" "@terminals" LHS _eof)
32+
(first _eps '|')
33+
(follow ')' '@pass' '@terminals' LHS _eof)
3434
(cleanup star)
3535
(alt _empty _alt_3))
3636
(rule _alt_3 "5.3"
37-
(first "|")
38-
(follow ")" "@pass" "@terminals" LHS _eof)
37+
(first '|')
38+
(follow ')' '@pass' '@terminals' LHS _eof)
3939
(cleanup merge)
4040
(seq _alt_2 _alt_1))
4141
(rule _alt_2 "5.2"
42-
(first "|")
43-
(follow ")" "@pass" "@terminals" LHS _eof "|")
44-
(seq "|" seq))
42+
(first '|')
43+
(follow ')' '@pass' '@terminals' LHS _eof '|')
44+
(seq '|' seq))
4545
(rule seq "6"
46-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
47-
(follow ")" "@pass" "@terminals" LHS _eof "|")
46+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
47+
(follow ')' '@pass' '@terminals' LHS _eof '|')
4848
(cleanup plus)
4949
(seq diff _seq_1))
5050
(rule _seq_1 "6.1"
51-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL _eps)
52-
(follow ")" "@pass" "@terminals" LHS _eof "|")
51+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL _eps)
52+
(follow ')' '@pass' '@terminals' LHS _eof '|')
5353
(cleanup star)
5454
(alt _empty _seq_2))
5555
(rule _seq_2 "6.2"
56-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
57-
(follow ")" "@pass" "@terminals" LHS _eof "|")
56+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
57+
(follow ')' '@pass' '@terminals' LHS _eof '|')
5858
(cleanup merge)
5959
(seq diff _seq_1))
6060
(rule diff "7"
61-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
62-
(follow "(" ")" "@pass" "@terminals" HEX LHS O_RANGE RANGE STRING1 STRING2
63-
SYMBOL _eof "|" )
61+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
62+
(follow '(' ')' '@pass' '@terminals' HEX LHS O_RANGE RANGE STRING1 STRING2
63+
SYMBOL _eof '|' )
6464
(seq postfix _diff_1))
6565
(rule _diff_1 "7.1"
66-
(first "-" _eps)
67-
(follow "(" ")" "@pass" "@terminals" HEX LHS O_RANGE RANGE STRING1 STRING2
68-
SYMBOL _eof "|" )
66+
(first '-' _eps)
67+
(follow '(' ')' '@pass' '@terminals' HEX LHS O_RANGE RANGE STRING1 STRING2
68+
SYMBOL _eof '|' )
6969
(cleanup opt)
7070
(alt _empty _diff_2))
7171
(rule _diff_2 "7.2"
72-
(first "-")
73-
(follow "(" ")" "@pass" "@terminals" HEX LHS O_RANGE RANGE STRING1 STRING2
74-
SYMBOL _eof "|" )
75-
(seq "-" postfix))
72+
(first '-')
73+
(follow '(' ')' '@pass' '@terminals' HEX LHS O_RANGE RANGE STRING1 STRING2
74+
SYMBOL _eof '|' )
75+
(seq '-' postfix))
7676
(rule postfix "8"
77-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
78-
(follow "(" ")" "-" "@pass" "@terminals" HEX LHS O_RANGE RANGE STRING1
79-
STRING2 SYMBOL _eof "|" )
77+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
78+
(follow '(' ')' '-' '@pass' '@terminals' HEX LHS O_RANGE RANGE STRING1
79+
STRING2 SYMBOL _eof '|' )
8080
(seq primary _postfix_1))
8181
(rule _postfix_1 "8.1"
8282
(first POSTFIX _eps)
83-
(follow "(" ")" "-" "@pass" "@terminals" HEX LHS O_RANGE RANGE STRING1
84-
STRING2 SYMBOL _eof "|" )
83+
(follow '(' ')' '-' '@pass' '@terminals' HEX LHS O_RANGE RANGE STRING1
84+
STRING2 SYMBOL _eof '|' )
8585
(cleanup opt)
8686
(alt _empty POSTFIX))
8787
(rule primary "9"
88-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
89-
(follow "(" ")" "-" "@pass" "@terminals" HEX LHS O_RANGE POSTFIX RANGE
90-
STRING1 STRING2 SYMBOL _eof "|" )
88+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
89+
(follow '(' ')' '-' '@pass' '@terminals' HEX LHS O_RANGE POSTFIX RANGE
90+
STRING1 STRING2 SYMBOL _eof '|' )
9191
(alt HEX SYMBOL O_RANGE RANGE STRING1 STRING2 _primary_1))
9292
(rule _primary_1 "9.1"
93-
(first "(")
94-
(follow "(" ")" "-" "@pass" "@terminals" HEX LHS O_RANGE POSTFIX RANGE
95-
STRING1 STRING2 SYMBOL _eof "|" )
96-
(seq "(" expression ")"))
93+
(first '(')
94+
(follow '(' ')' '-' '@pass' '@terminals' HEX LHS O_RANGE POSTFIX RANGE
95+
STRING1 STRING2 SYMBOL _eof '|' )
96+
(seq '(' expression ')'))
9797
(rule pass "10"
98-
(first "@pass")
99-
(follow "@pass" "@terminals" LHS _eof)
100-
(seq "@pass" expression))
98+
(first '@pass')
99+
(follow '@pass' '@terminals' LHS _eof)
100+
(seq '@pass' expression))
101101
(terminals _terminals (seq))
102-
(terminal LHS "11" (seq (opt (seq "[" SYMBOL "]" (plus " "))) SYMBOL (star " ") "::="))
103-
(terminal SYMBOL "12" (plus (alt (range "a-z") (range "A-Z") (range "0-9") "_" ".")))
104-
(terminal HEX "13" (seq "#x" (plus (alt (range "a-f") (range "A-F") (range "0-9")))))
102+
(terminal LHS "11" (seq (opt (seq '[' SYMBOL ']' (plus ' '))) SYMBOL (star ' ') '::='))
103+
(terminal SYMBOL "12" (plus (alt (range "a-z") (range "A-Z") (range "0-9") '_' '.')))
104+
(terminal HEX "13" (seq '#x' (plus (alt (range "a-f") (range "A-F") (range "0-9")))))
105105
(terminal RANGE "14"
106-
(seq "["
107-
(plus (alt (seq R_CHAR "-" R_CHAR) (seq HEX "-" HEX) R_CHAR HEX))
108-
(opt "-")
109-
(diff "]" LHS)) )
106+
(seq '['
107+
(plus (alt (seq R_CHAR '-' R_CHAR) (seq HEX '-' HEX) R_CHAR HEX))
108+
(opt '-')
109+
(diff ']' LHS)) )
110110
(terminal O_RANGE "15"
111-
(seq "[^" (plus (alt (seq R_CHAR "-" R_CHAR) (seq HEX "-" HEX) R_CHAR HEX)) (opt "-") "]"))
112-
(terminal STRING1 "16" (seq "\"" (star (diff CHAR "\"")) "\""))
111+
(seq '[^' (plus (alt (seq R_CHAR '-' R_CHAR) (seq HEX '-' HEX) R_CHAR HEX)) (opt '-') ']'))
112+
(terminal STRING1 "16" (seq '"' (star (diff CHAR '"')) '"'))
113113
(terminal STRING2 "17" (seq "'" (star (diff CHAR "'")) "'"))
114114
(terminal CHAR "18"
115115
(alt
116116
(range "#x9#xA#xD")
117117
(range "#x20-#xD7FF")
118118
(range "#xE000-#xFFFD")
119119
(range "#x10000-#x10FFFF")) )
120-
(terminal R_CHAR "19" (diff CHAR (alt "]" "-" HEX)))
120+
(terminal R_CHAR "19" (diff CHAR (alt ']' '-' HEX)))
121121
(terminal POSTFIX "20" (range "?*+"))
122122
(terminal PASS "21"
123123
(alt
124124
(range "#x9#xA#xD#x20")
125-
(seq (alt (diff "#" "#x") "//") (star (range "^#xA#xD")))
126-
(seq "/*" (star (alt (opt (seq "*" (range "^/"))) (range "^*"))) "*/")
127-
(seq "(*" (star (alt (opt (seq "*" (range "^)"))) (range "^*"))) "*)")) )
125+
(seq (alt (diff '#' '#x') '//') (star (range "^#xA#xD")))
126+
(seq '/*' (star (alt (opt (seq '*' (range "^/"))) (range "^*"))) '*/')
127+
(seq '(*' (star (alt (opt (seq '*' (range "^)"))) (range "^*"))) '*)')) )
128128
(pass _pass (seq PASS))
129-
(rule _ebnf_3 "1.3" (first "@pass" "@terminals" LHS _eps) (follow _eof) (seq ebnf))
129+
(rule _ebnf_3 "1.3" (first '@pass' '@terminals' LHS _eps) (follow _eof) (seq ebnf))
130130
(rule _rule_1 "3.1"
131-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
132-
(follow "@pass" "@terminals" LHS _eof)
131+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
132+
(follow '@pass' '@terminals' LHS _eof)
133133
(seq expression))
134134
(rule _alt_4 "5.4"
135-
(first _eps "|")
136-
(follow ")" "@pass" "@terminals" LHS _eof)
135+
(first _eps '|')
136+
(follow ')' '@pass' '@terminals' LHS _eof)
137137
(seq _alt_1))
138138
(rule _alt_5 "5.5"
139-
(first _eps "|")
140-
(follow ")" "@pass" "@terminals" LHS _eof)
139+
(first _eps '|')
140+
(follow ')' '@pass' '@terminals' LHS _eof)
141141
(seq _alt_1))
142142
(rule _alt_6 "5.6"
143-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
144-
(follow ")" "@pass" "@terminals" LHS _eof "|")
143+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
144+
(follow ')' '@pass' '@terminals' LHS _eof '|')
145145
(seq seq))
146146
(rule _seq_3 "6.3"
147-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL _eps)
148-
(follow ")" "@pass" "@terminals" LHS _eof "|")
147+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL _eps)
148+
(follow ')' '@pass' '@terminals' LHS _eof '|')
149149
(seq _seq_1))
150150
(rule _seq_4 "6.4"
151-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL _eps)
152-
(follow ")" "@pass" "@terminals" LHS _eof "|")
151+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL _eps)
152+
(follow ')' '@pass' '@terminals' LHS _eof '|')
153153
(seq _seq_1))
154154
(rule _diff_3 "7.3"
155-
(first "-" _eps)
156-
(follow "(" ")" "@pass" "@terminals" HEX LHS O_RANGE RANGE STRING1 STRING2
157-
SYMBOL _eof "|" )
155+
(first '-' _eps)
156+
(follow '(' ')' '@pass' '@terminals' HEX LHS O_RANGE RANGE STRING1 STRING2
157+
SYMBOL _eof '|' )
158158
(seq _diff_1))
159159
(rule _diff_4 "7.4"
160-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
161-
(follow "(" ")" "@pass" "@terminals" HEX LHS O_RANGE RANGE STRING1 STRING2
162-
SYMBOL _eof "|" )
160+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
161+
(follow '(' ')' '@pass' '@terminals' HEX LHS O_RANGE RANGE STRING1 STRING2
162+
SYMBOL _eof '|' )
163163
(seq postfix))
164164
(rule _postfix_2 "8.2"
165165
(first POSTFIX _eps)
166-
(follow "(" ")" "-" "@pass" "@terminals" HEX LHS O_RANGE RANGE STRING1
167-
STRING2 SYMBOL _eof "|" )
166+
(follow '(' ')' '-' '@pass' '@terminals' HEX LHS O_RANGE RANGE STRING1
167+
STRING2 SYMBOL _eof '|' )
168168
(seq _postfix_1))
169169
(rule _primary_2 "9.2"
170-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
171-
(follow "(" ")" "-" "@pass" "@terminals" HEX LHS O_RANGE POSTFIX RANGE
172-
STRING1 STRING2 SYMBOL _eof "|" )
173-
(seq expression ")"))
170+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
171+
(follow '(' ')' '-' '@pass' '@terminals' HEX LHS O_RANGE POSTFIX RANGE
172+
STRING1 STRING2 SYMBOL _eof '|' )
173+
(seq expression ')'))
174174
(rule _pass_1 "10.1"
175-
(first "(" HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
176-
(follow "@pass" "@terminals" LHS _eof)
175+
(first '(' HEX O_RANGE RANGE STRING1 STRING2 SYMBOL)
176+
(follow '@pass' '@terminals' LHS _eof)
177177
(seq expression))
178178
(rule _primary_3 "9.3"
179-
(first ")")
180-
(follow "(" ")" "-" "@pass" "@terminals" HEX LHS O_RANGE POSTFIX RANGE
181-
STRING1 STRING2 SYMBOL _eof "|" )
182-
(seq ")")) )
179+
(first ')')
180+
(follow '(' ')' '-' '@pass' '@terminals' HEX LHS O_RANGE POSTFIX RANGE
181+
STRING1 STRING2 SYMBOL _eof '|' )
182+
(seq ')')) )

etc/ebnf.peg.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is automatically generated by ebnf version 2.3.4
1+
# This file is automatically generated by ebnf version 2.4.0
22
# Derived from etc/ebnf.ebnf
33
module EBNFMeta
44
RULES = [

0 commit comments

Comments
 (0)