ebnf 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  # This file is automatically generated by ebnf version 2.0.0
2
2
  # Derived from etc/ebnf.ebnf
3
- module Meta
3
+ module EBNFMeta
4
4
  RULES = [
5
5
  EBNF::Rule.new(:ebnf, "1", [:star, :_ebnf_1]).extend(EBNF::PEG::Rule),
6
6
  EBNF::Rule.new(:_ebnf_1, "1.1", [:alt, :declaration, :rule]).extend(EBNF::PEG::Rule),
@@ -16,14 +16,14 @@ module Meta
16
16
  EBNF::Rule.new(:_diff_2, "7.2", [:seq, "-", :postfix]).extend(EBNF::PEG::Rule),
17
17
  EBNF::Rule.new(:postfix, "8", [:seq, :primary, :_postfix_1]).extend(EBNF::PEG::Rule),
18
18
  EBNF::Rule.new(:_postfix_1, "8.1", [:opt, :POSTFIX]).extend(EBNF::PEG::Rule),
19
- EBNF::Rule.new(:primary, "9", [:alt, :HEX, :SYMBOL, :ENUM, :O_ENUM, :RANGE, :O_RANGE, :STRING1, :STRING2, :_primary_1]).extend(EBNF::PEG::Rule),
19
+ EBNF::Rule.new(:primary, "9", [:alt, :HEX, :SYMBOL, :O_RANGE, :RANGE, :STRING1, :STRING2, :_primary_1]).extend(EBNF::PEG::Rule),
20
20
  EBNF::Rule.new(:_primary_1, "9.1", [:seq, "(", :expression, ")"]).extend(EBNF::PEG::Rule),
21
21
  EBNF::Rule.new(:pass, "10", [:seq, "@pass", :expression]).extend(EBNF::PEG::Rule),
22
+ EBNF::Rule.new(:_terminals, nil, [:seq], kind: :terminals).extend(EBNF::PEG::Rule),
22
23
  EBNF::Rule.new(:LHS, "11", [:seq, :_LHS_1, :SYMBOL, :_LHS_2, "::="], kind: :terminal).extend(EBNF::PEG::Rule),
23
24
  EBNF::Rule.new(:_LHS_1, "11.1", [:opt, :_LHS_3], kind: :terminal).extend(EBNF::PEG::Rule),
24
- EBNF::Rule.new(:_LHS_3, "11.3", [:seq, "[", :_LHS_4, "]", :_LHS_5], kind: :terminal).extend(EBNF::PEG::Rule),
25
- EBNF::Rule.new(:_LHS_4, "11.4", [:plus, :SYMBOL], kind: :terminal).extend(EBNF::PEG::Rule),
26
- EBNF::Rule.new(:_LHS_5, "11.5", [:plus, " "], kind: :terminal).extend(EBNF::PEG::Rule),
25
+ EBNF::Rule.new(:_LHS_3, "11.3", [:seq, "[", :SYMBOL, "]", :_LHS_4], kind: :terminal).extend(EBNF::PEG::Rule),
26
+ EBNF::Rule.new(:_LHS_4, "11.4", [:plus, " "], kind: :terminal).extend(EBNF::PEG::Rule),
27
27
  EBNF::Rule.new(:_LHS_2, "11.2", [:star, " "], kind: :terminal).extend(EBNF::PEG::Rule),
28
28
  EBNF::Rule.new(:SYMBOL, "12", [:plus, :_SYMBOL_1], kind: :terminal).extend(EBNF::PEG::Rule),
29
29
  EBNF::Rule.new(:_SYMBOL_1, "12.1", [:alt, :_SYMBOL_2, :_SYMBOL_3, :_SYMBOL_4, "_", "."], kind: :terminal).extend(EBNF::PEG::Rule),
@@ -36,63 +36,55 @@ module Meta
36
36
  EBNF::Rule.new(:_HEX_3, "13.3", [:range, "a-f"], kind: :terminal).extend(EBNF::PEG::Rule),
37
37
  EBNF::Rule.new(:_HEX_4, "13.4", [:range, "A-F"], kind: :terminal).extend(EBNF::PEG::Rule),
38
38
  EBNF::Rule.new(:_HEX_5, "13.5", [:range, "0-9"], kind: :terminal).extend(EBNF::PEG::Rule),
39
- EBNF::Rule.new(:ENUM, "14", [:diff, :_ENUM_1, :LHS], kind: :terminal).extend(EBNF::PEG::Rule),
40
- EBNF::Rule.new(:_ENUM_1, "14.1", [:alt, :_ENUM_2, :_ENUM_3], kind: :terminal).extend(EBNF::PEG::Rule),
41
- EBNF::Rule.new(:_ENUM_2, "14.2", [:seq, "[", :_ENUM_4], kind: :terminal).extend(EBNF::PEG::Rule),
42
- EBNF::Rule.new(:_ENUM_4, "14.4", [:plus, :R_CHAR], kind: :terminal).extend(EBNF::PEG::Rule),
43
- EBNF::Rule.new(:_ENUM_3, "14.3", [:seq, :_ENUM_5, "]"], kind: :terminal).extend(EBNF::PEG::Rule),
44
- EBNF::Rule.new(:_ENUM_5, "14.5", [:plus, :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
45
- EBNF::Rule.new(:O_ENUM, "15", [:alt, :_O_ENUM_1, :_O_ENUM_2], kind: :terminal).extend(EBNF::PEG::Rule),
46
- EBNF::Rule.new(:_O_ENUM_1, "15.1", [:seq, "[^", :_O_ENUM_3], kind: :terminal).extend(EBNF::PEG::Rule),
47
- EBNF::Rule.new(:_O_ENUM_3, "15.3", [:plus, :R_CHAR], kind: :terminal).extend(EBNF::PEG::Rule),
48
- EBNF::Rule.new(:_O_ENUM_2, "15.2", [:seq, :_O_ENUM_4, "]"], kind: :terminal).extend(EBNF::PEG::Rule),
49
- EBNF::Rule.new(:_O_ENUM_4, "15.4", [:plus, :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
50
- EBNF::Rule.new(:RANGE, "16", [:alt, :_RANGE_1, :_RANGE_2], kind: :terminal).extend(EBNF::PEG::Rule),
51
- EBNF::Rule.new(:_RANGE_1, "16.1", [:seq, "[", :_RANGE_3], kind: :terminal).extend(EBNF::PEG::Rule),
52
- EBNF::Rule.new(:_RANGE_3, "16.3", [:seq, :R_CHAR, "-", :R_CHAR], kind: :terminal).extend(EBNF::PEG::Rule),
53
- EBNF::Rule.new(:_RANGE_2, "16.2", [:seq, :_RANGE_4, "]"], kind: :terminal).extend(EBNF::PEG::Rule),
54
- EBNF::Rule.new(:_RANGE_4, "16.4", [:diff, :HEX, :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
55
- EBNF::Rule.new(:O_RANGE, "17", [:alt, :_O_RANGE_1, :_O_RANGE_2], kind: :terminal).extend(EBNF::PEG::Rule),
56
- EBNF::Rule.new(:_O_RANGE_1, "17.1", [:seq, "[^", :_O_RANGE_3], kind: :terminal).extend(EBNF::PEG::Rule),
57
- EBNF::Rule.new(:_O_RANGE_3, "17.3", [:seq, :R_CHAR, "-", :R_CHAR], kind: :terminal).extend(EBNF::PEG::Rule),
58
- EBNF::Rule.new(:_O_RANGE_2, "17.2", [:seq, :_O_RANGE_4, "]"], kind: :terminal).extend(EBNF::PEG::Rule),
59
- EBNF::Rule.new(:_O_RANGE_4, "17.4", [:diff, :HEX, :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
60
- EBNF::Rule.new(:STRING1, "18", [:seq, "\"", :_STRING1_1, "\""], kind: :terminal).extend(EBNF::PEG::Rule),
61
- EBNF::Rule.new(:_STRING1_1, "18.1", [:star, :_STRING1_2], kind: :terminal).extend(EBNF::PEG::Rule),
62
- EBNF::Rule.new(:_STRING1_2, "18.2", [:diff, :CHAR, "\""], kind: :terminal).extend(EBNF::PEG::Rule),
63
- EBNF::Rule.new(:STRING2, "19", [:seq, "'", :_STRING2_1, "'"], kind: :terminal).extend(EBNF::PEG::Rule),
64
- EBNF::Rule.new(:_STRING2_1, "19.1", [:star, :_STRING2_2], kind: :terminal).extend(EBNF::PEG::Rule),
65
- EBNF::Rule.new(:_STRING2_2, "19.2", [:diff, :CHAR, "'"], kind: :terminal).extend(EBNF::PEG::Rule),
66
- EBNF::Rule.new(:CHAR, "20", [:alt, :_CHAR_1, :_CHAR_2, :_CHAR_3, :_CHAR_4], kind: :terminal).extend(EBNF::PEG::Rule),
67
- EBNF::Rule.new(:_CHAR_1, "20.1", [:range, "#x9#xA#xD"], kind: :terminal).extend(EBNF::PEG::Rule),
68
- EBNF::Rule.new(:_CHAR_2, "20.2", [:range, "#x20-#xD7FF"], kind: :terminal).extend(EBNF::PEG::Rule),
69
- EBNF::Rule.new(:_CHAR_3, "20.3", [:range, "#xE000-#xFFFD"], kind: :terminal).extend(EBNF::PEG::Rule),
70
- EBNF::Rule.new(:_CHAR_4, "20.4", [:range, "#x10000-#x10FFFF"], kind: :terminal).extend(EBNF::PEG::Rule),
71
- EBNF::Rule.new(:R_CHAR, "21", [:diff, :CHAR, "]"], kind: :terminal).extend(EBNF::PEG::Rule),
72
- EBNF::Rule.new(:POSTFIX, "22", [:range, "?*+"], kind: :terminal).extend(EBNF::PEG::Rule),
73
- EBNF::Rule.new(:PASS, "23", [:plus, :_PASS_1], kind: :terminal).extend(EBNF::PEG::Rule),
74
- EBNF::Rule.new(:_PASS_1, "23.1", [:alt, :_PASS_2, :_PASS_3, :_PASS_4, :_PASS_5], kind: :terminal).extend(EBNF::PEG::Rule),
75
- EBNF::Rule.new(:_PASS_2, "23.2", [:range, "#x00-#x20"], kind: :terminal).extend(EBNF::PEG::Rule),
76
- EBNF::Rule.new(:_PASS_3, "23.3", [:seq, :_PASS_6, :_PASS_7], kind: :terminal).extend(EBNF::PEG::Rule),
77
- EBNF::Rule.new(:_PASS_6, "23.6", [:alt, :_PASS_8, "//"], kind: :terminal).extend(EBNF::PEG::Rule),
78
- EBNF::Rule.new(:_PASS_8, "23.8", [:diff, "#", "#x"], kind: :terminal).extend(EBNF::PEG::Rule),
79
- EBNF::Rule.new(:_PASS_7, "23.7", [:star, :_PASS_9], kind: :terminal).extend(EBNF::PEG::Rule),
80
- EBNF::Rule.new(:_PASS_9, "23.9", [:range, "^#x0A#x0Dx"], kind: :terminal).extend(EBNF::PEG::Rule),
81
- EBNF::Rule.new(:_PASS_4, "23.4", [:seq, "/*", :_PASS_10, "*/"], kind: :terminal).extend(EBNF::PEG::Rule),
82
- EBNF::Rule.new(:_PASS_10, "23.10", [:star, :_PASS_11], kind: :terminal).extend(EBNF::PEG::Rule),
83
- EBNF::Rule.new(:_PASS_11, "23.11", [:alt, :_PASS_12, :_PASS_13], kind: :terminal).extend(EBNF::PEG::Rule),
84
- EBNF::Rule.new(:_PASS_12, "23.12", [:opt, :_PASS_14], kind: :terminal).extend(EBNF::PEG::Rule),
85
- EBNF::Rule.new(:_PASS_14, "23.14", [:seq, "*", :_PASS_15], kind: :terminal).extend(EBNF::PEG::Rule),
86
- EBNF::Rule.new(:_PASS_15, "23.15", [:range, "^/"], kind: :terminal).extend(EBNF::PEG::Rule),
87
- EBNF::Rule.new(:_PASS_13, "23.13", [:range, "^*"], kind: :terminal).extend(EBNF::PEG::Rule),
88
- EBNF::Rule.new(:_PASS_5, "23.5", [:seq, "(*", :_PASS_16, "*)"], kind: :terminal).extend(EBNF::PEG::Rule),
89
- EBNF::Rule.new(:_PASS_16, "23.16", [:star, :_PASS_17], kind: :terminal).extend(EBNF::PEG::Rule),
90
- EBNF::Rule.new(:_PASS_17, "23.17", [:alt, :_PASS_18, :_PASS_19], kind: :terminal).extend(EBNF::PEG::Rule),
91
- EBNF::Rule.new(:_PASS_18, "23.18", [:opt, :_PASS_20], kind: :terminal).extend(EBNF::PEG::Rule),
92
- EBNF::Rule.new(:_PASS_20, "23.20", [:seq, "*", :_PASS_21], kind: :terminal).extend(EBNF::PEG::Rule),
93
- EBNF::Rule.new(:_PASS_21, "23.21", [:range, "^)"], kind: :terminal).extend(EBNF::PEG::Rule),
94
- EBNF::Rule.new(:_PASS_19, "23.19", [:range, "^*"], kind: :terminal).extend(EBNF::PEG::Rule),
95
- EBNF::Rule.new(nil, nil, [:seq, :PASS], kind: :pass).extend(EBNF::PEG::Rule),
39
+ EBNF::Rule.new(:RANGE, "14", [:seq, "[", :_RANGE_1, :_RANGE_2, :_RANGE_3], kind: :terminal).extend(EBNF::PEG::Rule),
40
+ EBNF::Rule.new(:_RANGE_1, "14.1", [:plus, :_RANGE_4], kind: :terminal).extend(EBNF::PEG::Rule),
41
+ EBNF::Rule.new(:_RANGE_4, "14.4", [:alt, :_RANGE_5, :_RANGE_6, :R_CHAR, :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
42
+ EBNF::Rule.new(:_RANGE_5, "14.5", [:seq, :R_CHAR, "-", :R_CHAR], kind: :terminal).extend(EBNF::PEG::Rule),
43
+ EBNF::Rule.new(:_RANGE_6, "14.6", [:seq, :HEX, "-", :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
44
+ EBNF::Rule.new(:_RANGE_2, "14.2", [:opt, "-"], kind: :terminal).extend(EBNF::PEG::Rule),
45
+ EBNF::Rule.new(:_RANGE_3, "14.3", [:diff, "]", :LHS], kind: :terminal).extend(EBNF::PEG::Rule),
46
+ EBNF::Rule.new(:O_RANGE, "15", [:seq, "[^", :_O_RANGE_1, :_O_RANGE_2, "]"], kind: :terminal).extend(EBNF::PEG::Rule),
47
+ EBNF::Rule.new(:_O_RANGE_1, "15.1", [:plus, :_O_RANGE_3], kind: :terminal).extend(EBNF::PEG::Rule),
48
+ EBNF::Rule.new(:_O_RANGE_3, "15.3", [:alt, :_O_RANGE_4, :_O_RANGE_5, :R_CHAR, :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
49
+ EBNF::Rule.new(:_O_RANGE_4, "15.4", [:seq, :R_CHAR, "-", :R_CHAR], kind: :terminal).extend(EBNF::PEG::Rule),
50
+ EBNF::Rule.new(:_O_RANGE_5, "15.5", [:seq, :HEX, "-", :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
51
+ EBNF::Rule.new(:_O_RANGE_2, "15.2", [:opt, "-"], kind: :terminal).extend(EBNF::PEG::Rule),
52
+ EBNF::Rule.new(:STRING1, "16", [:seq, "\"", :_STRING1_1, "\""], kind: :terminal).extend(EBNF::PEG::Rule),
53
+ EBNF::Rule.new(:_STRING1_1, "16.1", [:star, :_STRING1_2], kind: :terminal).extend(EBNF::PEG::Rule),
54
+ EBNF::Rule.new(:_STRING1_2, "16.2", [:diff, :CHAR, "\""], kind: :terminal).extend(EBNF::PEG::Rule),
55
+ EBNF::Rule.new(:STRING2, "17", [:seq, "'", :_STRING2_1, "'"], kind: :terminal).extend(EBNF::PEG::Rule),
56
+ EBNF::Rule.new(:_STRING2_1, "17.1", [:star, :_STRING2_2], kind: :terminal).extend(EBNF::PEG::Rule),
57
+ EBNF::Rule.new(:_STRING2_2, "17.2", [:diff, :CHAR, "'"], kind: :terminal).extend(EBNF::PEG::Rule),
58
+ EBNF::Rule.new(:CHAR, "18", [:alt, :_CHAR_1, :_CHAR_2, :_CHAR_3, :_CHAR_4], kind: :terminal).extend(EBNF::PEG::Rule),
59
+ EBNF::Rule.new(:_CHAR_1, "18.1", [:range, "#x9#xA#xD"], kind: :terminal).extend(EBNF::PEG::Rule),
60
+ EBNF::Rule.new(:_CHAR_2, "18.2", [:range, "#x20-#xD7FF"], kind: :terminal).extend(EBNF::PEG::Rule),
61
+ EBNF::Rule.new(:_CHAR_3, "18.3", [:range, "#xE000-#xFFFD"], kind: :terminal).extend(EBNF::PEG::Rule),
62
+ EBNF::Rule.new(:_CHAR_4, "18.4", [:range, "#x10000-#x10FFFF"], kind: :terminal).extend(EBNF::PEG::Rule),
63
+ EBNF::Rule.new(:R_CHAR, "19", [:diff, :CHAR, :_R_CHAR_1], kind: :terminal).extend(EBNF::PEG::Rule),
64
+ EBNF::Rule.new(:_R_CHAR_1, "19.1", [:alt, "]", "-", :HEX], kind: :terminal).extend(EBNF::PEG::Rule),
65
+ EBNF::Rule.new(:POSTFIX, "20", [:range, "?*+"], kind: :terminal).extend(EBNF::PEG::Rule),
66
+ EBNF::Rule.new(:PASS, "21", [:alt, :_PASS_1, :_PASS_2, :_PASS_3, :_PASS_4], kind: :terminal).extend(EBNF::PEG::Rule),
67
+ EBNF::Rule.new(:_PASS_1, "21.1", [:range, "#x9#xA#xD#x20"], kind: :terminal).extend(EBNF::PEG::Rule),
68
+ EBNF::Rule.new(:_PASS_2, "21.2", [:seq, :_PASS_5, :_PASS_6], kind: :terminal).extend(EBNF::PEG::Rule),
69
+ EBNF::Rule.new(:_PASS_5, "21.5", [:alt, :_PASS_7, "//"], kind: :terminal).extend(EBNF::PEG::Rule),
70
+ EBNF::Rule.new(:_PASS_7, "21.7", [:diff, "#", "#x"], kind: :terminal).extend(EBNF::PEG::Rule),
71
+ EBNF::Rule.new(:_PASS_6, "21.6", [:star, :_PASS_8], kind: :terminal).extend(EBNF::PEG::Rule),
72
+ EBNF::Rule.new(:_PASS_8, "21.8", [:range, "^#xA#xD"], kind: :terminal).extend(EBNF::PEG::Rule),
73
+ EBNF::Rule.new(:_PASS_3, "21.3", [:seq, "/*", :_PASS_9, "*/"], kind: :terminal).extend(EBNF::PEG::Rule),
74
+ EBNF::Rule.new(:_PASS_9, "21.9", [:star, :_PASS_10], kind: :terminal).extend(EBNF::PEG::Rule),
75
+ EBNF::Rule.new(:_PASS_10, "21.10", [:alt, :_PASS_11, :_PASS_12], kind: :terminal).extend(EBNF::PEG::Rule),
76
+ EBNF::Rule.new(:_PASS_11, "21.11", [:opt, :_PASS_13], kind: :terminal).extend(EBNF::PEG::Rule),
77
+ EBNF::Rule.new(:_PASS_13, "21.13", [:seq, "*", :_PASS_14], kind: :terminal).extend(EBNF::PEG::Rule),
78
+ EBNF::Rule.new(:_PASS_14, "21.14", [:range, "^/"], kind: :terminal).extend(EBNF::PEG::Rule),
79
+ EBNF::Rule.new(:_PASS_12, "21.12", [:range, "^*"], kind: :terminal).extend(EBNF::PEG::Rule),
80
+ EBNF::Rule.new(:_PASS_4, "21.4", [:seq, "(*", :_PASS_15, "*)"], kind: :terminal).extend(EBNF::PEG::Rule),
81
+ EBNF::Rule.new(:_PASS_15, "21.15", [:star, :_PASS_16], kind: :terminal).extend(EBNF::PEG::Rule),
82
+ EBNF::Rule.new(:_PASS_16, "21.16", [:alt, :_PASS_17, :_PASS_18], kind: :terminal).extend(EBNF::PEG::Rule),
83
+ EBNF::Rule.new(:_PASS_17, "21.17", [:opt, :_PASS_19], kind: :terminal).extend(EBNF::PEG::Rule),
84
+ EBNF::Rule.new(:_PASS_19, "21.19", [:seq, "*", :_PASS_20], kind: :terminal).extend(EBNF::PEG::Rule),
85
+ EBNF::Rule.new(:_PASS_20, "21.20", [:range, "^)"], kind: :terminal).extend(EBNF::PEG::Rule),
86
+ EBNF::Rule.new(:_PASS_18, "21.18", [:range, "^*"], kind: :terminal).extend(EBNF::PEG::Rule),
87
+ EBNF::Rule.new(:_pass, nil, [:seq, :PASS], kind: :pass).extend(EBNF::PEG::Rule),
96
88
  ]
97
89
  end
98
90
 
@@ -1,5 +1,4 @@
1
1
  (
2
- (pass (seq PASS))
3
2
  (rule ebnf "1" (star _ebnf_1))
4
3
  (rule _ebnf_1 "1.1" (alt declaration rule))
5
4
  (rule declaration "2" (alt "@terminals" pass))
@@ -14,16 +13,15 @@
14
13
  (rule _diff_2 "7.2" (seq "-" postfix))
15
14
  (rule postfix "8" (seq primary _postfix_1))
16
15
  (rule _postfix_1 "8.1" (opt POSTFIX))
17
- (rule primary "9"
18
- (alt HEX SYMBOL ENUM O_ENUM RANGE O_RANGE STRING1 STRING2 _primary_1))
16
+ (rule primary "9" (alt HEX SYMBOL O_RANGE RANGE STRING1 STRING2 _primary_1))
19
17
  (rule _primary_1 "9.1" (seq "(" expression ")"))
20
18
  (rule pass "10" (seq "@pass" expression))
19
+ (terminals _terminals (seq))
21
20
  (terminal LHS "11" (seq _LHS_1 SYMBOL _LHS_2 "::="))
22
21
  (terminal _LHS_1 "11.1" (opt _LHS_3))
22
+ (terminal _LHS_3 "11.3" (seq "[" SYMBOL "]" _LHS_4))
23
+ (terminal _LHS_4 "11.4" (plus " "))
23
24
  (terminal _LHS_2 "11.2" (star " "))
24
- (terminal _LHS_3 "11.3" (seq "[" _LHS_4 "]" _LHS_5))
25
- (terminal _LHS_4 "11.4" (plus SYMBOL))
26
- (terminal _LHS_5 "11.5" (plus " "))
27
25
  (terminal SYMBOL "12" (plus _SYMBOL_1))
28
26
  (terminal _SYMBOL_1 "12.1" (alt _SYMBOL_2 _SYMBOL_3 _SYMBOL_4 "_" "."))
29
27
  (terminal _SYMBOL_2 "12.2" (range "a-z"))
@@ -35,59 +33,52 @@
35
33
  (terminal _HEX_3 "13.3" (range "a-f"))
36
34
  (terminal _HEX_4 "13.4" (range "A-F"))
37
35
  (terminal _HEX_5 "13.5" (range "0-9"))
38
- (terminal ENUM "14" (diff _ENUM_1 LHS))
39
- (terminal _ENUM_1 "14.1" (alt _ENUM_2 _ENUM_3))
40
- (terminal _ENUM_2 "14.2" (seq "[" _ENUM_4))
41
- (terminal _ENUM_3 "14.3" (seq _ENUM_5 "]"))
42
- (terminal _ENUM_4 "14.4" (plus R_CHAR))
43
- (terminal _ENUM_5 "14.5" (plus HEX))
44
- (terminal O_ENUM "15" (alt _O_ENUM_1 _O_ENUM_2))
45
- (terminal _O_ENUM_1 "15.1" (seq "[^" _O_ENUM_3))
46
- (terminal _O_ENUM_2 "15.2" (seq _O_ENUM_4 "]"))
47
- (terminal _O_ENUM_3 "15.3" (plus R_CHAR))
48
- (terminal _O_ENUM_4 "15.4" (plus HEX))
49
- (terminal RANGE "16" (alt _RANGE_1 _RANGE_2))
50
- (terminal _RANGE_1 "16.1" (seq "[" _RANGE_3))
51
- (terminal _RANGE_2 "16.2" (seq _RANGE_4 "]"))
52
- (terminal _RANGE_3 "16.3" (seq R_CHAR "-" R_CHAR))
53
- (terminal _RANGE_4 "16.4" (diff HEX HEX))
54
- (terminal O_RANGE "17" (alt _O_RANGE_1 _O_RANGE_2))
55
- (terminal _O_RANGE_1 "17.1" (seq "[^" _O_RANGE_3))
56
- (terminal _O_RANGE_2 "17.2" (seq _O_RANGE_4 "]"))
57
- (terminal _O_RANGE_3 "17.3" (seq R_CHAR "-" R_CHAR))
58
- (terminal _O_RANGE_4 "17.4" (diff HEX HEX))
59
- (terminal STRING1 "18" (seq "\"" _STRING1_1 "\""))
60
- (terminal _STRING1_1 "18.1" (star _STRING1_2))
61
- (terminal _STRING1_2 "18.2" (diff CHAR "\""))
62
- (terminal STRING2 "19" (seq "'" _STRING2_1 "'"))
63
- (terminal _STRING2_1 "19.1" (star _STRING2_2))
64
- (terminal _STRING2_2 "19.2" (diff CHAR "'"))
65
- (terminal CHAR "20" (alt _CHAR_1 _CHAR_2 _CHAR_3 _CHAR_4))
66
- (terminal _CHAR_1 "20.1" (range "#x9#xA#xD"))
67
- (terminal _CHAR_2 "20.2" (range "#x20-#xD7FF"))
68
- (terminal _CHAR_3 "20.3" (range "#xE000-#xFFFD"))
69
- (terminal _CHAR_4 "20.4" (range "#x10000-#x10FFFF"))
70
- (terminal R_CHAR "21" (diff CHAR "]"))
71
- (terminal POSTFIX "22" (range "?*+"))
72
- (terminal PASS "23" (plus _PASS_1))
73
- (terminal _PASS_1 "23.1" (alt _PASS_2 _PASS_3 _PASS_4 _PASS_5))
74
- (terminal _PASS_10 "23.10" (star _PASS_11))
75
- (terminal _PASS_11 "23.11" (alt _PASS_12 _PASS_13))
76
- (terminal _PASS_12 "23.12" (opt _PASS_14))
77
- (terminal _PASS_13 "23.13" (range "^*"))
78
- (terminal _PASS_14 "23.14" (seq "*" _PASS_15))
79
- (terminal _PASS_15 "23.15" (range "^/"))
80
- (terminal _PASS_16 "23.16" (star _PASS_17))
81
- (terminal _PASS_17 "23.17" (alt _PASS_18 _PASS_19))
82
- (terminal _PASS_18 "23.18" (opt _PASS_20))
83
- (terminal _PASS_19 "23.19" (range "^*"))
84
- (terminal _PASS_2 "23.2" (range "#x00-#x20"))
85
- (terminal _PASS_20 "23.20" (seq "*" _PASS_21))
86
- (terminal _PASS_21 "23.21" (range "^)"))
87
- (terminal _PASS_3 "23.3" (seq _PASS_6 _PASS_7))
88
- (terminal _PASS_4 "23.4" (seq "/*" _PASS_10 "*/"))
89
- (terminal _PASS_5 "23.5" (seq "(*" _PASS_16 "*)"))
90
- (terminal _PASS_6 "23.6" (alt _PASS_8 "//"))
91
- (terminal _PASS_7 "23.7" (star _PASS_9))
92
- (terminal _PASS_8 "23.8" (diff "#" "#x"))
93
- (terminal _PASS_9 "23.9" (range "^#x0A#x0Dx")))
36
+ (terminal RANGE "14" (seq "[" _RANGE_1 _RANGE_2 _RANGE_3))
37
+ (terminal _RANGE_1 "14.1" (plus _RANGE_4))
38
+ (terminal _RANGE_4 "14.4" (alt _RANGE_5 _RANGE_6 R_CHAR HEX))
39
+ (terminal _RANGE_5 "14.5" (seq R_CHAR "-" R_CHAR))
40
+ (terminal _RANGE_6 "14.6" (seq HEX "-" HEX))
41
+ (terminal _RANGE_2 "14.2" (opt "-"))
42
+ (terminal _RANGE_3 "14.3" (diff "]" LHS))
43
+ (terminal O_RANGE "15" (seq "[^" _O_RANGE_1 _O_RANGE_2 "]"))
44
+ (terminal _O_RANGE_1 "15.1" (plus _O_RANGE_3))
45
+ (terminal _O_RANGE_3 "15.3" (alt _O_RANGE_4 _O_RANGE_5 R_CHAR HEX))
46
+ (terminal _O_RANGE_4 "15.4" (seq R_CHAR "-" R_CHAR))
47
+ (terminal _O_RANGE_5 "15.5" (seq HEX "-" HEX))
48
+ (terminal _O_RANGE_2 "15.2" (opt "-"))
49
+ (terminal STRING1 "16" (seq "\"" _STRING1_1 "\""))
50
+ (terminal _STRING1_1 "16.1" (star _STRING1_2))
51
+ (terminal _STRING1_2 "16.2" (diff CHAR "\""))
52
+ (terminal STRING2 "17" (seq "'" _STRING2_1 "'"))
53
+ (terminal _STRING2_1 "17.1" (star _STRING2_2))
54
+ (terminal _STRING2_2 "17.2" (diff CHAR "'"))
55
+ (terminal CHAR "18" (alt _CHAR_1 _CHAR_2 _CHAR_3 _CHAR_4))
56
+ (terminal _CHAR_1 "18.1" (range "#x9#xA#xD"))
57
+ (terminal _CHAR_2 "18.2" (range "#x20-#xD7FF"))
58
+ (terminal _CHAR_3 "18.3" (range "#xE000-#xFFFD"))
59
+ (terminal _CHAR_4 "18.4" (range "#x10000-#x10FFFF"))
60
+ (terminal R_CHAR "19" (diff CHAR _R_CHAR_1))
61
+ (terminal _R_CHAR_1 "19.1" (alt "]" "-" HEX))
62
+ (terminal POSTFIX "20" (range "?*+"))
63
+ (terminal PASS "21" (alt _PASS_1 _PASS_2 _PASS_3 _PASS_4))
64
+ (terminal _PASS_1 "21.1" (range "#x9#xA#xD#x20"))
65
+ (terminal _PASS_2 "21.2" (seq _PASS_5 _PASS_6))
66
+ (terminal _PASS_5 "21.5" (alt _PASS_7 "//"))
67
+ (terminal _PASS_7 "21.7" (diff "#" "#x"))
68
+ (terminal _PASS_6 "21.6" (star _PASS_8))
69
+ (terminal _PASS_8 "21.8" (range "^#xA#xD"))
70
+ (terminal _PASS_3 "21.3" (seq "/*" _PASS_9 "*/"))
71
+ (terminal _PASS_9 "21.9" (star _PASS_10))
72
+ (terminal _PASS_10 "21.10" (alt _PASS_11 _PASS_12))
73
+ (terminal _PASS_11 "21.11" (opt _PASS_13))
74
+ (terminal _PASS_13 "21.13" (seq "*" _PASS_14))
75
+ (terminal _PASS_14 "21.14" (range "^/"))
76
+ (terminal _PASS_12 "21.12" (range "^*"))
77
+ (terminal _PASS_4 "21.4" (seq "(*" _PASS_15 "*)"))
78
+ (terminal _PASS_15 "21.15" (star _PASS_16))
79
+ (terminal _PASS_16 "21.16" (alt _PASS_17 _PASS_18))
80
+ (terminal _PASS_17 "21.17" (opt _PASS_19))
81
+ (terminal _PASS_19 "21.19" (seq "*" _PASS_20))
82
+ (terminal _PASS_20 "21.20" (range "^)"))
83
+ (terminal _PASS_18 "21.18" (range "^*"))
84
+ (pass _pass (seq PASS)))
@@ -1,5 +1,4 @@
1
1
  (
2
- (pass (seq PASS))
3
2
  (rule ebnf "1" (star (alt declaration rule)))
4
3
  (rule declaration "2" (alt "@terminals" pass))
5
4
  (rule rule "3" (seq LHS expression))
@@ -9,29 +8,33 @@
9
8
  (rule diff "7" (seq postfix (opt (seq "-" postfix))))
10
9
  (rule postfix "8" (seq primary (opt POSTFIX)))
11
10
  (rule primary "9"
12
- (alt HEX SYMBOL ENUM O_ENUM RANGE O_RANGE STRING1 STRING2 (seq "(" expression ")")))
11
+ (alt HEX SYMBOL O_RANGE RANGE STRING1 STRING2 (seq "(" expression ")")))
13
12
  (rule pass "10" (seq "@pass" expression))
14
- (terminal LHS "11" (seq (opt (seq "[" (plus SYMBOL) "]" (plus " "))) SYMBOL (star " ") "::="))
13
+ (terminals _terminals (seq))
14
+ (terminal LHS "11" (seq (opt (seq "[" SYMBOL "]" (plus " "))) SYMBOL (star " ") "::="))
15
15
  (terminal SYMBOL "12" (plus (alt (range "a-z") (range "A-Z") (range "0-9") "_" ".")))
16
16
  (terminal HEX "13" (seq "#x" (plus (alt (range "a-f") (range "A-F") (range "0-9")))))
17
- (terminal ENUM "14" (diff (alt (seq "[" (plus R_CHAR)) (seq (plus HEX) "]")) LHS))
18
- (terminal O_ENUM "15" (alt (seq "[^" (plus R_CHAR)) (seq (plus HEX) "]")))
19
- (terminal RANGE "16" (alt (seq "[" (seq R_CHAR "-" R_CHAR)) (seq (diff HEX HEX) "]")))
20
- (terminal O_RANGE "17" (alt (seq "[^" (seq R_CHAR "-" R_CHAR)) (seq (diff HEX HEX) "]")))
21
- (terminal STRING1 "18" (seq "\"" (star (diff CHAR "\"")) "\""))
22
- (terminal STRING2 "19" (seq "'" (star (diff CHAR "'")) "'"))
23
- (terminal CHAR "20"
17
+ (terminal RANGE "14"
18
+ (seq "["
19
+ (plus (alt (seq R_CHAR "-" R_CHAR) (seq HEX "-" HEX) R_CHAR HEX))
20
+ (opt "-")
21
+ (diff "]" LHS)) )
22
+ (terminal O_RANGE "15"
23
+ (seq "[^" (plus (alt (seq R_CHAR "-" R_CHAR) (seq HEX "-" HEX) R_CHAR HEX)) (opt "-") "]"))
24
+ (terminal STRING1 "16" (seq "\"" (star (diff CHAR "\"")) "\""))
25
+ (terminal STRING2 "17" (seq "'" (star (diff CHAR "'")) "'"))
26
+ (terminal CHAR "18"
24
27
  (alt
25
28
  (range "#x9#xA#xD")
26
29
  (range "#x20-#xD7FF")
27
30
  (range "#xE000-#xFFFD")
28
31
  (range "#x10000-#x10FFFF")) )
29
- (terminal R_CHAR "21" (diff CHAR "]"))
30
- (terminal POSTFIX "22" (range "?*+"))
31
- (terminal PASS "23"
32
- (plus
33
- (alt
34
- (range "#x00-#x20")
35
- (seq (alt (diff "#" "#x") "//") (star (range "^#x0A#x0Dx")))
36
- (seq "/*" (star (alt (opt (seq "*" (range "^/"))) (range "^*"))) "*/")
37
- (seq "(*" (star (alt (opt (seq "*" (range "^)"))) (range "^*"))) "*)")) )) )
32
+ (terminal R_CHAR "19" (diff CHAR (alt "]" "-" HEX)))
33
+ (terminal POSTFIX "20" (range "?*+"))
34
+ (terminal PASS "21"
35
+ (alt
36
+ (range "#x9#xA#xD#x20")
37
+ (seq (alt (diff "#" "#x") "//") (star (range "^#xA#xD")))
38
+ (seq "/*" (star (alt (opt (seq "*" (range "^/"))) (range "^*"))) "*/")
39
+ (seq "(*" (star (alt (opt (seq "*" (range "^)"))) (range "^*"))) "*)")) )
40
+ (pass _pass (seq PASS)))
@@ -0,0 +1,140 @@
1
+ # W3C EBNF for ISO/IEC 14977 : 1996 EBNF
2
+ # (Scoured from https://www.cl.cam.ac.uk/~mgk25/iso-14977.pdf)
3
+
4
+ # Extended to allow no syntax_rule to be valid.
5
+ syntax ::= syntax_rule*
6
+
7
+ syntax_rule ::= meta_identifier defining_symbol definitions_list terminator_symbol
8
+ (* A <syntax rule> defines the sequences of
9
+ symbols represented by a <meta identifier> *)
10
+
11
+ definitions_list ::= single_definition (definition_separator_symbol definitions_list)*
12
+ (* | separates alternative <single definitions> *)
13
+
14
+ single_definition ::= term (',' term)*
15
+ (* , separates successive <terms> *)
16
+
17
+ term ::= factor ('-' exception)?
18
+ (* A <term> represents any sequence of symbols that is defined by the <factor> but
19
+ not defined by the <exception> *)
20
+
21
+ exception ::= factor
22
+ (* A <factor> may be used as an <exception>
23
+ if it could be replaced by a <factor>
24
+ containingno<metaidentifiers> *)
25
+
26
+ factor ::= (integer '*')? primary
27
+ (* The <integer> specifies the number of repetitions of the <primary> *)
28
+
29
+ primary ::= optional_sequence
30
+ | repeated_sequence
31
+ | special_sequence
32
+ | grouped_sequence
33
+ | meta_identifier
34
+ | terminal_string
35
+ | empty
36
+
37
+ optional_sequence ::= start_option_symbol definitions_list end_option_symbol
38
+ (* The brackets [ and ] enclose symbols which are optional *)
39
+
40
+ repeated_sequence ::= start_repeat_symbol definitions_list end_repeat_symbol
41
+ (* The brackets { and } enclose symbols
42
+ which may be repeated any number of times *)
43
+
44
+ grouped_sequence ::= '(' definitions_list ')'
45
+ (* The brackets ( and ) allow any <definitions list> to be a <primary> *)
46
+
47
+ # Note, the following are nominally terminal rules,
48
+ # although ISO EBNF does not really distinguish between non-terminal and terminal rules.
49
+
50
+ @terminals
51
+
52
+ terminal_string ::= ("'" first_terminal_character+ "'")
53
+ | ('"' second_terminal_character+ '"')
54
+ (* A <terminal string> represents the
55
+ <characters> between the quote symbols '_' or "_" *)
56
+
57
+ meta_identifier ::= letter meta_identifier_character*
58
+ (* A <meta identifier> is the name of a syntactic element of the language being defined *)
59
+
60
+ integer ::= decimal_digit+
61
+
62
+ special_sequence ::= '?' special_sequence_character* '?'
63
+ (* The meaning of a <special sequence> is not defined in the standard metalanguage. *)
64
+
65
+ comment ::= start_comment_symbol comment_symbol* end_comment_symbol
66
+ (* A comment is allowed anywhere outside a
67
+ <terminal string>, <meta identifier>,
68
+ <integer> or <special sequence> *)
69
+
70
+ comment_symbol ::= comment | commentless_symbol | other_character
71
+
72
+ commentless_symbol ::= terminal_character | meta_identifier | integer
73
+ | terminal_string | special_sequence
74
+
75
+ letter ::= [a-zA-Z]
76
+ # gratuitous comment
77
+ decimal_digit ::= [0-9]
78
+
79
+ # Extended to allow '_'
80
+ meta_identifier_character ::= letter | decimal_digit | '_'
81
+
82
+ first_terminal_character ::= terminal_character - "'"
83
+
84
+ second_terminal_character ::= terminal_character - '"'
85
+
86
+ special_sequence_character ::= terminal_character - '?'
87
+
88
+ terminal_character ::= letter
89
+ | decimal_digit
90
+ | concatenate_symbol
91
+ | defining_symbol
92
+ | definition_separator_symbol
93
+ | end_comment_symbol
94
+ | end_group_symbol
95
+ | end_option_symbol
96
+ | end_repeat_symbol
97
+ | except_symbol
98
+ | first_quote_symbol
99
+ | repetition_symbol
100
+ | second_quote_symbol
101
+ | special_sequence_symbol
102
+ | start_comment_symbol
103
+ | start_group_symbol
104
+ | start_option_symbol
105
+ | start_repeat_symbol
106
+ | terminator_symbol
107
+ | other_character
108
+
109
+ other_character ::= [:+_%@&$<>^` ̃#x20#x23] | '\'
110
+
111
+ gap_separator ::= [#x9#xa#xb#xc#xd#x20]
112
+
113
+ @pass gap_separator+ | comment
114
+
115
+ empty ::= ''
116
+
117
+ concatenate_symbol ::= ','
118
+ repetition_symbol ::= '*'
119
+ except_symbol ::= '-'
120
+ first_quote_symbol ::= "'"
121
+ second_quote_symbol ::= '"'
122
+ start_comment_symbol ::= '(*'
123
+ end_comment_symbol ::= '*)'
124
+ start_group_symbol ::= '('
125
+ end_group_symbol ::= ')'
126
+ special_sequence_symbol ::= '?'
127
+
128
+ # Simple terminals that are often extended
129
+ defining_symbol ::= '=' | ':'
130
+ definition_separator_symbol ::= '|' | '/' | '!'
131
+ terminator_symbol ::= ';' | '.'
132
+ start_option_symbol ::= '['
133
+ end_option_symbol ::= ']'
134
+ start_repeat_symbol ::= '{' | '(:'
135
+ end_repeat_symbol ::= '}' | ':)'
136
+
137
+ # Symbols described, but not actually used.
138
+
139
+ gap_free_symbol ::= (terminal_character - ['"])
140
+ | terminal_string