bel_parser 1.0.0.alpha.38 → 1.0.0.alpha.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gemspec +1 -1
  3. data/VERSION +1 -1
  4. data/lib/bel_parser/ast_filter.rb +6 -2
  5. data/lib/bel_parser/parsers/ast/node.rb +113 -58
  6. data/lib/bel_parser/parsers/bel_script/define_annotation.rb +4175 -3097
  7. data/lib/bel_parser/parsers/bel_script/define_annotation.rl +142 -49
  8. data/lib/bel_parser/parsers/bel_script/define_namespace.rb +980 -461
  9. data/lib/bel_parser/parsers/bel_script/define_namespace.rl +79 -39
  10. data/lib/bel_parser/parsers/bel_script/set.rb +4878 -2743
  11. data/lib/bel_parser/parsers/bel_script/set.rl +114 -32
  12. data/lib/bel_parser/parsers/bel_script/set_document.rb +5839 -5292
  13. data/lib/bel_parser/parsers/bel_script/set_document.rl +130 -27
  14. data/lib/bel_parser/parsers/bel_script/unset.rb +321 -234
  15. data/lib/bel_parser/parsers/bel_script/unset.rl +49 -21
  16. data/lib/bel_parser/parsers/common.rb +1 -0
  17. data/lib/bel_parser/parsers/common/blank_line.rb +12 -11
  18. data/lib/bel_parser/parsers/common/blank_line.rl +12 -12
  19. data/lib/bel_parser/parsers/common/comment_line.rb +65 -40
  20. data/lib/bel_parser/parsers/common/comment_line.rl +26 -26
  21. data/lib/bel_parser/parsers/common/common.rl +60 -0
  22. data/lib/bel_parser/parsers/common/function.rb +319 -0
  23. data/lib/bel_parser/parsers/common/function.rl +149 -0
  24. data/lib/bel_parser/parsers/common/identifier.rb +72 -68
  25. data/lib/bel_parser/parsers/common/identifier.rl +73 -29
  26. data/lib/bel_parser/parsers/common/list.rb +1617 -1243
  27. data/lib/bel_parser/parsers/common/list.rl +120 -60
  28. data/lib/bel_parser/parsers/common/string.rb +114 -41
  29. data/lib/bel_parser/parsers/common/string.rl +91 -28
  30. data/lib/bel_parser/parsers/expression/comment.rb +70 -38
  31. data/lib/bel_parser/parsers/expression/comment.rl +37 -20
  32. data/lib/bel_parser/parsers/expression/nested_statement.rb +63116 -13958
  33. data/lib/bel_parser/parsers/expression/nested_statement.rl +53 -23
  34. data/lib/bel_parser/parsers/expression/observed_term.rb +32497 -5188
  35. data/lib/bel_parser/parsers/expression/observed_term.rl +25 -20
  36. data/lib/bel_parser/parsers/expression/parameter.rb +2861 -847
  37. data/lib/bel_parser/parsers/expression/parameter.rl +178 -21
  38. data/lib/bel_parser/parsers/expression/relationship.rb +73 -55
  39. data/lib/bel_parser/parsers/expression/relationship.rl +41 -23
  40. data/lib/bel_parser/parsers/expression/simple_statement.rb +42895 -7846
  41. data/lib/bel_parser/parsers/expression/simple_statement.rl +41 -24
  42. data/lib/bel_parser/parsers/expression/term.rb +16498 -2602
  43. data/lib/bel_parser/parsers/expression/term.rl +52 -35
  44. data/lib/bel_parser/parsers/line_parser.rb +1 -0
  45. data/lib/bel_parser/parsers/mixin/buffer.rb +4 -0
  46. data/lib/bel_parser/parsers/tracer.rb +19 -0
  47. data/lib/bel_parser/script/state/namespace_definition.rb +1 -0
  48. metadata +13 -9
@@ -9,6 +9,7 @@
9
9
  require_relative '../ast/node'
10
10
  require_relative '../mixin/buffer'
11
11
  require_relative '../nonblocking_io_wrapper'
12
+ require_relative '../tracer'
12
13
 
13
14
  module BELParser
14
15
  module Parsers
@@ -34,10 +35,11 @@ module BELParser
34
35
  include Enumerable
35
36
  include BELParser::Parsers::Buffer
36
37
  include BELParser::Parsers::AST::Sexp
38
+ include BELParser::Parsers::Tracer
37
39
 
38
40
  def initialize(content)
39
41
  @content = content
40
- # begin: ragel
42
+ # begin: ragel
41
43
 
42
44
  class << self
43
45
  attr_accessor :_bel_trans_keys
@@ -69,30 +71,30 @@ class << self
69
71
  private :_bel_indicies, :_bel_indicies=
70
72
  end
71
73
  self._bel_indicies = [
72
- 1, 1, 1, 1, 1, 1, 1, 1,
73
- 1, 1, 0, 0, 0, 0, 0, 0,
74
- 0, 1, 1, 1, 1, 1, 1, 1,
75
- 1, 1, 1, 1, 1, 1, 1, 1,
76
- 1, 1, 1, 1, 1, 1, 1, 1,
77
- 1, 1, 1, 0, 0, 0, 0, 1,
78
- 0, 1, 1, 1, 1, 1, 1, 1,
79
- 1, 1, 1, 1, 1, 1, 1, 1,
80
- 1, 1, 1, 1, 1, 1, 1, 1,
81
- 1, 1, 1, 0, 2, 0, 0, 0,
82
74
  0, 0, 0, 0, 0, 0, 0, 0,
75
+ 0, 0, 1, 1, 1, 1, 1, 1,
76
+ 1, 0, 0, 0, 0, 0, 0, 0,
83
77
  0, 0, 0, 0, 0, 0, 0, 0,
84
78
  0, 0, 0, 0, 0, 0, 0, 0,
79
+ 0, 0, 0, 1, 1, 1, 1, 0,
80
+ 1, 0, 0, 0, 0, 0, 0, 0,
85
81
  0, 0, 0, 0, 0, 0, 0, 0,
86
- 0, 0, 3, 3, 3, 3, 3, 3,
87
- 3, 3, 3, 3, 0, 0, 0, 0,
88
- 0, 0, 0, 3, 3, 3, 3, 3,
89
- 3, 3, 3, 3, 3, 3, 3, 3,
90
- 3, 3, 3, 3, 3, 3, 3, 3,
91
- 3, 3, 3, 3, 3, 0, 0, 0,
92
- 0, 3, 0, 3, 3, 3, 3, 3,
93
- 3, 3, 3, 3, 3, 3, 3, 3,
94
- 3, 3, 3, 3, 3, 3, 3, 3,
95
- 3, 3, 3, 3, 3, 0, 4, 0
82
+ 0, 0, 0, 0, 0, 0, 0, 0,
83
+ 0, 0, 0, 1, 3, 2, 2, 2,
84
+ 2, 2, 2, 2, 2, 2, 2, 2,
85
+ 2, 2, 2, 2, 2, 2, 2, 2,
86
+ 2, 2, 2, 2, 2, 2, 2, 2,
87
+ 2, 2, 2, 2, 2, 2, 2, 2,
88
+ 2, 2, 4, 4, 4, 4, 4, 4,
89
+ 4, 4, 4, 4, 2, 2, 2, 2,
90
+ 2, 2, 2, 4, 4, 4, 4, 4,
91
+ 4, 4, 4, 4, 4, 4, 4, 4,
92
+ 4, 4, 4, 4, 4, 4, 4, 4,
93
+ 4, 4, 4, 4, 4, 2, 2, 2,
94
+ 2, 4, 2, 4, 4, 4, 4, 4,
95
+ 4, 4, 4, 4, 4, 4, 4, 4,
96
+ 4, 4, 4, 4, 4, 4, 4, 4,
97
+ 4, 4, 4, 4, 4, 2, 2, 0
96
98
  ]
97
99
 
98
100
  class << self
@@ -100,7 +102,7 @@ class << self
100
102
  private :_bel_trans_targs, :_bel_trans_targs=
101
103
  end
102
104
  self._bel_trans_targs = [
103
- 0, 2, 3, 2, 0
105
+ 2, 0, 0, 3, 2
104
106
  ]
105
107
 
106
108
  class << self
@@ -108,7 +110,7 @@ class << self
108
110
  private :_bel_trans_actions, :_bel_trans_actions=
109
111
  end
110
112
  self._bel_trans_actions = [
111
- 1, 2, 3, 4, 0
113
+ 1, 0, 3, 4, 0
112
114
  ]
113
115
 
114
116
  class << self
@@ -116,7 +118,7 @@ class << self
116
118
  private :_bel_eof_actions, :_bel_eof_actions=
117
119
  end
118
120
  self._bel_eof_actions = [
119
- 0, 1, 1, 0
121
+ 0, 0, 2, 5
120
122
  ]
121
123
 
122
124
  class << self
@@ -126,29 +128,33 @@ self.bel_start = 1;
126
128
  class << self
127
129
  attr_accessor :bel_first_final
128
130
  end
129
- self.bel_first_final = 3;
131
+ self.bel_first_final = 2;
130
132
  class << self
131
133
  attr_accessor :bel_error
132
134
  end
133
135
  self.bel_error = 0;
134
136
 
135
137
  class << self
136
- attr_accessor :bel_en_ident
138
+ attr_accessor :bel_en_ident_node
137
139
  end
138
- self.bel_en_ident = 1;
140
+ self.bel_en_ident_node = 1;
139
141
 
140
142
 
141
- # end: ragel
143
+ # end: ragel
142
144
  end
143
145
 
144
146
  def each
145
- @buffers = {}
146
- data = @content.unpack('C*')
147
- p = 0
148
- pe = data.length
149
- eof = data.length
150
-
151
- # begin: ragel
147
+ @buffers = {}
148
+ @incomplete = {}
149
+ data = @content.unpack('C*')
150
+ p = 0
151
+ id_start = 0
152
+ id_end = 0
153
+ pe = data.length
154
+ eof = data.length
155
+
156
+ identifier_started = false
157
+ # begin: ragel
152
158
 
153
159
  begin
154
160
  p ||= 0
@@ -193,41 +199,31 @@ begin
193
199
  cs = _bel_trans_targs[_trans]
194
200
  if _bel_trans_actions[_trans] != 0
195
201
  case _bel_trans_actions[_trans]
196
- when 4 then
197
- begin
198
-
199
- (@buffers[:ident] ||= []) << data[p].ord
200
- end
201
- when 2 then
202
+ when 1 then
202
203
  begin
203
204
 
204
- @buffers[:ident] = []
205
+ trace('IDENTIFIER start_identifier')
206
+ @identifier_started = true
207
+ id_start = p;
205
208
  end
209
+ when 4 then
206
210
  begin
207
211
 
208
- (@buffers[:ident] ||= []) << data[p].ord
212
+ trace('IDENTIFIER end_identifier')
213
+ id_end = p
214
+ chars = data[id_start...id_end]
215
+ completed = !chars.empty?
216
+ ast_node = identifier(utf8_string(chars), complete: completed)
217
+ @buffers[:ident] = ast_node
209
218
  end
210
219
  when 3 then
211
220
  begin
212
221
 
213
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
214
- end
215
- begin
216
-
217
- yield @buffers[:ident]
218
- end
219
- when 1 then
220
- begin
221
-
222
- unless @buffers[:ident].is_a?(::AST::Node)
223
- @buffers[:ident] ||= []
224
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
225
- end
226
- end
227
- begin
228
-
229
- @buffers[:ident] ||= []
230
- yield @buffers[:ident]
222
+ trace('IDENTIFIER ident_node_err')
223
+ id_end = p
224
+ chars = data[id_start...id_end]
225
+ ast_node = identifier(utf8_string(chars), complete: false)
226
+ yield ast_node
231
227
  end
232
228
  end
233
229
  end
@@ -246,17 +242,25 @@ begin
246
242
  if _goto_level <= _test_eof
247
243
  if p == eof
248
244
  case _bel_eof_actions[cs]
249
- when 1 then
245
+ when 5 then
250
246
  begin
251
247
 
252
- unless @buffers[:ident].is_a?(::AST::Node)
253
- @buffers[:ident] ||= []
254
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
255
- end
248
+ trace('IDENTIFIER yield_identifier')
249
+ yield @buffers[:ident]
250
+ end
251
+ when 2 then
252
+ begin
253
+
254
+ trace('IDENTIFIER end_identifier')
255
+ id_end = p
256
+ chars = data[id_start...id_end]
257
+ completed = !chars.empty?
258
+ ast_node = identifier(utf8_string(chars), complete: completed)
259
+ @buffers[:ident] = ast_node
256
260
  end
257
261
  begin
258
262
 
259
- @buffers[:ident] ||= []
263
+ trace('IDENTIFIER yield_identifier')
260
264
  yield @buffers[:ident]
261
265
  end
262
266
  end
@@ -269,7 +273,7 @@ begin
269
273
  end
270
274
  end
271
275
 
272
- # end: ragel
276
+ # end: ragel
273
277
  end
274
278
  end
275
279
  end
@@ -5,37 +5,75 @@
5
5
 
6
6
  include 'common.rl';
7
7
 
8
- action start_ident {
9
- @buffers[:ident] = []
8
+ action start_identifier {
9
+ trace('IDENTIFIER start_identifier')
10
+ @identifier_started = true
11
+ id_start = p;
10
12
  }
11
13
 
12
- action append_ident {
13
- (@buffers[:ident] ||= []) << fc
14
+ action end_identifier {
15
+ trace('IDENTIFIER end_identifier')
16
+ id_end = p
17
+ chars = data[id_start...id_end]
18
+ completed = !chars.empty?
19
+ ast_node = identifier(utf8_string(chars), complete: completed)
20
+ @buffers[:ident] = ast_node
14
21
  }
15
22
 
16
- action finish_ident {
17
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
23
+ action an_ident_err {
24
+ trace('IDENTIFIER an_ident_err')
25
+ id_end = p
26
+ chars = data[id_start...id_end]
27
+ ast_node = identifier(utf8_string(chars), complete: false)
28
+ @buffers[:ident] = ast_node
18
29
  }
19
30
 
20
- action yield_complete_ident {
21
- yield @buffers[:ident]
22
- }
23
-
24
- action error_ident {
25
- unless @buffers[:ident].is_a?(::AST::Node)
26
- @buffers[:ident] ||= []
27
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
28
- end
31
+ action ident_node_err {
32
+ trace('IDENTIFIER ident_node_err')
33
+ id_end = p
34
+ chars = data[id_start...id_end]
35
+ ast_node = identifier(utf8_string(chars), complete: false)
36
+ yield ast_node
29
37
  }
30
38
 
31
- action yield_error_ident {
32
- @buffers[:ident] ||= []
39
+ action yield_identifier {
40
+ trace('IDENTIFIER yield_identifier')
33
41
  yield @buffers[:ident]
34
42
  }
35
43
 
36
- IDENT = [a-zA-Z0-9_]+ >start_ident $append_ident %finish_ident $err(error_ident);
44
+ action an_ident_eof {
45
+ trace('IDENTIFIER an_ident_eof')
46
+ if @identifier_started
47
+ id_end = p
48
+ chars = data[id_start...id_end]
49
+ completed = !chars.empty?
50
+ ast_node = identifier(utf8_string(chars), complete: completed)
51
+ @buffers[:ident] = ast_node
52
+ end
53
+ }
37
54
 
38
- ident := IDENT $err(yield_error_ident) %yield_complete_ident NL;
55
+ ident =
56
+ ID_CHARS
57
+ >start_identifier
58
+ %end_identifier
59
+ ;
60
+
61
+ maybe_ident =
62
+ ident?
63
+ ;
64
+
65
+ an_ident =
66
+ ident
67
+ $eof(an_ident_eof)
68
+ $err(an_ident_err)
69
+ ;
70
+
71
+ ident_node :=
72
+ ident
73
+ NL?
74
+ $err(ident_node_err)
75
+ %yield_identifier
76
+ ;
39
77
  }%%
40
78
  =end
41
79
  # end: ragel
@@ -43,6 +81,7 @@
43
81
  require_relative '../ast/node'
44
82
  require_relative '../mixin/buffer'
45
83
  require_relative '../nonblocking_io_wrapper'
84
+ require_relative '../tracer'
46
85
 
47
86
  module BELParser
48
87
  module Parsers
@@ -68,25 +107,30 @@ module BELParser
68
107
  include Enumerable
69
108
  include BELParser::Parsers::Buffer
70
109
  include BELParser::Parsers::AST::Sexp
110
+ include BELParser::Parsers::Tracer
71
111
 
72
112
  def initialize(content)
73
113
  @content = content
74
- # begin: ragel
114
+ # begin: ragel
75
115
  %% write data;
76
- # end: ragel
116
+ # end: ragel
77
117
  end
78
118
 
79
119
  def each
80
- @buffers = {}
81
- data = @content.unpack('C*')
82
- p = 0
83
- pe = data.length
84
- eof = data.length
85
-
86
- # begin: ragel
120
+ @buffers = {}
121
+ @incomplete = {}
122
+ data = @content.unpack('C*')
123
+ p = 0
124
+ id_start = 0
125
+ id_end = 0
126
+ pe = data.length
127
+ eof = data.length
128
+
129
+ identifier_started = false
130
+ # begin: ragel
87
131
  %% write init;
88
132
  %% write exec;
89
- # end: ragel
133
+ # end: ragel
90
134
  end
91
135
  end
92
136
  end
@@ -7,14 +7,15 @@ class << self
7
7
  private :_bel_trans_keys, :_bel_trans_keys=
8
8
  end
9
9
  self._bel_trans_keys = [
10
- 0, 0, 123, 123, 9, 125,
11
- 34, 92, 9, 125, 9,
12
- 125, 9, 122, 9, 125,
13
- 10, 10, 92, 92, 48, 122,
14
- 10, 122, 34, 34, 34,
15
- 92, 10, 10, 92, 92,
16
- 0, 0, 0, 0, 0, 0,
17
- 0
10
+ 0, 0, 123, 123, 9, 34,
11
+ 34, 92, 34, 92, 9,
12
+ 122, 0, 0, 48, 122,
13
+ 9, 34, 34, 92, 34, 92,
14
+ 0, 0, 9, 125, 9,
15
+ 125, 9, 34, 9, 125,
16
+ 9, 125, 0, 0, 9, 125,
17
+ 10, 10, 10, 122, 0,
18
+ 0, 0, 0, 0
18
19
  ]
19
20
 
20
21
  class << self
@@ -22,9 +23,9 @@ class << self
22
23
  private :_bel_key_spans, :_bel_key_spans=
23
24
  end
24
25
  self._bel_key_spans = [
25
- 0, 1, 117, 59, 117, 117, 114, 117,
26
- 1, 1, 75, 113, 1, 59, 1, 1,
27
- 0, 0, 0
26
+ 0, 1, 26, 59, 59, 114, 0, 75,
27
+ 26, 59, 59, 0, 117, 117, 26, 117,
28
+ 117, 0, 117, 1, 113, 0, 0
28
29
  ]
29
30
 
30
31
  class << self
@@ -32,9 +33,9 @@ class << self
32
33
  private :_bel_index_offsets, :_bel_index_offsets=
33
34
  end
34
35
  self._bel_index_offsets = [
35
- 0, 0, 2, 120, 180, 298, 416, 531,
36
- 649, 651, 653, 729, 843, 845, 905, 907,
37
- 909, 910, 911
36
+ 0, 0, 2, 29, 89, 149, 264, 265,
37
+ 341, 368, 428, 488, 489, 607, 725, 752,
38
+ 870, 988, 989, 1107, 1109, 1223, 1224
38
39
  ]
39
40
 
40
41
  class << self
@@ -42,121 +43,160 @@ class << self
42
43
  private :_bel_indicies, :_bel_indicies=
43
44
  end
44
45
  self._bel_indicies = [
45
- 1, 0, 3, 2, 2, 2, 2, 2,
46
+ 0, 1, 3, 3, 3, 3, 3, 2,
46
47
  2, 2, 2, 2, 2, 2, 2, 2,
47
48
  2, 2, 2, 2, 2, 2, 2, 2,
48
- 2, 3, 2, 4, 2, 2, 2, 2,
49
- 2, 2, 2, 2, 2, 5, 2, 2,
50
- 2, 6, 6, 6, 6, 6, 6, 6,
51
- 6, 6, 6, 2, 2, 2, 2, 2,
52
- 2, 2, 6, 6, 6, 6, 6, 6,
53
- 6, 6, 6, 6, 6, 6, 6, 6,
54
- 6, 6, 6, 6, 6, 6, 6, 6,
55
- 6, 6, 6, 6, 2, 2, 2, 2,
56
- 6, 2, 6, 6, 6, 6, 6, 6,
57
- 6, 6, 6, 6, 6, 6, 6, 6,
58
- 6, 6, 6, 6, 6, 6, 6, 6,
59
- 6, 6, 6, 6, 2, 2, 7, 2,
60
- 9, 8, 8, 8, 8, 8, 8, 8,
49
+ 2, 3, 2, 4, 2, 6, 5, 5,
50
+ 5, 5, 5, 5, 5, 5, 5, 5,
51
+ 5, 5, 5, 5, 5, 5, 5, 5,
52
+ 5, 5, 5, 5, 5, 5, 5, 5,
53
+ 5, 5, 5, 5, 5, 5, 5, 5,
54
+ 5, 5, 5, 5, 5, 5, 5, 5,
55
+ 5, 5, 5, 5, 5, 5, 5, 5,
56
+ 5, 5, 5, 5, 5, 5, 5, 7,
57
+ 5, 9, 8, 8, 8, 8, 8, 8,
61
58
  8, 8, 8, 8, 8, 8, 8, 8,
62
59
  8, 8, 8, 8, 8, 8, 8, 8,
63
60
  8, 8, 8, 8, 8, 8, 8, 8,
64
61
  8, 8, 8, 8, 8, 8, 8, 8,
65
62
  8, 8, 8, 8, 8, 8, 8, 8,
66
63
  8, 8, 8, 8, 8, 8, 8, 8,
67
- 8, 8, 10, 8, 12, 11, 11, 11,
68
- 11, 11, 11, 11, 11, 11, 11, 11,
69
- 11, 11, 11, 11, 11, 11, 11, 11,
70
- 11, 11, 11, 12, 11, 11, 11, 11,
71
- 11, 11, 11, 11, 11, 11, 11, 13,
72
- 11, 11, 11, 11, 11, 11, 11, 11,
73
- 11, 11, 11, 11, 11, 11, 11, 11,
74
- 11, 11, 11, 11, 11, 11, 11, 11,
75
- 11, 11, 11, 11, 11, 11, 11, 11,
64
+ 8, 8, 8, 10, 8, 12, 3, 3,
65
+ 3, 3, 11, 11, 11, 11, 11, 11,
76
66
  11, 11, 11, 11, 11, 11, 11, 11,
67
+ 11, 11, 11, 11, 12, 11, 4, 11,
77
68
  11, 11, 11, 11, 11, 11, 11, 11,
69
+ 11, 11, 11, 11, 13, 13, 13, 13,
70
+ 13, 13, 13, 13, 13, 13, 11, 11,
71
+ 11, 11, 11, 11, 11, 13, 13, 13,
72
+ 13, 13, 13, 13, 13, 13, 13, 13,
73
+ 13, 13, 13, 13, 13, 13, 13, 13,
74
+ 13, 13, 13, 13, 13, 13, 13, 11,
75
+ 11, 11, 11, 13, 11, 13, 13, 13,
76
+ 13, 13, 13, 13, 13, 13, 13, 13,
77
+ 13, 13, 13, 13, 13, 13, 13, 13,
78
+ 13, 13, 13, 13, 13, 13, 13, 11,
79
+ 8, 14, 14, 14, 14, 14, 14, 14,
80
+ 14, 14, 14, 1, 1, 1, 1, 1,
81
+ 1, 1, 14, 14, 14, 14, 14, 14,
82
+ 14, 14, 14, 14, 14, 14, 14, 14,
83
+ 14, 14, 14, 14, 14, 14, 14, 14,
84
+ 14, 14, 14, 14, 1, 1, 1, 1,
85
+ 14, 1, 14, 14, 14, 14, 14, 14,
86
+ 14, 14, 14, 14, 14, 14, 14, 14,
87
+ 14, 14, 14, 14, 14, 14, 14, 14,
88
+ 14, 14, 14, 14, 1, 16, 16, 16,
89
+ 16, 16, 15, 15, 15, 15, 15, 15,
90
+ 15, 15, 15, 15, 15, 15, 15, 15,
91
+ 15, 15, 15, 15, 16, 15, 17, 15,
92
+ 19, 18, 18, 18, 18, 18, 18, 18,
93
+ 18, 18, 18, 18, 18, 18, 18, 18,
94
+ 18, 18, 18, 18, 18, 18, 18, 18,
95
+ 18, 18, 18, 18, 18, 18, 18, 18,
96
+ 18, 18, 18, 18, 18, 18, 18, 18,
97
+ 18, 18, 18, 18, 18, 18, 18, 18,
98
+ 18, 18, 18, 18, 18, 18, 18, 18,
99
+ 18, 18, 20, 18, 22, 21, 21, 21,
100
+ 21, 21, 21, 21, 21, 21, 21, 21,
101
+ 21, 21, 21, 21, 21, 21, 21, 21,
102
+ 21, 21, 21, 21, 21, 21, 21, 21,
103
+ 21, 21, 21, 21, 21, 21, 21, 21,
104
+ 21, 21, 21, 21, 21, 21, 21, 21,
105
+ 21, 21, 21, 21, 21, 21, 21, 21,
106
+ 21, 21, 21, 21, 21, 21, 23, 21,
107
+ 21, 24, 25, 26, 26, 26, 11, 11,
78
108
  11, 11, 11, 11, 11, 11, 11, 11,
79
109
  11, 11, 11, 11, 11, 11, 11, 11,
110
+ 24, 11, 27, 11, 11, 11, 11, 11,
80
111
  11, 11, 11, 11, 11, 11, 11, 11,
81
- 11, 11, 11, 11, 11, 11, 11, 11,
82
- 14, 11, 15, 0, 0, 0, 0, 0,
83
- 0, 0, 0, 0, 0, 0, 0, 0,
84
- 0, 0, 0, 0, 0, 0, 0, 0,
85
- 0, 15, 0, 0, 0, 0, 0, 0,
86
- 0, 0, 0, 0, 0, 16, 0, 0,
87
- 0, 0, 0, 0, 0, 0, 0, 0,
88
- 0, 0, 0, 0, 0, 0, 0, 0,
89
- 0, 0, 0, 0, 0, 0, 0, 0,
90
- 0, 0, 0, 0, 0, 0, 0, 0,
91
- 0, 0, 0, 0, 0, 0, 0, 0,
92
- 0, 0, 0, 0, 0, 0, 0, 0,
93
- 0, 0, 0, 0, 0, 0, 0, 0,
94
- 0, 0, 0, 0, 0, 0, 0, 0,
95
- 0, 0, 0, 0, 0, 0, 0, 0,
96
- 0, 0, 0, 0, 0, 0, 17, 0,
97
- 18, 2, 2, 2, 2, 2, 2, 2,
98
- 2, 2, 2, 2, 2, 2, 2, 2,
99
- 2, 2, 2, 2, 2, 2, 2, 18,
100
- 2, 4, 2, 2, 2, 2, 2, 2,
101
- 2, 2, 2, 2, 2, 2, 2, 6,
102
- 6, 6, 6, 6, 6, 6, 6, 6,
103
- 6, 2, 2, 2, 2, 2, 2, 2,
104
- 6, 6, 6, 6, 6, 6, 6, 6,
105
- 6, 6, 6, 6, 6, 6, 6, 6,
106
- 6, 6, 6, 6, 6, 6, 6, 6,
107
- 6, 6, 2, 2, 2, 2, 6, 2,
108
- 6, 6, 6, 6, 6, 6, 6, 6,
109
- 6, 6, 6, 6, 6, 6, 6, 6,
110
- 6, 6, 6, 6, 6, 6, 6, 6,
111
- 6, 6, 2, 20, 19, 19, 19, 19,
112
- 19, 19, 19, 19, 19, 19, 19, 19,
113
- 19, 19, 19, 19, 19, 19, 19, 19,
114
- 19, 19, 20, 19, 19, 19, 19, 19,
115
- 19, 19, 19, 19, 19, 19, 21, 19,
116
- 19, 19, 22, 22, 22, 22, 22, 22,
117
- 22, 22, 22, 22, 19, 19, 19, 19,
118
- 19, 19, 19, 22, 22, 22, 22, 22,
119
- 22, 22, 22, 22, 22, 22, 22, 22,
120
- 22, 22, 22, 22, 22, 22, 22, 22,
121
- 22, 22, 22, 22, 22, 19, 19, 19,
122
- 19, 22, 19, 22, 22, 22, 22, 22,
123
- 22, 22, 22, 22, 22, 22, 22, 22,
124
- 22, 22, 22, 22, 22, 22, 22, 22,
125
- 22, 22, 22, 22, 22, 19, 19, 23,
126
- 19, 24, 0, 10, 8, 26, 26, 26,
127
- 26, 26, 26, 26, 26, 26, 26, 25,
128
- 25, 25, 25, 25, 25, 25, 26, 26,
129
- 26, 26, 26, 26, 26, 26, 26, 26,
130
- 26, 26, 26, 26, 26, 26, 26, 26,
131
- 26, 26, 26, 26, 26, 26, 26, 26,
132
- 25, 25, 25, 25, 26, 25, 26, 26,
133
- 26, 26, 26, 26, 26, 26, 26, 26,
134
- 26, 26, 26, 26, 26, 26, 26, 26,
135
- 26, 26, 26, 26, 26, 26, 26, 26,
136
- 25, 27, 25, 25, 25, 25, 25, 25,
137
- 25, 25, 25, 25, 25, 25, 25, 25,
138
- 25, 25, 25, 25, 25, 25, 25, 25,
139
- 25, 25, 25, 25, 25, 25, 25, 25,
140
- 25, 25, 25, 25, 25, 25, 25, 28,
141
- 28, 28, 28, 28, 28, 28, 28, 28,
142
- 28, 25, 25, 25, 25, 25, 25, 25,
143
- 28, 28, 28, 28, 28, 28, 28, 28,
144
112
  28, 28, 28, 28, 28, 28, 28, 28,
113
+ 28, 28, 11, 11, 11, 11, 11, 11,
114
+ 11, 28, 28, 28, 28, 28, 28, 28,
145
115
  28, 28, 28, 28, 28, 28, 28, 28,
146
- 28, 28, 25, 25, 25, 25, 28, 25,
147
116
  28, 28, 28, 28, 28, 28, 28, 28,
117
+ 28, 28, 28, 11, 11, 11, 11, 28,
118
+ 11, 28, 28, 28, 28, 28, 28, 28,
148
119
  28, 28, 28, 28, 28, 28, 28, 28,
149
120
  28, 28, 28, 28, 28, 28, 28, 28,
150
- 28, 28, 25, 30, 29, 32, 31, 31,
151
- 31, 31, 31, 31, 31, 31, 31, 31,
152
- 31, 31, 31, 31, 31, 31, 31, 31,
153
- 31, 31, 31, 31, 31, 31, 31, 31,
154
- 31, 31, 31, 31, 31, 31, 31, 31,
155
- 31, 31, 31, 31, 31, 31, 31, 31,
156
- 31, 31, 31, 31, 31, 31, 31, 31,
157
- 31, 31, 31, 31, 31, 31, 31, 33,
158
- 31, 34, 29, 33, 31, 35, 35, 35,
159
- 0
121
+ 28, 28, 28, 11, 11, 29, 11, 30,
122
+ 31, 3, 3, 3, 11, 11, 11, 11,
123
+ 11, 11, 11, 11, 11, 11, 11, 11,
124
+ 11, 11, 11, 11, 11, 11, 30, 11,
125
+ 4, 11, 11, 11, 11, 11, 11, 11,
126
+ 11, 11, 11, 11, 11, 11, 13, 13,
127
+ 13, 13, 13, 13, 13, 13, 13, 13,
128
+ 11, 11, 11, 11, 11, 11, 11, 13,
129
+ 13, 13, 13, 13, 13, 13, 13, 13,
130
+ 13, 13, 13, 13, 13, 13, 13, 13,
131
+ 13, 13, 13, 13, 13, 13, 13, 13,
132
+ 13, 11, 11, 11, 11, 13, 11, 13,
133
+ 13, 13, 13, 13, 13, 13, 13, 13,
134
+ 13, 13, 13, 13, 13, 13, 13, 13,
135
+ 13, 13, 13, 13, 13, 13, 13, 13,
136
+ 13, 11, 11, 32, 11, 3, 3, 3,
137
+ 3, 3, 2, 2, 2, 2, 2, 2,
138
+ 2, 2, 2, 2, 2, 2, 2, 2,
139
+ 2, 2, 2, 2, 3, 2, 4, 2,
140
+ 33, 34, 2, 2, 2, 2, 2, 2,
141
+ 2, 2, 2, 2, 2, 2, 2, 2,
142
+ 2, 2, 2, 2, 2, 2, 2, 33,
143
+ 2, 2, 2, 2, 2, 2, 2, 2,
144
+ 2, 2, 2, 35, 2, 2, 2, 2,
145
+ 2, 2, 2, 2, 2, 2, 2, 2,
146
+ 2, 2, 2, 2, 2, 2, 2, 2,
147
+ 2, 2, 2, 2, 2, 2, 2, 2,
148
+ 2, 2, 2, 2, 2, 2, 2, 2,
149
+ 2, 2, 2, 2, 2, 2, 2, 2,
150
+ 2, 2, 2, 2, 2, 2, 2, 2,
151
+ 2, 2, 2, 2, 2, 2, 2, 2,
152
+ 2, 2, 2, 2, 2, 2, 2, 2,
153
+ 2, 2, 2, 2, 2, 2, 2, 2,
154
+ 2, 2, 2, 2, 36, 2, 37, 38,
155
+ 1, 1, 1, 1, 1, 1, 1, 1,
156
+ 1, 1, 1, 1, 1, 1, 1, 1,
157
+ 1, 1, 1, 1, 1, 37, 1, 1,
158
+ 1, 1, 1, 1, 1, 1, 1, 1,
159
+ 1, 12, 1, 1, 1, 1, 1, 1,
160
+ 1, 1, 1, 1, 1, 1, 1, 1,
161
+ 1, 1, 1, 1, 1, 1, 1, 1,
162
+ 1, 1, 1, 1, 1, 1, 1, 1,
163
+ 1, 1, 1, 1, 1, 1, 1, 1,
164
+ 1, 1, 1, 1, 1, 1, 1, 1,
165
+ 1, 1, 1, 1, 1, 1, 1, 1,
166
+ 1, 1, 1, 1, 1, 1, 1, 1,
167
+ 1, 1, 1, 1, 1, 1, 1, 1,
168
+ 1, 1, 1, 1, 1, 1, 1, 1,
169
+ 1, 1, 32, 1, 1, 40, 41, 39,
170
+ 39, 39, 39, 39, 39, 39, 39, 39,
171
+ 39, 39, 39, 39, 39, 39, 39, 39,
172
+ 39, 39, 39, 39, 40, 39, 39, 39,
173
+ 39, 39, 39, 39, 39, 39, 39, 39,
174
+ 42, 39, 39, 39, 43, 43, 43, 43,
175
+ 43, 43, 43, 43, 43, 43, 39, 39,
176
+ 39, 39, 39, 39, 39, 43, 43, 43,
177
+ 43, 43, 43, 43, 43, 43, 43, 43,
178
+ 43, 43, 43, 43, 43, 43, 43, 43,
179
+ 43, 43, 43, 43, 43, 43, 43, 39,
180
+ 39, 39, 39, 43, 39, 43, 43, 43,
181
+ 43, 43, 43, 43, 43, 43, 43, 43,
182
+ 43, 43, 43, 43, 43, 43, 43, 43,
183
+ 43, 43, 43, 43, 43, 43, 43, 39,
184
+ 39, 44, 39, 45, 1, 47, 46, 46,
185
+ 46, 46, 46, 46, 46, 46, 46, 46,
186
+ 46, 46, 46, 46, 46, 46, 46, 46,
187
+ 46, 46, 46, 46, 46, 46, 46, 46,
188
+ 46, 46, 46, 46, 46, 46, 46, 46,
189
+ 46, 46, 46, 48, 48, 48, 48, 48,
190
+ 48, 48, 48, 48, 48, 46, 46, 46,
191
+ 46, 46, 46, 46, 48, 48, 48, 48,
192
+ 48, 48, 48, 48, 48, 48, 48, 48,
193
+ 48, 48, 48, 48, 48, 48, 48, 48,
194
+ 48, 48, 48, 48, 48, 48, 46, 46,
195
+ 46, 46, 48, 46, 48, 48, 48, 48,
196
+ 48, 48, 48, 48, 48, 48, 48, 48,
197
+ 48, 48, 48, 48, 48, 48, 48, 48,
198
+ 48, 48, 48, 48, 48, 48, 46, 46,
199
+ 15, 0
160
200
  ]
161
201
 
162
202
  class << self
@@ -164,11 +204,13 @@ class << self
164
204
  private :_bel_trans_targs, :_bel_trans_targs=
165
205
  end
166
206
  self._bel_trans_targs = [
167
- 0, 2, 0, 2, 3, 6, 7, 8,
168
- 3, 4, 9, 0, 5, 6, 8, 5,
169
- 6, 8, 6, 0, 5, 6, 7, 8,
170
- 16, 0, 11, 17, 11, 0, 13, 13,
171
- 14, 15, 18, 0
207
+ 12, 0, 0, 2, 3, 4, 15, 6,
208
+ 4, 15, 6, 0, 5, 18, 20, 0,
209
+ 8, 9, 10, 22, 11, 10, 22, 11,
210
+ 13, 14, 2, 3, 18, 19, 13, 14,
211
+ 19, 16, 17, 5, 19, 16, 17, 0,
212
+ 16, 17, 5, 18, 19, 17, 0, 21,
213
+ 20
172
214
  ]
173
215
 
174
216
  class << self
@@ -176,11 +218,13 @@ class << self
176
218
  private :_bel_trans_actions, :_bel_trans_actions=
177
219
  end
178
220
  self._bel_trans_actions = [
179
- 1, 2, 3, 4, 5, 6, 7, 8,
180
- 10, 10, 10, 9, 11, 12, 13, 0,
181
- 14, 15, 0, 16, 17, 18, 19, 20,
182
- 21, 22, 7, 23, 19, 24, 5, 10,
183
- 10, 10, 25, 0
221
+ 0, 0, 2, 0, 0, 4, 5, 4,
222
+ 0, 6, 0, 8, 0, 9, 9, 11,
223
+ 0, 0, 4, 13, 4, 0, 14, 0,
224
+ 16, 16, 16, 16, 17, 16, 0, 0,
225
+ 0, 21, 21, 21, 21, 0, 0, 24,
226
+ 25, 25, 25, 0, 25, 27, 29, 30,
227
+ 0
184
228
  ]
185
229
 
186
230
  class << self
@@ -188,9 +232,9 @@ class << self
188
232
  private :_bel_eof_actions, :_bel_eof_actions=
189
233
  end
190
234
  self._bel_eof_actions = [
191
- 0, 1, 3, 9, 9, 1, 3, 16,
192
- 1, 9, 22, 22, 24, 24, 24, 24,
193
- 0, 0, 0
235
+ 0, 0, 1, 3, 3, 7, 3, 0,
236
+ 10, 12, 12, 12, 15, 18, 19, 20,
237
+ 22, 22, 23, 26, 28, 31, 0
194
238
  ]
195
239
 
196
240
  class << self
@@ -200,24 +244,24 @@ self.bel_start = 1;
200
244
  class << self
201
245
  attr_accessor :bel_first_final
202
246
  end
203
- self.bel_first_final = 16;
247
+ self.bel_first_final = 12;
204
248
  class << self
205
249
  attr_accessor :bel_error
206
250
  end
207
251
  self.bel_error = 0;
208
252
 
209
253
  class << self
210
- attr_accessor :bel_en_ident
254
+ attr_accessor :bel_en_ident_node
211
255
  end
212
- self.bel_en_ident = 10;
256
+ self.bel_en_ident_node = 7;
213
257
  class << self
214
- attr_accessor :bel_en_string
258
+ attr_accessor :bel_en_string_node
215
259
  end
216
- self.bel_en_string = 12;
260
+ self.bel_en_string_node = 8;
217
261
  class << self
218
- attr_accessor :bel_en_list
262
+ attr_accessor :bel_en_list_node
219
263
  end
220
- self.bel_en_list = 1;
264
+ self.bel_en_list_node = 1;
221
265
 
222
266
 
223
267
  begin
@@ -262,506 +306,585 @@ begin
262
306
  cs = _bel_trans_targs[_trans]
263
307
  if _bel_trans_actions[_trans] != 0
264
308
  case _bel_trans_actions[_trans]
265
- when 19 then
309
+ when 9 then
266
310
  begin
267
311
 
268
- (@buffers[:ident] ||= []) << data[p].ord
312
+ trace('IDENTIFIER start_identifier')
313
+ @identifier_started = true
314
+ id_start = p;
269
315
  end
270
- when 10 then
316
+ when 30 then
271
317
  begin
272
318
 
273
- (@buffers[:string] ||= []) << data[p].ord
319
+ trace('IDENTIFIER end_identifier')
320
+ id_end = p
321
+ chars = data[id_start...id_end]
322
+ completed = !chars.empty?
323
+ ast_node = identifier(utf8_string(chars), complete: completed)
324
+ @buffers[:ident] = ast_node
274
325
  end
275
- when 14 then
326
+ when 24 then
276
327
  begin
277
328
 
278
- @buffers.delete(:string)
279
- @buffers.delete(:ident)
329
+ trace('IDENTIFIER an_ident_err')
330
+ id_end = p
331
+ chars = data[id_start...id_end]
332
+ ast_node = identifier(utf8_string(chars), complete: false)
333
+ @buffers[:ident] = ast_node
280
334
  end
281
- when 2 then
335
+ when 29 then
282
336
  begin
283
337
 
284
- @buffers[:list] = list()
338
+ trace('IDENTIFIER ident_node_err')
339
+ id_end = p
340
+ chars = data[id_start...id_end]
341
+ ast_node = identifier(utf8_string(chars), complete: false)
342
+ yield ast_node
285
343
  end
286
344
  when 4 then
287
345
  begin
288
346
 
289
- # Append list argument if its value is not empty.
290
- if @buffers[:list_arg]
291
- list_arg_value = @buffers[:list_arg].children[0].children[0]
292
- if list_arg_value != ''
293
- @buffers[:list] <<= @buffers[:list_arg]
294
- end
295
- end
296
- end
297
- when 15 then
298
- begin
299
-
300
- #TODO: Mark @buffers[:list] as complete.
301
- end
302
- when 21 then
303
- begin
304
-
305
- yield @buffers[:list]
306
- end
307
- when 1 then
308
- begin
309
-
310
- @buffers[:list] ||= list()
311
- yield @buffers[:list]
312
- end
313
- when 7 then
314
- begin
315
-
316
- @buffers[:ident] = []
317
- end
318
- begin
319
-
320
- (@buffers[:ident] ||= []) << data[p].ord
321
- end
322
- when 23 then
323
- begin
324
-
325
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
347
+ trace('STRING start_string')
348
+ @string_opened = true
349
+ p_start = p
326
350
  end
351
+ when 2 then
327
352
  begin
328
353
 
329
- yield @buffers[:ident]
354
+ trace('STRING a_string_err')
355
+ p_end = p
356
+ chars = data[p_start...p_end]
357
+ ast_node = string(utf8_string(chars), complete: false)
358
+ @buffers[:string] = ast_node
330
359
  end
331
- when 22 then
360
+ when 11 then
332
361
  begin
333
362
 
334
- unless @buffers[:ident].is_a?(::AST::Node)
335
- @buffers[:ident] ||= []
336
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
337
- end
363
+ trace('STRING string_node_err')
364
+ p_end = p
365
+ chars = data[p_start...p_end]
366
+ ast_node = string(utf8_string(chars), complete: false)
367
+ yield ast_node
338
368
  end
369
+ when 16 then
339
370
  begin
340
371
 
341
- @buffers[:ident] ||= []
342
- yield @buffers[:ident]
372
+ trace('LIST start_list')
373
+ @list_opened = true
374
+ @incomplete[:list] = list()
343
375
  end
344
- when 5 then
376
+ when 27 then
345
377
  begin
346
378
 
347
- @buffers[:string] = []
379
+ trace('LIST stop_list')
380
+ @list_closed = true
348
381
  end
382
+ when 21 then
349
383
  begin
350
384
 
351
- (@buffers[:string] ||= []) << data[p].ord
385
+ trace('LIST add_string')
386
+ string = @buffers.delete(:string)
387
+ item = list_item(string, complete: string.complete)
388
+ @incomplete[:list] <<= item
352
389
  end
353
390
  when 25 then
354
391
  begin
355
392
 
356
- @buffers[:string] = string(utf8_string(@buffers[:string]))
357
- end
358
- begin
359
-
360
- yield @buffers[:string]
361
- end
362
- when 24 then
363
- begin
364
-
365
- @buffers[:string] ||= []
366
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
393
+ trace('IDENTIFIER end_identifier')
394
+ id_end = p
395
+ chars = data[id_start...id_end]
396
+ completed = !chars.empty?
397
+ ast_node = identifier(utf8_string(chars), complete: completed)
398
+ @buffers[:ident] = ast_node
367
399
  end
368
400
  begin
369
401
 
370
- @buffers[:string] ||= []
371
- yield @buffers[:string]
402
+ trace('LIST add_ident')
403
+ ident = @buffers.delete(:ident)
404
+ item = list_item(ident, complete: ident.complete)
405
+ @incomplete[:list] <<= item
372
406
  end
373
407
  when 6 then
374
408
  begin
375
409
 
376
- # Append list argument if its value is not empty.
377
- if @buffers[:list_arg]
378
- list_arg_value = @buffers[:list_arg].children[0].children[0]
379
- if list_arg_value != ''
380
- @buffers[:list] <<= @buffers[:list_arg]
381
- end
382
- end
410
+ trace('STRING stop_string')
411
+ @string_closed = true
412
+ p_end = p
383
413
  end
384
414
  begin
385
415
 
386
- @buffers.delete(:string)
387
- @buffers.delete(:ident)
416
+ trace('STRING string_end')
417
+ completed = @string_opened && @string_closed
418
+ chars = data[p_start...p_end]
419
+ ast_node = string(utf8_string(chars), complete: true)
420
+ @buffers[:string] = ast_node
388
421
  end
389
422
  when 8 then
390
423
  begin
391
424
 
392
- # Append list argument if its value is not empty.
393
- if @buffers[:list_arg]
394
- list_arg_value = @buffers[:list_arg].children[0].children[0]
395
- if list_arg_value != ''
396
- @buffers[:list] <<= @buffers[:list_arg]
397
- end
398
- end
425
+ trace('STRING a_string_err')
426
+ p_end = p
427
+ chars = data[p_start...p_end]
428
+ ast_node = string(utf8_string(chars), complete: false)
429
+ @buffers[:string] = ast_node
399
430
  end
400
431
  begin
401
432
 
402
- #TODO: Mark @buffers[:list] as complete.
433
+ trace('IDENTIFIER an_ident_err')
434
+ id_end = p
435
+ chars = data[id_start...id_end]
436
+ ast_node = identifier(utf8_string(chars), complete: false)
437
+ @buffers[:ident] = ast_node
403
438
  end
404
439
  when 17 then
405
440
  begin
406
441
 
407
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
442
+ trace('LIST start_list')
443
+ @list_opened = true
444
+ @incomplete[:list] = list()
408
445
  end
409
446
  begin
410
447
 
411
- @buffers[:list_arg] = list_item(@buffers[:ident])
448
+ trace('IDENTIFIER start_identifier')
449
+ @identifier_started = true
450
+ id_start = p;
412
451
  end
452
+ when 5 then
413
453
  begin
414
454
 
415
- # Append list argument if its value is not empty.
416
- if @buffers[:list_arg]
417
- list_arg_value = @buffers[:list_arg].children[0].children[0]
418
- if list_arg_value != ''
419
- @buffers[:list] <<= @buffers[:list_arg]
420
- end
421
- end
455
+ trace('STRING start_string')
456
+ @string_opened = true
457
+ p_start = p
422
458
  end
423
- when 11 then
424
459
  begin
425
460
 
426
- @buffers[:string] = string(utf8_string(@buffers[:string]))
461
+ trace('STRING stop_string')
462
+ @string_closed = true
463
+ p_end = p
427
464
  end
428
465
  begin
429
466
 
430
- @buffers[:list_arg] = list_item(@buffers[:string])
467
+ trace('STRING string_end')
468
+ completed = @string_opened && @string_closed
469
+ chars = data[p_start...p_end]
470
+ ast_node = string(utf8_string(chars), complete: true)
471
+ @buffers[:string] = ast_node
431
472
  end
473
+ when 14 then
432
474
  begin
433
475
 
434
- # Append list argument if its value is not empty.
435
- if @buffers[:list_arg]
436
- list_arg_value = @buffers[:list_arg].children[0].children[0]
437
- if list_arg_value != ''
438
- @buffers[:list] <<= @buffers[:list_arg]
439
- end
440
- end
476
+ trace('STRING stop_string')
477
+ @string_closed = true
478
+ p_end = p
441
479
  end
442
- when 18 then
443
480
  begin
444
481
 
445
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
482
+ trace('STRING string_end')
483
+ completed = @string_opened && @string_closed
484
+ chars = data[p_start...p_end]
485
+ ast_node = string(utf8_string(chars), complete: true)
486
+ @buffers[:string] = ast_node
446
487
  end
447
488
  begin
448
489
 
449
- @buffers[:list_arg] = list_item(@buffers[:ident])
490
+ trace('STRING yield_string')
491
+ yield @buffers[:string]
450
492
  end
493
+ when 13 then
451
494
  begin
452
495
 
453
- # Append list argument if its value is not empty.
454
- if @buffers[:list_arg]
455
- list_arg_value = @buffers[:list_arg].children[0].children[0]
456
- if list_arg_value != ''
457
- @buffers[:list] <<= @buffers[:list_arg]
458
- end
459
- end
496
+ trace('STRING start_string')
497
+ @string_opened = true
498
+ p_start = p
460
499
  end
461
500
  begin
462
501
 
463
- @buffers.delete(:string)
464
- @buffers.delete(:ident)
502
+ trace('STRING stop_string')
503
+ @string_closed = true
504
+ p_end = p
465
505
  end
466
- when 20 then
467
506
  begin
468
507
 
469
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
508
+ trace('STRING string_end')
509
+ completed = @string_opened && @string_closed
510
+ chars = data[p_start...p_end]
511
+ ast_node = string(utf8_string(chars), complete: true)
512
+ @buffers[:string] = ast_node
470
513
  end
471
514
  begin
472
515
 
473
- @buffers[:list_arg] = list_item(@buffers[:ident])
516
+ trace('STRING yield_string')
517
+ yield @buffers[:string]
474
518
  end
519
+ end
520
+ end
521
+ end
522
+ if _goto_level <= _again
523
+ if cs == 0
524
+ _goto_level = _out
525
+ next
526
+ end
527
+ p += 1
528
+ if p != pe
529
+ _goto_level = _resume
530
+ next
531
+ end
532
+ end
533
+ if _goto_level <= _test_eof
534
+ if p == eof
535
+ case _bel_eof_actions[cs]
536
+ when 31 then
475
537
  begin
476
538
 
477
- # Append list argument if its value is not empty.
478
- if @buffers[:list_arg]
479
- list_arg_value = @buffers[:list_arg].children[0].children[0]
480
- if list_arg_value != ''
481
- @buffers[:list] <<= @buffers[:list_arg]
482
- end
483
- end
539
+ trace('IDENTIFIER yield_identifier')
540
+ yield @buffers[:ident]
484
541
  end
542
+ when 28 then
485
543
  begin
486
544
 
487
- #TODO: Mark @buffers[:list] as complete.
545
+ trace('IDENTIFIER end_identifier')
546
+ id_end = p
547
+ chars = data[id_start...id_end]
548
+ completed = !chars.empty?
549
+ ast_node = identifier(utf8_string(chars), complete: completed)
550
+ @buffers[:ident] = ast_node
488
551
  end
489
- when 16 then
490
552
  begin
491
553
 
492
- unless @buffers[:ident].is_a?(::AST::Node)
493
- @buffers[:ident] ||= []
494
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
495
- end
554
+ trace('IDENTIFIER yield_identifier')
555
+ yield @buffers[:ident]
496
556
  end
557
+ when 1 then
497
558
  begin
498
559
 
499
- #TODO: Mark @buffers[:list_arg] identifier as error.
500
- @buffers[:list_arg] = list_item(@buffers[:ident])
560
+ trace('STRING a_string_err')
561
+ p_end = p
562
+ chars = data[p_start...p_end]
563
+ ast_node = string(utf8_string(chars), complete: false)
564
+ @buffers[:string] = ast_node
501
565
  end
502
566
  begin
503
567
 
504
- # Append list argument if its value is not empty.
505
- if @buffers[:list_arg]
506
- list_arg_value = @buffers[:list_arg].children[0].children[0]
507
- if list_arg_value != ''
508
- @buffers[:list] <<= @buffers[:list_arg]
509
- end
510
- end
568
+ trace('LIST list_node_eof')
569
+ list = @incomplete.delete(:list)
570
+ string = @buffers.delete(:string)
571
+ item = list_item(string, complete: string.complete)
572
+ list <<= item
573
+ list.complete = false
574
+ yield list
511
575
  end
576
+ when 10 then
512
577
  begin
513
578
 
514
- @buffers[:list] ||= list()
515
- yield @buffers[:list]
579
+ trace('STRING string_node_err')
580
+ p_end = p
581
+ chars = data[p_start...p_end]
582
+ ast_node = string(utf8_string(chars), complete: false)
583
+ yield ast_node
516
584
  end
517
- when 12 then
518
585
  begin
519
586
 
520
- @buffers[:string] = string(utf8_string(@buffers[:string]))
587
+ trace('STRING string_node_eof')
588
+ yield @buffers[:string]
521
589
  end
590
+ when 22 then
522
591
  begin
523
592
 
524
- @buffers[:list_arg] = list_item(@buffers[:string])
593
+ trace('LIST list_end')
594
+ if @list_opened && @list_closed
595
+ list = @incomplete.delete(:list)
596
+ list.complete = true
597
+ elsif !@list_closed
598
+ list = @incomplete.delete(:list)
599
+ list.complete = false
600
+ end
601
+ @buffers[:list] = list
525
602
  end
526
603
  begin
527
604
 
528
- # Append list argument if its value is not empty.
529
- if @buffers[:list_arg]
530
- list_arg_value = @buffers[:list_arg].children[0].children[0]
531
- if list_arg_value != ''
532
- @buffers[:list] <<= @buffers[:list_arg]
533
- end
534
- end
605
+ trace('LIST yield_list')
606
+ yield @buffers[:list]
535
607
  end
608
+ when 3 then
536
609
  begin
537
610
 
538
- @buffers.delete(:string)
539
- @buffers.delete(:ident)
611
+ trace('STRING eof_string')
612
+ p_end = p
613
+ chars = data[p_start...p_end]
614
+ ast_node = string(utf8_string(chars), complete: false)
615
+ @buffers[:string] = ast_node
540
616
  end
541
- when 13 then
542
617
  begin
543
618
 
544
- @buffers[:string] = string(utf8_string(@buffers[:string]))
619
+ trace('STRING a_string_err')
620
+ p_end = p
621
+ chars = data[p_start...p_end]
622
+ ast_node = string(utf8_string(chars), complete: false)
623
+ @buffers[:string] = ast_node
545
624
  end
546
625
  begin
547
626
 
548
- @buffers[:list_arg] = list_item(@buffers[:string])
627
+ trace('LIST list_node_eof')
628
+ list = @incomplete.delete(:list)
629
+ string = @buffers.delete(:string)
630
+ item = list_item(string, complete: string.complete)
631
+ list <<= item
632
+ list.complete = false
633
+ yield list
549
634
  end
635
+ when 12 then
550
636
  begin
551
637
 
552
- # Append list argument if its value is not empty.
553
- if @buffers[:list_arg]
554
- list_arg_value = @buffers[:list_arg].children[0].children[0]
555
- if list_arg_value != ''
556
- @buffers[:list] <<= @buffers[:list_arg]
557
- end
558
- end
638
+ trace('STRING eof_string')
639
+ p_end = p
640
+ chars = data[p_start...p_end]
641
+ ast_node = string(utf8_string(chars), complete: false)
642
+ @buffers[:string] = ast_node
559
643
  end
560
644
  begin
561
645
 
562
- #TODO: Mark @buffers[:list] as complete.
646
+ trace('STRING string_node_err')
647
+ p_end = p
648
+ chars = data[p_start...p_end]
649
+ ast_node = string(utf8_string(chars), complete: false)
650
+ yield ast_node
563
651
  end
564
- when 9 then
565
652
  begin
566
653
 
567
- @buffers[:string] ||= []
568
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
654
+ trace('STRING string_node_eof')
655
+ yield @buffers[:string]
569
656
  end
657
+ when 26 then
570
658
  begin
571
659
 
572
- #TODO: Mark @buffers[:list_arg] string as error.
573
- @buffers[:list_arg] = list_item(@buffers[:string])
660
+ trace('LIST stop_list')
661
+ @list_closed = true
574
662
  end
575
663
  begin
576
664
 
577
- # Append list argument if its value is not empty.
578
- if @buffers[:list_arg]
579
- list_arg_value = @buffers[:list_arg].children[0].children[0]
580
- if list_arg_value != ''
581
- @buffers[:list] <<= @buffers[:list_arg]
582
- end
665
+ trace('LIST list_end')
666
+ if @list_opened && @list_closed
667
+ list = @incomplete.delete(:list)
668
+ list.complete = true
669
+ elsif !@list_closed
670
+ list = @incomplete.delete(:list)
671
+ list.complete = false
583
672
  end
673
+ @buffers[:list] = list
584
674
  end
585
675
  begin
586
676
 
587
- @buffers[:list] ||= list()
677
+ trace('LIST yield_list')
588
678
  yield @buffers[:list]
589
679
  end
590
- when 3 then
591
- begin
592
-
593
- @buffers[:string] ||= []
594
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
595
- end
680
+ when 20 then
596
681
  begin
597
682
 
598
- #TODO: Mark @buffers[:list_arg] string as error.
599
- @buffers[:list_arg] = list_item(@buffers[:string])
683
+ trace('LIST add_string')
684
+ string = @buffers.delete(:string)
685
+ item = list_item(string, complete: string.complete)
686
+ @incomplete[:list] <<= item
600
687
  end
601
688
  begin
602
689
 
603
- unless @buffers[:ident].is_a?(::AST::Node)
604
- @buffers[:ident] ||= []
605
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
690
+ trace('LIST list_end')
691
+ if @list_opened && @list_closed
692
+ list = @incomplete.delete(:list)
693
+ list.complete = true
694
+ elsif !@list_closed
695
+ list = @incomplete.delete(:list)
696
+ list.complete = false
606
697
  end
698
+ @buffers[:list] = list
607
699
  end
608
700
  begin
609
701
 
610
- #TODO: Mark @buffers[:list_arg] identifier as error.
611
- @buffers[:list_arg] = list_item(@buffers[:ident])
702
+ trace('LIST yield_list')
703
+ yield @buffers[:list]
612
704
  end
705
+ when 19 then
613
706
  begin
614
707
 
615
- # Append list argument if its value is not empty.
616
- if @buffers[:list_arg]
617
- list_arg_value = @buffers[:list_arg].children[0].children[0]
618
- if list_arg_value != ''
619
- @buffers[:list] <<= @buffers[:list_arg]
620
- end
621
- end
708
+ trace('LIST list_node_eof')
709
+ list = @incomplete.delete(:list)
710
+ string = @buffers.delete(:string)
711
+ item = list_item(string, complete: string.complete)
712
+ list <<= item
713
+ list.complete = false
714
+ yield list
622
715
  end
623
716
  begin
624
717
 
625
- @buffers[:list] ||= list()
626
- yield @buffers[:list]
718
+ trace('LIST list_end')
719
+ if @list_opened && @list_closed
720
+ list = @incomplete.delete(:list)
721
+ list.complete = true
722
+ elsif !@list_closed
723
+ list = @incomplete.delete(:list)
724
+ list.complete = false
725
+ end
726
+ @buffers[:list] = list
627
727
  end
628
- end
629
- end
630
- end
631
- if _goto_level <= _again
632
- if cs == 0
633
- _goto_level = _out
634
- next
635
- end
636
- p += 1
637
- if p != pe
638
- _goto_level = _resume
639
- next
640
- end
641
- end
642
- if _goto_level <= _test_eof
643
- if p == eof
644
- case _bel_eof_actions[cs]
645
- when 1 then
646
728
  begin
647
729
 
648
- @buffers[:list] ||= list()
730
+ trace('LIST yield_list')
649
731
  yield @buffers[:list]
650
732
  end
651
- when 22 then
733
+ when 18 then
652
734
  begin
653
735
 
654
- unless @buffers[:ident].is_a?(::AST::Node)
655
- @buffers[:ident] ||= []
656
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
736
+ trace('IDENTIFIER an_ident_eof')
737
+ if @identifier_started
738
+ id_end = p
739
+ chars = data[id_start...id_end]
740
+ completed = !chars.empty?
741
+ ast_node = identifier(utf8_string(chars), complete: completed)
742
+ @buffers[:ident] = ast_node
657
743
  end
658
744
  end
659
745
  begin
660
746
 
661
- @buffers[:ident] ||= []
662
- yield @buffers[:ident]
663
- end
664
- when 24 then
665
- begin
666
-
667
- @buffers[:string] ||= []
668
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
747
+ trace('LIST list_node_eof')
748
+ list = @incomplete.delete(:list)
749
+ string = @buffers.delete(:string)
750
+ item = list_item(string, complete: string.complete)
751
+ list <<= item
752
+ list.complete = false
753
+ yield list
669
754
  end
670
755
  begin
671
756
 
672
- @buffers[:string] ||= []
673
- yield @buffers[:string]
757
+ trace('LIST list_end')
758
+ if @list_opened && @list_closed
759
+ list = @incomplete.delete(:list)
760
+ list.complete = true
761
+ elsif !@list_closed
762
+ list = @incomplete.delete(:list)
763
+ list.complete = false
764
+ end
765
+ @buffers[:list] = list
674
766
  end
675
- when 16 then
676
767
  begin
677
768
 
678
- unless @buffers[:ident].is_a?(::AST::Node)
679
- @buffers[:ident] ||= []
680
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
681
- end
769
+ trace('LIST yield_list')
770
+ yield @buffers[:list]
682
771
  end
772
+ when 7 then
683
773
  begin
684
774
 
685
- #TODO: Mark @buffers[:list_arg] identifier as error.
686
- @buffers[:list_arg] = list_item(@buffers[:ident])
775
+ trace('STRING a_string_err')
776
+ p_end = p
777
+ chars = data[p_start...p_end]
778
+ ast_node = string(utf8_string(chars), complete: false)
779
+ @buffers[:string] = ast_node
687
780
  end
688
781
  begin
689
782
 
690
- # Append list argument if its value is not empty.
691
- if @buffers[:list_arg]
692
- list_arg_value = @buffers[:list_arg].children[0].children[0]
693
- if list_arg_value != ''
694
- @buffers[:list] <<= @buffers[:list_arg]
695
- end
783
+ trace('IDENTIFIER an_ident_eof')
784
+ if @identifier_started
785
+ id_end = p
786
+ chars = data[id_start...id_end]
787
+ completed = !chars.empty?
788
+ ast_node = identifier(utf8_string(chars), complete: completed)
789
+ @buffers[:ident] = ast_node
696
790
  end
697
791
  end
698
792
  begin
699
793
 
700
- @buffers[:list] ||= list()
701
- yield @buffers[:list]
794
+ trace('IDENTIFIER an_ident_err')
795
+ id_end = p
796
+ chars = data[id_start...id_end]
797
+ ast_node = identifier(utf8_string(chars), complete: false)
798
+ @buffers[:ident] = ast_node
702
799
  end
703
- when 9 then
704
800
  begin
705
801
 
706
- @buffers[:string] ||= []
707
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
802
+ trace('LIST list_node_eof')
803
+ list = @incomplete.delete(:list)
804
+ string = @buffers.delete(:string)
805
+ item = list_item(string, complete: string.complete)
806
+ list <<= item
807
+ list.complete = false
808
+ yield list
708
809
  end
810
+ when 15 then
709
811
  begin
710
812
 
711
- #TODO: Mark @buffers[:list_arg] string as error.
712
- @buffers[:list_arg] = list_item(@buffers[:string])
813
+ trace('LIST start_list')
814
+ @list_opened = true
815
+ @incomplete[:list] = list()
713
816
  end
714
817
  begin
715
818
 
716
- # Append list argument if its value is not empty.
717
- if @buffers[:list_arg]
718
- list_arg_value = @buffers[:list_arg].children[0].children[0]
719
- if list_arg_value != ''
720
- @buffers[:list] <<= @buffers[:list_arg]
721
- end
819
+ trace('IDENTIFIER an_ident_eof')
820
+ if @identifier_started
821
+ id_end = p
822
+ chars = data[id_start...id_end]
823
+ completed = !chars.empty?
824
+ ast_node = identifier(utf8_string(chars), complete: completed)
825
+ @buffers[:ident] = ast_node
722
826
  end
723
827
  end
724
828
  begin
725
829
 
726
- @buffers[:list] ||= list()
727
- yield @buffers[:list]
830
+ trace('LIST list_end')
831
+ if @list_opened && @list_closed
832
+ list = @incomplete.delete(:list)
833
+ list.complete = true
834
+ elsif !@list_closed
835
+ list = @incomplete.delete(:list)
836
+ list.complete = false
837
+ end
838
+ @buffers[:list] = list
728
839
  end
729
- when 3 then
730
840
  begin
731
841
 
732
- @buffers[:string] ||= []
733
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
842
+ trace('LIST yield_list')
843
+ yield @buffers[:list]
734
844
  end
845
+ when 23 then
735
846
  begin
736
847
 
737
- #TODO: Mark @buffers[:list_arg] string as error.
738
- @buffers[:list_arg] = list_item(@buffers[:string])
848
+ trace('IDENTIFIER end_identifier')
849
+ id_end = p
850
+ chars = data[id_start...id_end]
851
+ completed = !chars.empty?
852
+ ast_node = identifier(utf8_string(chars), complete: completed)
853
+ @buffers[:ident] = ast_node
739
854
  end
740
855
  begin
741
856
 
742
- unless @buffers[:ident].is_a?(::AST::Node)
743
- @buffers[:ident] ||= []
744
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
857
+ trace('IDENTIFIER an_ident_eof')
858
+ if @identifier_started
859
+ id_end = p
860
+ chars = data[id_start...id_end]
861
+ completed = !chars.empty?
862
+ ast_node = identifier(utf8_string(chars), complete: completed)
863
+ @buffers[:ident] = ast_node
745
864
  end
746
865
  end
747
866
  begin
748
867
 
749
- #TODO: Mark @buffers[:list_arg] identifier as error.
750
- @buffers[:list_arg] = list_item(@buffers[:ident])
868
+ trace('LIST add_ident')
869
+ ident = @buffers.delete(:ident)
870
+ item = list_item(ident, complete: ident.complete)
871
+ @incomplete[:list] <<= item
751
872
  end
752
873
  begin
753
874
 
754
- # Append list argument if its value is not empty.
755
- if @buffers[:list_arg]
756
- list_arg_value = @buffers[:list_arg].children[0].children[0]
757
- if list_arg_value != ''
758
- @buffers[:list] <<= @buffers[:list_arg]
759
- end
875
+ trace('LIST list_end')
876
+ if @list_opened && @list_closed
877
+ list = @incomplete.delete(:list)
878
+ list.complete = true
879
+ elsif !@list_closed
880
+ list = @incomplete.delete(:list)
881
+ list.complete = false
760
882
  end
883
+ @buffers[:list] = list
761
884
  end
762
885
  begin
763
886
 
764
- @buffers[:list] ||= list()
887
+ trace('LIST yield_list')
765
888
  yield @buffers[:list]
766
889
  end
767
890
  end
@@ -779,14 +902,15 @@ class << self
779
902
  private :_bel_trans_keys, :_bel_trans_keys=
780
903
  end
781
904
  self._bel_trans_keys = [
782
- 0, 0, 123, 123, 9, 125,
783
- 34, 92, 9, 125, 9,
784
- 125, 9, 122, 9, 125,
785
- 10, 10, 92, 92, 48, 122,
786
- 10, 122, 34, 34, 34,
787
- 92, 10, 10, 92, 92,
788
- 0, 0, 0, 0, 0, 0,
789
- 0
905
+ 0, 0, 123, 123, 9, 34,
906
+ 34, 92, 34, 92, 9,
907
+ 122, 0, 0, 48, 122,
908
+ 9, 34, 34, 92, 34, 92,
909
+ 0, 0, 9, 125, 9,
910
+ 125, 9, 34, 9, 125,
911
+ 9, 125, 0, 0, 9, 125,
912
+ 10, 10, 10, 122, 0,
913
+ 0, 0, 0, 0
790
914
  ]
791
915
 
792
916
  class << self
@@ -794,9 +918,9 @@ class << self
794
918
  private :_bel_key_spans, :_bel_key_spans=
795
919
  end
796
920
  self._bel_key_spans = [
797
- 0, 1, 117, 59, 117, 117, 114, 117,
798
- 1, 1, 75, 113, 1, 59, 1, 1,
799
- 0, 0, 0
921
+ 0, 1, 26, 59, 59, 114, 0, 75,
922
+ 26, 59, 59, 0, 117, 117, 26, 117,
923
+ 117, 0, 117, 1, 113, 0, 0
800
924
  ]
801
925
 
802
926
  class << self
@@ -804,9 +928,9 @@ class << self
804
928
  private :_bel_index_offsets, :_bel_index_offsets=
805
929
  end
806
930
  self._bel_index_offsets = [
807
- 0, 0, 2, 120, 180, 298, 416, 531,
808
- 649, 651, 653, 729, 843, 845, 905, 907,
809
- 909, 910, 911
931
+ 0, 0, 2, 29, 89, 149, 264, 265,
932
+ 341, 368, 428, 488, 489, 607, 725, 752,
933
+ 870, 988, 989, 1107, 1109, 1223, 1224
810
934
  ]
811
935
 
812
936
  class << self
@@ -814,121 +938,160 @@ class << self
814
938
  private :_bel_indicies, :_bel_indicies=
815
939
  end
816
940
  self._bel_indicies = [
817
- 1, 0, 3, 2, 2, 2, 2, 2,
941
+ 0, 1, 3, 3, 3, 3, 3, 2,
818
942
  2, 2, 2, 2, 2, 2, 2, 2,
819
943
  2, 2, 2, 2, 2, 2, 2, 2,
820
- 2, 3, 2, 4, 2, 2, 2, 2,
821
- 2, 2, 2, 2, 2, 5, 2, 2,
822
- 2, 6, 6, 6, 6, 6, 6, 6,
823
- 6, 6, 6, 2, 2, 2, 2, 2,
824
- 2, 2, 6, 6, 6, 6, 6, 6,
825
- 6, 6, 6, 6, 6, 6, 6, 6,
826
- 6, 6, 6, 6, 6, 6, 6, 6,
827
- 6, 6, 6, 6, 2, 2, 2, 2,
828
- 6, 2, 6, 6, 6, 6, 6, 6,
829
- 6, 6, 6, 6, 6, 6, 6, 6,
830
- 6, 6, 6, 6, 6, 6, 6, 6,
831
- 6, 6, 6, 6, 2, 2, 7, 2,
832
- 9, 8, 8, 8, 8, 8, 8, 8,
944
+ 2, 3, 2, 4, 2, 6, 5, 5,
945
+ 5, 5, 5, 5, 5, 5, 5, 5,
946
+ 5, 5, 5, 5, 5, 5, 5, 5,
947
+ 5, 5, 5, 5, 5, 5, 5, 5,
948
+ 5, 5, 5, 5, 5, 5, 5, 5,
949
+ 5, 5, 5, 5, 5, 5, 5, 5,
950
+ 5, 5, 5, 5, 5, 5, 5, 5,
951
+ 5, 5, 5, 5, 5, 5, 5, 7,
952
+ 5, 9, 8, 8, 8, 8, 8, 8,
833
953
  8, 8, 8, 8, 8, 8, 8, 8,
834
954
  8, 8, 8, 8, 8, 8, 8, 8,
835
955
  8, 8, 8, 8, 8, 8, 8, 8,
836
956
  8, 8, 8, 8, 8, 8, 8, 8,
837
957
  8, 8, 8, 8, 8, 8, 8, 8,
838
958
  8, 8, 8, 8, 8, 8, 8, 8,
839
- 8, 8, 10, 8, 12, 11, 11, 11,
840
- 11, 11, 11, 11, 11, 11, 11, 11,
841
- 11, 11, 11, 11, 11, 11, 11, 11,
842
- 11, 11, 11, 12, 11, 11, 11, 11,
843
- 11, 11, 11, 11, 11, 11, 11, 13,
844
- 11, 11, 11, 11, 11, 11, 11, 11,
845
- 11, 11, 11, 11, 11, 11, 11, 11,
846
- 11, 11, 11, 11, 11, 11, 11, 11,
959
+ 8, 8, 8, 10, 8, 12, 3, 3,
960
+ 3, 3, 11, 11, 11, 11, 11, 11,
847
961
  11, 11, 11, 11, 11, 11, 11, 11,
962
+ 11, 11, 11, 11, 12, 11, 4, 11,
848
963
  11, 11, 11, 11, 11, 11, 11, 11,
964
+ 11, 11, 11, 11, 13, 13, 13, 13,
965
+ 13, 13, 13, 13, 13, 13, 11, 11,
966
+ 11, 11, 11, 11, 11, 13, 13, 13,
967
+ 13, 13, 13, 13, 13, 13, 13, 13,
968
+ 13, 13, 13, 13, 13, 13, 13, 13,
969
+ 13, 13, 13, 13, 13, 13, 13, 11,
970
+ 11, 11, 11, 13, 11, 13, 13, 13,
971
+ 13, 13, 13, 13, 13, 13, 13, 13,
972
+ 13, 13, 13, 13, 13, 13, 13, 13,
973
+ 13, 13, 13, 13, 13, 13, 13, 11,
974
+ 8, 14, 14, 14, 14, 14, 14, 14,
975
+ 14, 14, 14, 1, 1, 1, 1, 1,
976
+ 1, 1, 14, 14, 14, 14, 14, 14,
977
+ 14, 14, 14, 14, 14, 14, 14, 14,
978
+ 14, 14, 14, 14, 14, 14, 14, 14,
979
+ 14, 14, 14, 14, 1, 1, 1, 1,
980
+ 14, 1, 14, 14, 14, 14, 14, 14,
981
+ 14, 14, 14, 14, 14, 14, 14, 14,
982
+ 14, 14, 14, 14, 14, 14, 14, 14,
983
+ 14, 14, 14, 14, 1, 16, 16, 16,
984
+ 16, 16, 15, 15, 15, 15, 15, 15,
985
+ 15, 15, 15, 15, 15, 15, 15, 15,
986
+ 15, 15, 15, 15, 16, 15, 17, 15,
987
+ 19, 18, 18, 18, 18, 18, 18, 18,
988
+ 18, 18, 18, 18, 18, 18, 18, 18,
989
+ 18, 18, 18, 18, 18, 18, 18, 18,
990
+ 18, 18, 18, 18, 18, 18, 18, 18,
991
+ 18, 18, 18, 18, 18, 18, 18, 18,
992
+ 18, 18, 18, 18, 18, 18, 18, 18,
993
+ 18, 18, 18, 18, 18, 18, 18, 18,
994
+ 18, 18, 20, 18, 22, 21, 21, 21,
995
+ 21, 21, 21, 21, 21, 21, 21, 21,
996
+ 21, 21, 21, 21, 21, 21, 21, 21,
997
+ 21, 21, 21, 21, 21, 21, 21, 21,
998
+ 21, 21, 21, 21, 21, 21, 21, 21,
999
+ 21, 21, 21, 21, 21, 21, 21, 21,
1000
+ 21, 21, 21, 21, 21, 21, 21, 21,
1001
+ 21, 21, 21, 21, 21, 21, 23, 21,
1002
+ 21, 24, 25, 26, 26, 26, 11, 11,
849
1003
  11, 11, 11, 11, 11, 11, 11, 11,
850
1004
  11, 11, 11, 11, 11, 11, 11, 11,
1005
+ 24, 11, 27, 11, 11, 11, 11, 11,
851
1006
  11, 11, 11, 11, 11, 11, 11, 11,
852
- 11, 11, 11, 11, 11, 11, 11, 11,
853
- 11, 11, 11, 11, 11, 11, 11, 11,
854
- 14, 11, 15, 0, 0, 0, 0, 0,
855
- 0, 0, 0, 0, 0, 0, 0, 0,
856
- 0, 0, 0, 0, 0, 0, 0, 0,
857
- 0, 15, 0, 0, 0, 0, 0, 0,
858
- 0, 0, 0, 0, 0, 16, 0, 0,
859
- 0, 0, 0, 0, 0, 0, 0, 0,
860
- 0, 0, 0, 0, 0, 0, 0, 0,
861
- 0, 0, 0, 0, 0, 0, 0, 0,
862
- 0, 0, 0, 0, 0, 0, 0, 0,
863
- 0, 0, 0, 0, 0, 0, 0, 0,
864
- 0, 0, 0, 0, 0, 0, 0, 0,
865
- 0, 0, 0, 0, 0, 0, 0, 0,
866
- 0, 0, 0, 0, 0, 0, 0, 0,
867
- 0, 0, 0, 0, 0, 0, 0, 0,
868
- 0, 0, 0, 0, 0, 0, 17, 0,
869
- 18, 2, 2, 2, 2, 2, 2, 2,
870
- 2, 2, 2, 2, 2, 2, 2, 2,
871
- 2, 2, 2, 2, 2, 2, 2, 18,
872
- 2, 4, 2, 2, 2, 2, 2, 2,
873
- 2, 2, 2, 2, 2, 2, 2, 6,
874
- 6, 6, 6, 6, 6, 6, 6, 6,
875
- 6, 2, 2, 2, 2, 2, 2, 2,
876
- 6, 6, 6, 6, 6, 6, 6, 6,
877
- 6, 6, 6, 6, 6, 6, 6, 6,
878
- 6, 6, 6, 6, 6, 6, 6, 6,
879
- 6, 6, 2, 2, 2, 2, 6, 2,
880
- 6, 6, 6, 6, 6, 6, 6, 6,
881
- 6, 6, 6, 6, 6, 6, 6, 6,
882
- 6, 6, 6, 6, 6, 6, 6, 6,
883
- 6, 6, 2, 20, 19, 19, 19, 19,
884
- 19, 19, 19, 19, 19, 19, 19, 19,
885
- 19, 19, 19, 19, 19, 19, 19, 19,
886
- 19, 19, 20, 19, 19, 19, 19, 19,
887
- 19, 19, 19, 19, 19, 19, 21, 19,
888
- 19, 19, 22, 22, 22, 22, 22, 22,
889
- 22, 22, 22, 22, 19, 19, 19, 19,
890
- 19, 19, 19, 22, 22, 22, 22, 22,
891
- 22, 22, 22, 22, 22, 22, 22, 22,
892
- 22, 22, 22, 22, 22, 22, 22, 22,
893
- 22, 22, 22, 22, 22, 19, 19, 19,
894
- 19, 22, 19, 22, 22, 22, 22, 22,
895
- 22, 22, 22, 22, 22, 22, 22, 22,
896
- 22, 22, 22, 22, 22, 22, 22, 22,
897
- 22, 22, 22, 22, 22, 19, 19, 23,
898
- 19, 24, 0, 10, 8, 26, 26, 26,
899
- 26, 26, 26, 26, 26, 26, 26, 25,
900
- 25, 25, 25, 25, 25, 25, 26, 26,
901
- 26, 26, 26, 26, 26, 26, 26, 26,
902
- 26, 26, 26, 26, 26, 26, 26, 26,
903
- 26, 26, 26, 26, 26, 26, 26, 26,
904
- 25, 25, 25, 25, 26, 25, 26, 26,
905
- 26, 26, 26, 26, 26, 26, 26, 26,
906
- 26, 26, 26, 26, 26, 26, 26, 26,
907
- 26, 26, 26, 26, 26, 26, 26, 26,
908
- 25, 27, 25, 25, 25, 25, 25, 25,
909
- 25, 25, 25, 25, 25, 25, 25, 25,
910
- 25, 25, 25, 25, 25, 25, 25, 25,
911
- 25, 25, 25, 25, 25, 25, 25, 25,
912
- 25, 25, 25, 25, 25, 25, 25, 28,
913
- 28, 28, 28, 28, 28, 28, 28, 28,
914
- 28, 25, 25, 25, 25, 25, 25, 25,
915
1007
  28, 28, 28, 28, 28, 28, 28, 28,
1008
+ 28, 28, 11, 11, 11, 11, 11, 11,
1009
+ 11, 28, 28, 28, 28, 28, 28, 28,
916
1010
  28, 28, 28, 28, 28, 28, 28, 28,
917
1011
  28, 28, 28, 28, 28, 28, 28, 28,
918
- 28, 28, 25, 25, 25, 25, 28, 25,
1012
+ 28, 28, 28, 11, 11, 11, 11, 28,
1013
+ 11, 28, 28, 28, 28, 28, 28, 28,
919
1014
  28, 28, 28, 28, 28, 28, 28, 28,
920
1015
  28, 28, 28, 28, 28, 28, 28, 28,
921
- 28, 28, 28, 28, 28, 28, 28, 28,
922
- 28, 28, 25, 30, 29, 32, 31, 31,
923
- 31, 31, 31, 31, 31, 31, 31, 31,
924
- 31, 31, 31, 31, 31, 31, 31, 31,
925
- 31, 31, 31, 31, 31, 31, 31, 31,
926
- 31, 31, 31, 31, 31, 31, 31, 31,
927
- 31, 31, 31, 31, 31, 31, 31, 31,
928
- 31, 31, 31, 31, 31, 31, 31, 31,
929
- 31, 31, 31, 31, 31, 31, 31, 33,
930
- 31, 34, 29, 33, 31, 35, 35, 35,
931
- 0
1016
+ 28, 28, 28, 11, 11, 29, 11, 30,
1017
+ 31, 3, 3, 3, 11, 11, 11, 11,
1018
+ 11, 11, 11, 11, 11, 11, 11, 11,
1019
+ 11, 11, 11, 11, 11, 11, 30, 11,
1020
+ 4, 11, 11, 11, 11, 11, 11, 11,
1021
+ 11, 11, 11, 11, 11, 11, 13, 13,
1022
+ 13, 13, 13, 13, 13, 13, 13, 13,
1023
+ 11, 11, 11, 11, 11, 11, 11, 13,
1024
+ 13, 13, 13, 13, 13, 13, 13, 13,
1025
+ 13, 13, 13, 13, 13, 13, 13, 13,
1026
+ 13, 13, 13, 13, 13, 13, 13, 13,
1027
+ 13, 11, 11, 11, 11, 13, 11, 13,
1028
+ 13, 13, 13, 13, 13, 13, 13, 13,
1029
+ 13, 13, 13, 13, 13, 13, 13, 13,
1030
+ 13, 13, 13, 13, 13, 13, 13, 13,
1031
+ 13, 11, 11, 32, 11, 3, 3, 3,
1032
+ 3, 3, 2, 2, 2, 2, 2, 2,
1033
+ 2, 2, 2, 2, 2, 2, 2, 2,
1034
+ 2, 2, 2, 2, 3, 2, 4, 2,
1035
+ 33, 34, 2, 2, 2, 2, 2, 2,
1036
+ 2, 2, 2, 2, 2, 2, 2, 2,
1037
+ 2, 2, 2, 2, 2, 2, 2, 33,
1038
+ 2, 2, 2, 2, 2, 2, 2, 2,
1039
+ 2, 2, 2, 35, 2, 2, 2, 2,
1040
+ 2, 2, 2, 2, 2, 2, 2, 2,
1041
+ 2, 2, 2, 2, 2, 2, 2, 2,
1042
+ 2, 2, 2, 2, 2, 2, 2, 2,
1043
+ 2, 2, 2, 2, 2, 2, 2, 2,
1044
+ 2, 2, 2, 2, 2, 2, 2, 2,
1045
+ 2, 2, 2, 2, 2, 2, 2, 2,
1046
+ 2, 2, 2, 2, 2, 2, 2, 2,
1047
+ 2, 2, 2, 2, 2, 2, 2, 2,
1048
+ 2, 2, 2, 2, 2, 2, 2, 2,
1049
+ 2, 2, 2, 2, 36, 2, 37, 38,
1050
+ 1, 1, 1, 1, 1, 1, 1, 1,
1051
+ 1, 1, 1, 1, 1, 1, 1, 1,
1052
+ 1, 1, 1, 1, 1, 37, 1, 1,
1053
+ 1, 1, 1, 1, 1, 1, 1, 1,
1054
+ 1, 12, 1, 1, 1, 1, 1, 1,
1055
+ 1, 1, 1, 1, 1, 1, 1, 1,
1056
+ 1, 1, 1, 1, 1, 1, 1, 1,
1057
+ 1, 1, 1, 1, 1, 1, 1, 1,
1058
+ 1, 1, 1, 1, 1, 1, 1, 1,
1059
+ 1, 1, 1, 1, 1, 1, 1, 1,
1060
+ 1, 1, 1, 1, 1, 1, 1, 1,
1061
+ 1, 1, 1, 1, 1, 1, 1, 1,
1062
+ 1, 1, 1, 1, 1, 1, 1, 1,
1063
+ 1, 1, 1, 1, 1, 1, 1, 1,
1064
+ 1, 1, 32, 1, 1, 40, 41, 39,
1065
+ 39, 39, 39, 39, 39, 39, 39, 39,
1066
+ 39, 39, 39, 39, 39, 39, 39, 39,
1067
+ 39, 39, 39, 39, 40, 39, 39, 39,
1068
+ 39, 39, 39, 39, 39, 39, 39, 39,
1069
+ 42, 39, 39, 39, 43, 43, 43, 43,
1070
+ 43, 43, 43, 43, 43, 43, 39, 39,
1071
+ 39, 39, 39, 39, 39, 43, 43, 43,
1072
+ 43, 43, 43, 43, 43, 43, 43, 43,
1073
+ 43, 43, 43, 43, 43, 43, 43, 43,
1074
+ 43, 43, 43, 43, 43, 43, 43, 39,
1075
+ 39, 39, 39, 43, 39, 43, 43, 43,
1076
+ 43, 43, 43, 43, 43, 43, 43, 43,
1077
+ 43, 43, 43, 43, 43, 43, 43, 43,
1078
+ 43, 43, 43, 43, 43, 43, 43, 39,
1079
+ 39, 44, 39, 45, 1, 47, 46, 46,
1080
+ 46, 46, 46, 46, 46, 46, 46, 46,
1081
+ 46, 46, 46, 46, 46, 46, 46, 46,
1082
+ 46, 46, 46, 46, 46, 46, 46, 46,
1083
+ 46, 46, 46, 46, 46, 46, 46, 46,
1084
+ 46, 46, 46, 48, 48, 48, 48, 48,
1085
+ 48, 48, 48, 48, 48, 46, 46, 46,
1086
+ 46, 46, 46, 46, 48, 48, 48, 48,
1087
+ 48, 48, 48, 48, 48, 48, 48, 48,
1088
+ 48, 48, 48, 48, 48, 48, 48, 48,
1089
+ 48, 48, 48, 48, 48, 48, 46, 46,
1090
+ 46, 46, 48, 46, 48, 48, 48, 48,
1091
+ 48, 48, 48, 48, 48, 48, 48, 48,
1092
+ 48, 48, 48, 48, 48, 48, 48, 48,
1093
+ 48, 48, 48, 48, 48, 48, 46, 46,
1094
+ 15, 0
932
1095
  ]
933
1096
 
934
1097
  class << self
@@ -936,11 +1099,13 @@ class << self
936
1099
  private :_bel_trans_targs, :_bel_trans_targs=
937
1100
  end
938
1101
  self._bel_trans_targs = [
939
- 0, 2, 0, 2, 3, 6, 7, 8,
940
- 3, 4, 9, 0, 5, 6, 8, 5,
941
- 6, 8, 6, 0, 5, 6, 7, 8,
942
- 16, 0, 11, 17, 11, 0, 13, 13,
943
- 14, 15, 18, 0
1102
+ 12, 0, 0, 2, 3, 4, 15, 6,
1103
+ 4, 15, 6, 0, 5, 18, 20, 0,
1104
+ 8, 9, 10, 22, 11, 10, 22, 11,
1105
+ 13, 14, 2, 3, 18, 19, 13, 14,
1106
+ 19, 16, 17, 5, 19, 16, 17, 0,
1107
+ 16, 17, 5, 18, 19, 17, 0, 21,
1108
+ 20
944
1109
  ]
945
1110
 
946
1111
  class << self
@@ -948,11 +1113,13 @@ class << self
948
1113
  private :_bel_trans_actions, :_bel_trans_actions=
949
1114
  end
950
1115
  self._bel_trans_actions = [
951
- 1, 2, 3, 4, 5, 6, 7, 8,
952
- 10, 10, 10, 9, 11, 12, 13, 0,
953
- 14, 15, 0, 16, 17, 18, 19, 20,
954
- 21, 22, 7, 23, 19, 24, 5, 10,
955
- 10, 10, 25, 0
1116
+ 0, 0, 2, 0, 0, 4, 5, 4,
1117
+ 0, 6, 0, 8, 0, 9, 9, 11,
1118
+ 0, 0, 4, 13, 4, 0, 14, 0,
1119
+ 16, 16, 16, 16, 17, 16, 0, 0,
1120
+ 0, 21, 21, 21, 21, 0, 0, 24,
1121
+ 25, 25, 25, 0, 25, 27, 29, 30,
1122
+ 0
956
1123
  ]
957
1124
 
958
1125
  class << self
@@ -960,9 +1127,9 @@ class << self
960
1127
  private :_bel_eof_actions, :_bel_eof_actions=
961
1128
  end
962
1129
  self._bel_eof_actions = [
963
- 0, 1, 3, 9, 9, 1, 3, 16,
964
- 1, 9, 22, 22, 24, 24, 24, 24,
965
- 0, 0, 0
1130
+ 0, 0, 1, 3, 3, 7, 3, 0,
1131
+ 10, 12, 12, 12, 15, 18, 19, 20,
1132
+ 22, 22, 23, 26, 28, 31, 0
966
1133
  ]
967
1134
 
968
1135
  class << self
@@ -972,24 +1139,24 @@ self.bel_start = 1;
972
1139
  class << self
973
1140
  attr_accessor :bel_first_final
974
1141
  end
975
- self.bel_first_final = 16;
1142
+ self.bel_first_final = 12;
976
1143
  class << self
977
1144
  attr_accessor :bel_error
978
1145
  end
979
1146
  self.bel_error = 0;
980
1147
 
981
1148
  class << self
982
- attr_accessor :bel_en_ident
1149
+ attr_accessor :bel_en_ident_node
983
1150
  end
984
- self.bel_en_ident = 10;
1151
+ self.bel_en_ident_node = 7;
985
1152
  class << self
986
- attr_accessor :bel_en_string
1153
+ attr_accessor :bel_en_string_node
987
1154
  end
988
- self.bel_en_string = 12;
1155
+ self.bel_en_string_node = 8;
989
1156
  class << self
990
- attr_accessor :bel_en_list
1157
+ attr_accessor :bel_en_list_node
991
1158
  end
992
- self.bel_en_list = 1;
1159
+ self.bel_en_list_node = 1;
993
1160
 
994
1161
 
995
1162
  begin
@@ -1034,506 +1201,585 @@ begin
1034
1201
  cs = _bel_trans_targs[_trans]
1035
1202
  if _bel_trans_actions[_trans] != 0
1036
1203
  case _bel_trans_actions[_trans]
1037
- when 19 then
1204
+ when 9 then
1038
1205
  begin
1039
1206
 
1040
- (@buffers[:ident] ||= []) << data[p].ord
1207
+ trace('IDENTIFIER start_identifier')
1208
+ @identifier_started = true
1209
+ id_start = p;
1041
1210
  end
1042
- when 10 then
1211
+ when 30 then
1043
1212
  begin
1044
1213
 
1045
- (@buffers[:string] ||= []) << data[p].ord
1214
+ trace('IDENTIFIER end_identifier')
1215
+ id_end = p
1216
+ chars = data[id_start...id_end]
1217
+ completed = !chars.empty?
1218
+ ast_node = identifier(utf8_string(chars), complete: completed)
1219
+ @buffers[:ident] = ast_node
1046
1220
  end
1047
- when 14 then
1221
+ when 24 then
1048
1222
  begin
1049
1223
 
1050
- @buffers.delete(:string)
1051
- @buffers.delete(:ident)
1224
+ trace('IDENTIFIER an_ident_err')
1225
+ id_end = p
1226
+ chars = data[id_start...id_end]
1227
+ ast_node = identifier(utf8_string(chars), complete: false)
1228
+ @buffers[:ident] = ast_node
1052
1229
  end
1053
- when 2 then
1230
+ when 29 then
1054
1231
  begin
1055
1232
 
1056
- @buffers[:list] = list()
1233
+ trace('IDENTIFIER ident_node_err')
1234
+ id_end = p
1235
+ chars = data[id_start...id_end]
1236
+ ast_node = identifier(utf8_string(chars), complete: false)
1237
+ yield ast_node
1057
1238
  end
1058
1239
  when 4 then
1059
1240
  begin
1060
1241
 
1061
- # Append list argument if its value is not empty.
1062
- if @buffers[:list_arg]
1063
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1064
- if list_arg_value != ''
1065
- @buffers[:list] <<= @buffers[:list_arg]
1066
- end
1067
- end
1242
+ trace('STRING start_string')
1243
+ @string_opened = true
1244
+ p_start = p
1068
1245
  end
1069
- when 15 then
1246
+ when 2 then
1070
1247
  begin
1071
1248
 
1072
- #TODO: Mark @buffers[:list] as complete.
1249
+ trace('STRING a_string_err')
1250
+ p_end = p
1251
+ chars = data[p_start...p_end]
1252
+ ast_node = string(utf8_string(chars), complete: false)
1253
+ @buffers[:string] = ast_node
1073
1254
  end
1074
- when 21 then
1255
+ when 11 then
1075
1256
  begin
1076
1257
 
1077
- yield @buffers[:list]
1258
+ trace('STRING string_node_err')
1259
+ p_end = p
1260
+ chars = data[p_start...p_end]
1261
+ ast_node = string(utf8_string(chars), complete: false)
1262
+ yield ast_node
1078
1263
  end
1079
- when 1 then
1264
+ when 16 then
1080
1265
  begin
1081
1266
 
1082
- @buffers[:list] ||= list()
1083
- yield @buffers[:list]
1267
+ trace('LIST start_list')
1268
+ @list_opened = true
1269
+ @incomplete[:list] = list()
1084
1270
  end
1085
- when 7 then
1271
+ when 27 then
1086
1272
  begin
1087
1273
 
1088
- @buffers[:ident] = []
1274
+ trace('LIST stop_list')
1275
+ @list_closed = true
1089
1276
  end
1277
+ when 21 then
1090
1278
  begin
1091
1279
 
1092
- (@buffers[:ident] ||= []) << data[p].ord
1280
+ trace('LIST add_string')
1281
+ string = @buffers.delete(:string)
1282
+ item = list_item(string, complete: string.complete)
1283
+ @incomplete[:list] <<= item
1093
1284
  end
1094
- when 23 then
1285
+ when 25 then
1095
1286
  begin
1096
1287
 
1097
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1288
+ trace('IDENTIFIER end_identifier')
1289
+ id_end = p
1290
+ chars = data[id_start...id_end]
1291
+ completed = !chars.empty?
1292
+ ast_node = identifier(utf8_string(chars), complete: completed)
1293
+ @buffers[:ident] = ast_node
1098
1294
  end
1099
1295
  begin
1100
1296
 
1101
- yield @buffers[:ident]
1297
+ trace('LIST add_ident')
1298
+ ident = @buffers.delete(:ident)
1299
+ item = list_item(ident, complete: ident.complete)
1300
+ @incomplete[:list] <<= item
1102
1301
  end
1103
- when 22 then
1302
+ when 6 then
1104
1303
  begin
1105
1304
 
1106
- unless @buffers[:ident].is_a?(::AST::Node)
1107
- @buffers[:ident] ||= []
1108
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1109
- end
1305
+ trace('STRING stop_string')
1306
+ @string_closed = true
1307
+ p_end = p
1110
1308
  end
1111
1309
  begin
1112
1310
 
1113
- @buffers[:ident] ||= []
1114
- yield @buffers[:ident]
1311
+ trace('STRING string_end')
1312
+ completed = @string_opened && @string_closed
1313
+ chars = data[p_start...p_end]
1314
+ ast_node = string(utf8_string(chars), complete: true)
1315
+ @buffers[:string] = ast_node
1115
1316
  end
1116
- when 5 then
1317
+ when 8 then
1117
1318
  begin
1118
1319
 
1119
- @buffers[:string] = []
1320
+ trace('STRING a_string_err')
1321
+ p_end = p
1322
+ chars = data[p_start...p_end]
1323
+ ast_node = string(utf8_string(chars), complete: false)
1324
+ @buffers[:string] = ast_node
1120
1325
  end
1121
1326
  begin
1122
1327
 
1123
- (@buffers[:string] ||= []) << data[p].ord
1328
+ trace('IDENTIFIER an_ident_err')
1329
+ id_end = p
1330
+ chars = data[id_start...id_end]
1331
+ ast_node = identifier(utf8_string(chars), complete: false)
1332
+ @buffers[:ident] = ast_node
1124
1333
  end
1125
- when 25 then
1334
+ when 17 then
1126
1335
  begin
1127
1336
 
1128
- @buffers[:string] = string(utf8_string(@buffers[:string]))
1337
+ trace('LIST start_list')
1338
+ @list_opened = true
1339
+ @incomplete[:list] = list()
1129
1340
  end
1130
1341
  begin
1131
1342
 
1132
- yield @buffers[:string]
1343
+ trace('IDENTIFIER start_identifier')
1344
+ @identifier_started = true
1345
+ id_start = p;
1133
1346
  end
1134
- when 24 then
1347
+ when 5 then
1135
1348
  begin
1136
1349
 
1137
- @buffers[:string] ||= []
1138
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1350
+ trace('STRING start_string')
1351
+ @string_opened = true
1352
+ p_start = p
1139
1353
  end
1140
1354
  begin
1141
1355
 
1142
- @buffers[:string] ||= []
1143
- yield @buffers[:string]
1356
+ trace('STRING stop_string')
1357
+ @string_closed = true
1358
+ p_end = p
1144
1359
  end
1145
- when 6 then
1146
1360
  begin
1147
1361
 
1148
- # Append list argument if its value is not empty.
1149
- if @buffers[:list_arg]
1150
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1151
- if list_arg_value != ''
1152
- @buffers[:list] <<= @buffers[:list_arg]
1153
- end
1154
- end
1362
+ trace('STRING string_end')
1363
+ completed = @string_opened && @string_closed
1364
+ chars = data[p_start...p_end]
1365
+ ast_node = string(utf8_string(chars), complete: true)
1366
+ @buffers[:string] = ast_node
1155
1367
  end
1368
+ when 14 then
1156
1369
  begin
1157
1370
 
1158
- @buffers.delete(:string)
1159
- @buffers.delete(:ident)
1371
+ trace('STRING stop_string')
1372
+ @string_closed = true
1373
+ p_end = p
1160
1374
  end
1161
- when 8 then
1162
1375
  begin
1163
1376
 
1164
- # Append list argument if its value is not empty.
1165
- if @buffers[:list_arg]
1166
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1167
- if list_arg_value != ''
1168
- @buffers[:list] <<= @buffers[:list_arg]
1169
- end
1170
- end
1377
+ trace('STRING string_end')
1378
+ completed = @string_opened && @string_closed
1379
+ chars = data[p_start...p_end]
1380
+ ast_node = string(utf8_string(chars), complete: true)
1381
+ @buffers[:string] = ast_node
1171
1382
  end
1172
1383
  begin
1173
1384
 
1174
- #TODO: Mark @buffers[:list] as complete.
1385
+ trace('STRING yield_string')
1386
+ yield @buffers[:string]
1175
1387
  end
1176
- when 17 then
1388
+ when 13 then
1177
1389
  begin
1178
1390
 
1179
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1391
+ trace('STRING start_string')
1392
+ @string_opened = true
1393
+ p_start = p
1180
1394
  end
1181
1395
  begin
1182
1396
 
1183
- @buffers[:list_arg] = list_item(@buffers[:ident])
1397
+ trace('STRING stop_string')
1398
+ @string_closed = true
1399
+ p_end = p
1184
1400
  end
1185
1401
  begin
1186
1402
 
1187
- # Append list argument if its value is not empty.
1188
- if @buffers[:list_arg]
1189
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1190
- if list_arg_value != ''
1191
- @buffers[:list] <<= @buffers[:list_arg]
1192
- end
1193
- end
1403
+ trace('STRING string_end')
1404
+ completed = @string_opened && @string_closed
1405
+ chars = data[p_start...p_end]
1406
+ ast_node = string(utf8_string(chars), complete: true)
1407
+ @buffers[:string] = ast_node
1194
1408
  end
1195
- when 11 then
1196
1409
  begin
1197
1410
 
1198
- @buffers[:string] = string(utf8_string(@buffers[:string]))
1199
- end
1200
- begin
1201
-
1202
- @buffers[:list_arg] = list_item(@buffers[:string])
1411
+ trace('STRING yield_string')
1412
+ yield @buffers[:string]
1203
1413
  end
1414
+ end
1415
+ end
1416
+ end
1417
+ if _goto_level <= _again
1418
+ if cs == 0
1419
+ _goto_level = _out
1420
+ next
1421
+ end
1422
+ p += 1
1423
+ if p != pe
1424
+ _goto_level = _resume
1425
+ next
1426
+ end
1427
+ end
1428
+ if _goto_level <= _test_eof
1429
+ if p == eof
1430
+ case _bel_eof_actions[cs]
1431
+ when 31 then
1204
1432
  begin
1205
1433
 
1206
- # Append list argument if its value is not empty.
1207
- if @buffers[:list_arg]
1208
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1209
- if list_arg_value != ''
1210
- @buffers[:list] <<= @buffers[:list_arg]
1211
- end
1212
- end
1434
+ trace('IDENTIFIER yield_identifier')
1435
+ yield @buffers[:ident]
1213
1436
  end
1214
- when 18 then
1437
+ when 28 then
1215
1438
  begin
1216
1439
 
1217
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1440
+ trace('IDENTIFIER end_identifier')
1441
+ id_end = p
1442
+ chars = data[id_start...id_end]
1443
+ completed = !chars.empty?
1444
+ ast_node = identifier(utf8_string(chars), complete: completed)
1445
+ @buffers[:ident] = ast_node
1218
1446
  end
1219
1447
  begin
1220
1448
 
1221
- @buffers[:list_arg] = list_item(@buffers[:ident])
1449
+ trace('IDENTIFIER yield_identifier')
1450
+ yield @buffers[:ident]
1222
1451
  end
1452
+ when 1 then
1223
1453
  begin
1224
1454
 
1225
- # Append list argument if its value is not empty.
1226
- if @buffers[:list_arg]
1227
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1228
- if list_arg_value != ''
1229
- @buffers[:list] <<= @buffers[:list_arg]
1230
- end
1231
- end
1455
+ trace('STRING a_string_err')
1456
+ p_end = p
1457
+ chars = data[p_start...p_end]
1458
+ ast_node = string(utf8_string(chars), complete: false)
1459
+ @buffers[:string] = ast_node
1232
1460
  end
1233
1461
  begin
1234
1462
 
1235
- @buffers.delete(:string)
1236
- @buffers.delete(:ident)
1463
+ trace('LIST list_node_eof')
1464
+ list = @incomplete.delete(:list)
1465
+ string = @buffers.delete(:string)
1466
+ item = list_item(string, complete: string.complete)
1467
+ list <<= item
1468
+ list.complete = false
1469
+ yield list
1237
1470
  end
1238
- when 20 then
1471
+ when 10 then
1239
1472
  begin
1240
1473
 
1241
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
1474
+ trace('STRING string_node_err')
1475
+ p_end = p
1476
+ chars = data[p_start...p_end]
1477
+ ast_node = string(utf8_string(chars), complete: false)
1478
+ yield ast_node
1242
1479
  end
1243
1480
  begin
1244
1481
 
1245
- @buffers[:list_arg] = list_item(@buffers[:ident])
1482
+ trace('STRING string_node_eof')
1483
+ yield @buffers[:string]
1246
1484
  end
1485
+ when 22 then
1247
1486
  begin
1248
1487
 
1249
- # Append list argument if its value is not empty.
1250
- if @buffers[:list_arg]
1251
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1252
- if list_arg_value != ''
1253
- @buffers[:list] <<= @buffers[:list_arg]
1254
- end
1488
+ trace('LIST list_end')
1489
+ if @list_opened && @list_closed
1490
+ list = @incomplete.delete(:list)
1491
+ list.complete = true
1492
+ elsif !@list_closed
1493
+ list = @incomplete.delete(:list)
1494
+ list.complete = false
1255
1495
  end
1496
+ @buffers[:list] = list
1256
1497
  end
1257
1498
  begin
1258
1499
 
1259
- #TODO: Mark @buffers[:list] as complete.
1260
- end
1261
- when 16 then
1262
- begin
1263
-
1264
- unless @buffers[:ident].is_a?(::AST::Node)
1265
- @buffers[:ident] ||= []
1266
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1267
- end
1500
+ trace('LIST yield_list')
1501
+ yield @buffers[:list]
1268
1502
  end
1503
+ when 3 then
1269
1504
  begin
1270
1505
 
1271
- #TODO: Mark @buffers[:list_arg] identifier as error.
1272
- @buffers[:list_arg] = list_item(@buffers[:ident])
1506
+ trace('STRING eof_string')
1507
+ p_end = p
1508
+ chars = data[p_start...p_end]
1509
+ ast_node = string(utf8_string(chars), complete: false)
1510
+ @buffers[:string] = ast_node
1273
1511
  end
1274
1512
  begin
1275
1513
 
1276
- # Append list argument if its value is not empty.
1277
- if @buffers[:list_arg]
1278
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1279
- if list_arg_value != ''
1280
- @buffers[:list] <<= @buffers[:list_arg]
1281
- end
1282
- end
1514
+ trace('STRING a_string_err')
1515
+ p_end = p
1516
+ chars = data[p_start...p_end]
1517
+ ast_node = string(utf8_string(chars), complete: false)
1518
+ @buffers[:string] = ast_node
1283
1519
  end
1284
1520
  begin
1285
1521
 
1286
- @buffers[:list] ||= list()
1287
- yield @buffers[:list]
1522
+ trace('LIST list_node_eof')
1523
+ list = @incomplete.delete(:list)
1524
+ string = @buffers.delete(:string)
1525
+ item = list_item(string, complete: string.complete)
1526
+ list <<= item
1527
+ list.complete = false
1528
+ yield list
1288
1529
  end
1289
1530
  when 12 then
1290
1531
  begin
1291
1532
 
1292
- @buffers[:string] = string(utf8_string(@buffers[:string]))
1293
- end
1294
- begin
1295
-
1296
- @buffers[:list_arg] = list_item(@buffers[:string])
1297
- end
1298
- begin
1299
-
1300
- # Append list argument if its value is not empty.
1301
- if @buffers[:list_arg]
1302
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1303
- if list_arg_value != ''
1304
- @buffers[:list] <<= @buffers[:list_arg]
1305
- end
1306
- end
1533
+ trace('STRING eof_string')
1534
+ p_end = p
1535
+ chars = data[p_start...p_end]
1536
+ ast_node = string(utf8_string(chars), complete: false)
1537
+ @buffers[:string] = ast_node
1307
1538
  end
1308
1539
  begin
1309
1540
 
1310
- @buffers.delete(:string)
1311
- @buffers.delete(:ident)
1541
+ trace('STRING string_node_err')
1542
+ p_end = p
1543
+ chars = data[p_start...p_end]
1544
+ ast_node = string(utf8_string(chars), complete: false)
1545
+ yield ast_node
1312
1546
  end
1313
- when 13 then
1314
1547
  begin
1315
1548
 
1316
- @buffers[:string] = string(utf8_string(@buffers[:string]))
1549
+ trace('STRING string_node_eof')
1550
+ yield @buffers[:string]
1317
1551
  end
1552
+ when 26 then
1318
1553
  begin
1319
1554
 
1320
- @buffers[:list_arg] = list_item(@buffers[:string])
1555
+ trace('LIST stop_list')
1556
+ @list_closed = true
1321
1557
  end
1322
1558
  begin
1323
1559
 
1324
- # Append list argument if its value is not empty.
1325
- if @buffers[:list_arg]
1326
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1327
- if list_arg_value != ''
1328
- @buffers[:list] <<= @buffers[:list_arg]
1329
- end
1560
+ trace('LIST list_end')
1561
+ if @list_opened && @list_closed
1562
+ list = @incomplete.delete(:list)
1563
+ list.complete = true
1564
+ elsif !@list_closed
1565
+ list = @incomplete.delete(:list)
1566
+ list.complete = false
1330
1567
  end
1568
+ @buffers[:list] = list
1331
1569
  end
1332
1570
  begin
1333
1571
 
1334
- #TODO: Mark @buffers[:list] as complete.
1335
- end
1336
- when 9 then
1337
- begin
1338
-
1339
- @buffers[:string] ||= []
1340
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1572
+ trace('LIST yield_list')
1573
+ yield @buffers[:list]
1341
1574
  end
1575
+ when 20 then
1342
1576
  begin
1343
1577
 
1344
- #TODO: Mark @buffers[:list_arg] string as error.
1345
- @buffers[:list_arg] = list_item(@buffers[:string])
1578
+ trace('LIST add_string')
1579
+ string = @buffers.delete(:string)
1580
+ item = list_item(string, complete: string.complete)
1581
+ @incomplete[:list] <<= item
1346
1582
  end
1347
1583
  begin
1348
1584
 
1349
- # Append list argument if its value is not empty.
1350
- if @buffers[:list_arg]
1351
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1352
- if list_arg_value != ''
1353
- @buffers[:list] <<= @buffers[:list_arg]
1354
- end
1585
+ trace('LIST list_end')
1586
+ if @list_opened && @list_closed
1587
+ list = @incomplete.delete(:list)
1588
+ list.complete = true
1589
+ elsif !@list_closed
1590
+ list = @incomplete.delete(:list)
1591
+ list.complete = false
1355
1592
  end
1593
+ @buffers[:list] = list
1356
1594
  end
1357
1595
  begin
1358
1596
 
1359
- @buffers[:list] ||= list()
1597
+ trace('LIST yield_list')
1360
1598
  yield @buffers[:list]
1361
1599
  end
1362
- when 3 then
1363
- begin
1364
-
1365
- @buffers[:string] ||= []
1366
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1367
- end
1600
+ when 19 then
1368
1601
  begin
1369
1602
 
1370
- #TODO: Mark @buffers[:list_arg] string as error.
1371
- @buffers[:list_arg] = list_item(@buffers[:string])
1603
+ trace('LIST list_node_eof')
1604
+ list = @incomplete.delete(:list)
1605
+ string = @buffers.delete(:string)
1606
+ item = list_item(string, complete: string.complete)
1607
+ list <<= item
1608
+ list.complete = false
1609
+ yield list
1372
1610
  end
1373
1611
  begin
1374
1612
 
1375
- unless @buffers[:ident].is_a?(::AST::Node)
1376
- @buffers[:ident] ||= []
1377
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1613
+ trace('LIST list_end')
1614
+ if @list_opened && @list_closed
1615
+ list = @incomplete.delete(:list)
1616
+ list.complete = true
1617
+ elsif !@list_closed
1618
+ list = @incomplete.delete(:list)
1619
+ list.complete = false
1378
1620
  end
1621
+ @buffers[:list] = list
1379
1622
  end
1380
1623
  begin
1381
1624
 
1382
- #TODO: Mark @buffers[:list_arg] identifier as error.
1383
- @buffers[:list_arg] = list_item(@buffers[:ident])
1625
+ trace('LIST yield_list')
1626
+ yield @buffers[:list]
1384
1627
  end
1628
+ when 18 then
1385
1629
  begin
1386
1630
 
1387
- # Append list argument if its value is not empty.
1388
- if @buffers[:list_arg]
1389
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1390
- if list_arg_value != ''
1391
- @buffers[:list] <<= @buffers[:list_arg]
1392
- end
1631
+ trace('IDENTIFIER an_ident_eof')
1632
+ if @identifier_started
1633
+ id_end = p
1634
+ chars = data[id_start...id_end]
1635
+ completed = !chars.empty?
1636
+ ast_node = identifier(utf8_string(chars), complete: completed)
1637
+ @buffers[:ident] = ast_node
1393
1638
  end
1394
1639
  end
1395
1640
  begin
1396
1641
 
1397
- @buffers[:list] ||= list()
1398
- yield @buffers[:list]
1642
+ trace('LIST list_node_eof')
1643
+ list = @incomplete.delete(:list)
1644
+ string = @buffers.delete(:string)
1645
+ item = list_item(string, complete: string.complete)
1646
+ list <<= item
1647
+ list.complete = false
1648
+ yield list
1399
1649
  end
1400
- end
1401
- end
1402
- end
1403
- if _goto_level <= _again
1404
- if cs == 0
1405
- _goto_level = _out
1406
- next
1407
- end
1408
- p += 1
1409
- if p != pe
1410
- _goto_level = _resume
1411
- next
1412
- end
1413
- end
1414
- if _goto_level <= _test_eof
1415
- if p == eof
1416
- case _bel_eof_actions[cs]
1417
- when 1 then
1418
1650
  begin
1419
1651
 
1420
- @buffers[:list] ||= list()
1421
- yield @buffers[:list]
1422
- end
1423
- when 22 then
1424
- begin
1425
-
1426
- unless @buffers[:ident].is_a?(::AST::Node)
1427
- @buffers[:ident] ||= []
1428
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1652
+ trace('LIST list_end')
1653
+ if @list_opened && @list_closed
1654
+ list = @incomplete.delete(:list)
1655
+ list.complete = true
1656
+ elsif !@list_closed
1657
+ list = @incomplete.delete(:list)
1658
+ list.complete = false
1429
1659
  end
1660
+ @buffers[:list] = list
1430
1661
  end
1431
1662
  begin
1432
1663
 
1433
- @buffers[:ident] ||= []
1434
- yield @buffers[:ident]
1435
- end
1436
- when 24 then
1437
- begin
1438
-
1439
- @buffers[:string] ||= []
1440
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1664
+ trace('LIST yield_list')
1665
+ yield @buffers[:list]
1441
1666
  end
1667
+ when 7 then
1442
1668
  begin
1443
1669
 
1444
- @buffers[:string] ||= []
1445
- yield @buffers[:string]
1670
+ trace('STRING a_string_err')
1671
+ p_end = p
1672
+ chars = data[p_start...p_end]
1673
+ ast_node = string(utf8_string(chars), complete: false)
1674
+ @buffers[:string] = ast_node
1446
1675
  end
1447
- when 16 then
1448
1676
  begin
1449
1677
 
1450
- unless @buffers[:ident].is_a?(::AST::Node)
1451
- @buffers[:ident] ||= []
1452
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1678
+ trace('IDENTIFIER an_ident_eof')
1679
+ if @identifier_started
1680
+ id_end = p
1681
+ chars = data[id_start...id_end]
1682
+ completed = !chars.empty?
1683
+ ast_node = identifier(utf8_string(chars), complete: completed)
1684
+ @buffers[:ident] = ast_node
1453
1685
  end
1454
1686
  end
1455
1687
  begin
1456
1688
 
1457
- #TODO: Mark @buffers[:list_arg] identifier as error.
1458
- @buffers[:list_arg] = list_item(@buffers[:ident])
1459
- end
1460
- begin
1461
-
1462
- # Append list argument if its value is not empty.
1463
- if @buffers[:list_arg]
1464
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1465
- if list_arg_value != ''
1466
- @buffers[:list] <<= @buffers[:list_arg]
1467
- end
1468
- end
1689
+ trace('IDENTIFIER an_ident_err')
1690
+ id_end = p
1691
+ chars = data[id_start...id_end]
1692
+ ast_node = identifier(utf8_string(chars), complete: false)
1693
+ @buffers[:ident] = ast_node
1469
1694
  end
1470
1695
  begin
1471
1696
 
1472
- @buffers[:list] ||= list()
1473
- yield @buffers[:list]
1697
+ trace('LIST list_node_eof')
1698
+ list = @incomplete.delete(:list)
1699
+ string = @buffers.delete(:string)
1700
+ item = list_item(string, complete: string.complete)
1701
+ list <<= item
1702
+ list.complete = false
1703
+ yield list
1474
1704
  end
1475
- when 9 then
1705
+ when 15 then
1476
1706
  begin
1477
1707
 
1478
- @buffers[:string] ||= []
1479
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1708
+ trace('LIST start_list')
1709
+ @list_opened = true
1710
+ @incomplete[:list] = list()
1480
1711
  end
1481
1712
  begin
1482
1713
 
1483
- #TODO: Mark @buffers[:list_arg] string as error.
1484
- @buffers[:list_arg] = list_item(@buffers[:string])
1714
+ trace('IDENTIFIER an_ident_eof')
1715
+ if @identifier_started
1716
+ id_end = p
1717
+ chars = data[id_start...id_end]
1718
+ completed = !chars.empty?
1719
+ ast_node = identifier(utf8_string(chars), complete: completed)
1720
+ @buffers[:ident] = ast_node
1721
+ end
1485
1722
  end
1486
1723
  begin
1487
1724
 
1488
- # Append list argument if its value is not empty.
1489
- if @buffers[:list_arg]
1490
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1491
- if list_arg_value != ''
1492
- @buffers[:list] <<= @buffers[:list_arg]
1493
- end
1725
+ trace('LIST list_end')
1726
+ if @list_opened && @list_closed
1727
+ list = @incomplete.delete(:list)
1728
+ list.complete = true
1729
+ elsif !@list_closed
1730
+ list = @incomplete.delete(:list)
1731
+ list.complete = false
1494
1732
  end
1733
+ @buffers[:list] = list
1495
1734
  end
1496
1735
  begin
1497
1736
 
1498
- @buffers[:list] ||= list()
1737
+ trace('LIST yield_list')
1499
1738
  yield @buffers[:list]
1500
1739
  end
1501
- when 3 then
1502
- begin
1503
-
1504
- @buffers[:string] ||= []
1505
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1506
- end
1740
+ when 23 then
1507
1741
  begin
1508
1742
 
1509
- #TODO: Mark @buffers[:list_arg] string as error.
1510
- @buffers[:list_arg] = list_item(@buffers[:string])
1743
+ trace('IDENTIFIER end_identifier')
1744
+ id_end = p
1745
+ chars = data[id_start...id_end]
1746
+ completed = !chars.empty?
1747
+ ast_node = identifier(utf8_string(chars), complete: completed)
1748
+ @buffers[:ident] = ast_node
1511
1749
  end
1512
1750
  begin
1513
1751
 
1514
- unless @buffers[:ident].is_a?(::AST::Node)
1515
- @buffers[:ident] ||= []
1516
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1752
+ trace('IDENTIFIER an_ident_eof')
1753
+ if @identifier_started
1754
+ id_end = p
1755
+ chars = data[id_start...id_end]
1756
+ completed = !chars.empty?
1757
+ ast_node = identifier(utf8_string(chars), complete: completed)
1758
+ @buffers[:ident] = ast_node
1517
1759
  end
1518
1760
  end
1519
1761
  begin
1520
1762
 
1521
- #TODO: Mark @buffers[:list_arg] identifier as error.
1522
- @buffers[:list_arg] = list_item(@buffers[:ident])
1763
+ trace('LIST add_ident')
1764
+ ident = @buffers.delete(:ident)
1765
+ item = list_item(ident, complete: ident.complete)
1766
+ @incomplete[:list] <<= item
1523
1767
  end
1524
1768
  begin
1525
1769
 
1526
- # Append list argument if its value is not empty.
1527
- if @buffers[:list_arg]
1528
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1529
- if list_arg_value != ''
1530
- @buffers[:list] <<= @buffers[:list_arg]
1531
- end
1770
+ trace('LIST list_end')
1771
+ if @list_opened && @list_closed
1772
+ list = @incomplete.delete(:list)
1773
+ list.complete = true
1774
+ elsif !@list_closed
1775
+ list = @incomplete.delete(:list)
1776
+ list.complete = false
1532
1777
  end
1778
+ @buffers[:list] = list
1533
1779
  end
1534
1780
  begin
1535
1781
 
1536
- @buffers[:list] ||= list()
1782
+ trace('LIST yield_list')
1537
1783
  yield @buffers[:list]
1538
1784
  end
1539
1785
  end
@@ -1553,6 +1799,7 @@ end
1553
1799
  require_relative '../ast/node'
1554
1800
  require_relative '../mixin/buffer'
1555
1801
  require_relative '../nonblocking_io_wrapper'
1802
+ require_relative '../tracer'
1556
1803
 
1557
1804
  module BELParser
1558
1805
  module Parsers
@@ -1578,24 +1825,26 @@ module BELParser
1578
1825
  include Enumerable
1579
1826
  include BELParser::Parsers::Buffer
1580
1827
  include BELParser::Parsers::AST::Sexp
1828
+ include BELParser::Parsers::Tracer
1581
1829
 
1582
1830
  def initialize(content)
1583
1831
  @content = content
1584
- # begin: ragel
1832
+ # begin: ragel
1585
1833
 
1586
1834
  class << self
1587
1835
  attr_accessor :_bel_trans_keys
1588
1836
  private :_bel_trans_keys, :_bel_trans_keys=
1589
1837
  end
1590
1838
  self._bel_trans_keys = [
1591
- 0, 0, 123, 123, 9, 125,
1592
- 34, 92, 9, 125, 9,
1593
- 125, 9, 122, 9, 125,
1594
- 10, 10, 92, 92, 48, 122,
1595
- 10, 122, 34, 34, 34,
1596
- 92, 10, 10, 92, 92,
1597
- 0, 0, 0, 0, 0, 0,
1598
- 0
1839
+ 0, 0, 123, 123, 9, 34,
1840
+ 34, 92, 34, 92, 9,
1841
+ 122, 0, 0, 48, 122,
1842
+ 9, 34, 34, 92, 34, 92,
1843
+ 0, 0, 9, 125, 9,
1844
+ 125, 9, 34, 9, 125,
1845
+ 9, 125, 0, 0, 9, 125,
1846
+ 10, 10, 10, 122, 0,
1847
+ 0, 0, 0, 0
1599
1848
  ]
1600
1849
 
1601
1850
  class << self
@@ -1603,9 +1852,9 @@ class << self
1603
1852
  private :_bel_key_spans, :_bel_key_spans=
1604
1853
  end
1605
1854
  self._bel_key_spans = [
1606
- 0, 1, 117, 59, 117, 117, 114, 117,
1607
- 1, 1, 75, 113, 1, 59, 1, 1,
1608
- 0, 0, 0
1855
+ 0, 1, 26, 59, 59, 114, 0, 75,
1856
+ 26, 59, 59, 0, 117, 117, 26, 117,
1857
+ 117, 0, 117, 1, 113, 0, 0
1609
1858
  ]
1610
1859
 
1611
1860
  class << self
@@ -1613,9 +1862,9 @@ class << self
1613
1862
  private :_bel_index_offsets, :_bel_index_offsets=
1614
1863
  end
1615
1864
  self._bel_index_offsets = [
1616
- 0, 0, 2, 120, 180, 298, 416, 531,
1617
- 649, 651, 653, 729, 843, 845, 905, 907,
1618
- 909, 910, 911
1865
+ 0, 0, 2, 29, 89, 149, 264, 265,
1866
+ 341, 368, 428, 488, 489, 607, 725, 752,
1867
+ 870, 988, 989, 1107, 1109, 1223, 1224
1619
1868
  ]
1620
1869
 
1621
1870
  class << self
@@ -1623,121 +1872,160 @@ class << self
1623
1872
  private :_bel_indicies, :_bel_indicies=
1624
1873
  end
1625
1874
  self._bel_indicies = [
1626
- 1, 0, 3, 2, 2, 2, 2, 2,
1875
+ 0, 1, 3, 3, 3, 3, 3, 2,
1627
1876
  2, 2, 2, 2, 2, 2, 2, 2,
1628
1877
  2, 2, 2, 2, 2, 2, 2, 2,
1629
- 2, 3, 2, 4, 2, 2, 2, 2,
1630
- 2, 2, 2, 2, 2, 5, 2, 2,
1631
- 2, 6, 6, 6, 6, 6, 6, 6,
1632
- 6, 6, 6, 2, 2, 2, 2, 2,
1633
- 2, 2, 6, 6, 6, 6, 6, 6,
1634
- 6, 6, 6, 6, 6, 6, 6, 6,
1635
- 6, 6, 6, 6, 6, 6, 6, 6,
1636
- 6, 6, 6, 6, 2, 2, 2, 2,
1637
- 6, 2, 6, 6, 6, 6, 6, 6,
1638
- 6, 6, 6, 6, 6, 6, 6, 6,
1639
- 6, 6, 6, 6, 6, 6, 6, 6,
1640
- 6, 6, 6, 6, 2, 2, 7, 2,
1641
- 9, 8, 8, 8, 8, 8, 8, 8,
1878
+ 2, 3, 2, 4, 2, 6, 5, 5,
1879
+ 5, 5, 5, 5, 5, 5, 5, 5,
1880
+ 5, 5, 5, 5, 5, 5, 5, 5,
1881
+ 5, 5, 5, 5, 5, 5, 5, 5,
1882
+ 5, 5, 5, 5, 5, 5, 5, 5,
1883
+ 5, 5, 5, 5, 5, 5, 5, 5,
1884
+ 5, 5, 5, 5, 5, 5, 5, 5,
1885
+ 5, 5, 5, 5, 5, 5, 5, 7,
1886
+ 5, 9, 8, 8, 8, 8, 8, 8,
1642
1887
  8, 8, 8, 8, 8, 8, 8, 8,
1643
1888
  8, 8, 8, 8, 8, 8, 8, 8,
1644
1889
  8, 8, 8, 8, 8, 8, 8, 8,
1645
1890
  8, 8, 8, 8, 8, 8, 8, 8,
1646
1891
  8, 8, 8, 8, 8, 8, 8, 8,
1647
1892
  8, 8, 8, 8, 8, 8, 8, 8,
1648
- 8, 8, 10, 8, 12, 11, 11, 11,
1649
- 11, 11, 11, 11, 11, 11, 11, 11,
1650
- 11, 11, 11, 11, 11, 11, 11, 11,
1651
- 11, 11, 11, 12, 11, 11, 11, 11,
1652
- 11, 11, 11, 11, 11, 11, 11, 13,
1653
- 11, 11, 11, 11, 11, 11, 11, 11,
1654
- 11, 11, 11, 11, 11, 11, 11, 11,
1655
- 11, 11, 11, 11, 11, 11, 11, 11,
1893
+ 8, 8, 8, 10, 8, 12, 3, 3,
1894
+ 3, 3, 11, 11, 11, 11, 11, 11,
1656
1895
  11, 11, 11, 11, 11, 11, 11, 11,
1896
+ 11, 11, 11, 11, 12, 11, 4, 11,
1657
1897
  11, 11, 11, 11, 11, 11, 11, 11,
1898
+ 11, 11, 11, 11, 13, 13, 13, 13,
1899
+ 13, 13, 13, 13, 13, 13, 11, 11,
1900
+ 11, 11, 11, 11, 11, 13, 13, 13,
1901
+ 13, 13, 13, 13, 13, 13, 13, 13,
1902
+ 13, 13, 13, 13, 13, 13, 13, 13,
1903
+ 13, 13, 13, 13, 13, 13, 13, 11,
1904
+ 11, 11, 11, 13, 11, 13, 13, 13,
1905
+ 13, 13, 13, 13, 13, 13, 13, 13,
1906
+ 13, 13, 13, 13, 13, 13, 13, 13,
1907
+ 13, 13, 13, 13, 13, 13, 13, 11,
1908
+ 8, 14, 14, 14, 14, 14, 14, 14,
1909
+ 14, 14, 14, 1, 1, 1, 1, 1,
1910
+ 1, 1, 14, 14, 14, 14, 14, 14,
1911
+ 14, 14, 14, 14, 14, 14, 14, 14,
1912
+ 14, 14, 14, 14, 14, 14, 14, 14,
1913
+ 14, 14, 14, 14, 1, 1, 1, 1,
1914
+ 14, 1, 14, 14, 14, 14, 14, 14,
1915
+ 14, 14, 14, 14, 14, 14, 14, 14,
1916
+ 14, 14, 14, 14, 14, 14, 14, 14,
1917
+ 14, 14, 14, 14, 1, 16, 16, 16,
1918
+ 16, 16, 15, 15, 15, 15, 15, 15,
1919
+ 15, 15, 15, 15, 15, 15, 15, 15,
1920
+ 15, 15, 15, 15, 16, 15, 17, 15,
1921
+ 19, 18, 18, 18, 18, 18, 18, 18,
1922
+ 18, 18, 18, 18, 18, 18, 18, 18,
1923
+ 18, 18, 18, 18, 18, 18, 18, 18,
1924
+ 18, 18, 18, 18, 18, 18, 18, 18,
1925
+ 18, 18, 18, 18, 18, 18, 18, 18,
1926
+ 18, 18, 18, 18, 18, 18, 18, 18,
1927
+ 18, 18, 18, 18, 18, 18, 18, 18,
1928
+ 18, 18, 20, 18, 22, 21, 21, 21,
1929
+ 21, 21, 21, 21, 21, 21, 21, 21,
1930
+ 21, 21, 21, 21, 21, 21, 21, 21,
1931
+ 21, 21, 21, 21, 21, 21, 21, 21,
1932
+ 21, 21, 21, 21, 21, 21, 21, 21,
1933
+ 21, 21, 21, 21, 21, 21, 21, 21,
1934
+ 21, 21, 21, 21, 21, 21, 21, 21,
1935
+ 21, 21, 21, 21, 21, 21, 23, 21,
1936
+ 21, 24, 25, 26, 26, 26, 11, 11,
1658
1937
  11, 11, 11, 11, 11, 11, 11, 11,
1659
1938
  11, 11, 11, 11, 11, 11, 11, 11,
1939
+ 24, 11, 27, 11, 11, 11, 11, 11,
1660
1940
  11, 11, 11, 11, 11, 11, 11, 11,
1661
- 11, 11, 11, 11, 11, 11, 11, 11,
1662
- 11, 11, 11, 11, 11, 11, 11, 11,
1663
- 14, 11, 15, 0, 0, 0, 0, 0,
1664
- 0, 0, 0, 0, 0, 0, 0, 0,
1665
- 0, 0, 0, 0, 0, 0, 0, 0,
1666
- 0, 15, 0, 0, 0, 0, 0, 0,
1667
- 0, 0, 0, 0, 0, 16, 0, 0,
1668
- 0, 0, 0, 0, 0, 0, 0, 0,
1669
- 0, 0, 0, 0, 0, 0, 0, 0,
1670
- 0, 0, 0, 0, 0, 0, 0, 0,
1671
- 0, 0, 0, 0, 0, 0, 0, 0,
1672
- 0, 0, 0, 0, 0, 0, 0, 0,
1673
- 0, 0, 0, 0, 0, 0, 0, 0,
1674
- 0, 0, 0, 0, 0, 0, 0, 0,
1675
- 0, 0, 0, 0, 0, 0, 0, 0,
1676
- 0, 0, 0, 0, 0, 0, 0, 0,
1677
- 0, 0, 0, 0, 0, 0, 17, 0,
1678
- 18, 2, 2, 2, 2, 2, 2, 2,
1679
- 2, 2, 2, 2, 2, 2, 2, 2,
1680
- 2, 2, 2, 2, 2, 2, 2, 18,
1681
- 2, 4, 2, 2, 2, 2, 2, 2,
1682
- 2, 2, 2, 2, 2, 2, 2, 6,
1683
- 6, 6, 6, 6, 6, 6, 6, 6,
1684
- 6, 2, 2, 2, 2, 2, 2, 2,
1685
- 6, 6, 6, 6, 6, 6, 6, 6,
1686
- 6, 6, 6, 6, 6, 6, 6, 6,
1687
- 6, 6, 6, 6, 6, 6, 6, 6,
1688
- 6, 6, 2, 2, 2, 2, 6, 2,
1689
- 6, 6, 6, 6, 6, 6, 6, 6,
1690
- 6, 6, 6, 6, 6, 6, 6, 6,
1691
- 6, 6, 6, 6, 6, 6, 6, 6,
1692
- 6, 6, 2, 20, 19, 19, 19, 19,
1693
- 19, 19, 19, 19, 19, 19, 19, 19,
1694
- 19, 19, 19, 19, 19, 19, 19, 19,
1695
- 19, 19, 20, 19, 19, 19, 19, 19,
1696
- 19, 19, 19, 19, 19, 19, 21, 19,
1697
- 19, 19, 22, 22, 22, 22, 22, 22,
1698
- 22, 22, 22, 22, 19, 19, 19, 19,
1699
- 19, 19, 19, 22, 22, 22, 22, 22,
1700
- 22, 22, 22, 22, 22, 22, 22, 22,
1701
- 22, 22, 22, 22, 22, 22, 22, 22,
1702
- 22, 22, 22, 22, 22, 19, 19, 19,
1703
- 19, 22, 19, 22, 22, 22, 22, 22,
1704
- 22, 22, 22, 22, 22, 22, 22, 22,
1705
- 22, 22, 22, 22, 22, 22, 22, 22,
1706
- 22, 22, 22, 22, 22, 19, 19, 23,
1707
- 19, 24, 0, 10, 8, 26, 26, 26,
1708
- 26, 26, 26, 26, 26, 26, 26, 25,
1709
- 25, 25, 25, 25, 25, 25, 26, 26,
1710
- 26, 26, 26, 26, 26, 26, 26, 26,
1711
- 26, 26, 26, 26, 26, 26, 26, 26,
1712
- 26, 26, 26, 26, 26, 26, 26, 26,
1713
- 25, 25, 25, 25, 26, 25, 26, 26,
1714
- 26, 26, 26, 26, 26, 26, 26, 26,
1715
- 26, 26, 26, 26, 26, 26, 26, 26,
1716
- 26, 26, 26, 26, 26, 26, 26, 26,
1717
- 25, 27, 25, 25, 25, 25, 25, 25,
1718
- 25, 25, 25, 25, 25, 25, 25, 25,
1719
- 25, 25, 25, 25, 25, 25, 25, 25,
1720
- 25, 25, 25, 25, 25, 25, 25, 25,
1721
- 25, 25, 25, 25, 25, 25, 25, 28,
1722
- 28, 28, 28, 28, 28, 28, 28, 28,
1723
- 28, 25, 25, 25, 25, 25, 25, 25,
1724
- 28, 28, 28, 28, 28, 28, 28, 28,
1725
1941
  28, 28, 28, 28, 28, 28, 28, 28,
1942
+ 28, 28, 11, 11, 11, 11, 11, 11,
1943
+ 11, 28, 28, 28, 28, 28, 28, 28,
1726
1944
  28, 28, 28, 28, 28, 28, 28, 28,
1727
- 28, 28, 25, 25, 25, 25, 28, 25,
1728
1945
  28, 28, 28, 28, 28, 28, 28, 28,
1946
+ 28, 28, 28, 11, 11, 11, 11, 28,
1947
+ 11, 28, 28, 28, 28, 28, 28, 28,
1729
1948
  28, 28, 28, 28, 28, 28, 28, 28,
1730
1949
  28, 28, 28, 28, 28, 28, 28, 28,
1731
- 28, 28, 25, 30, 29, 32, 31, 31,
1732
- 31, 31, 31, 31, 31, 31, 31, 31,
1733
- 31, 31, 31, 31, 31, 31, 31, 31,
1734
- 31, 31, 31, 31, 31, 31, 31, 31,
1735
- 31, 31, 31, 31, 31, 31, 31, 31,
1736
- 31, 31, 31, 31, 31, 31, 31, 31,
1737
- 31, 31, 31, 31, 31, 31, 31, 31,
1738
- 31, 31, 31, 31, 31, 31, 31, 33,
1739
- 31, 34, 29, 33, 31, 35, 35, 35,
1740
- 0
1950
+ 28, 28, 28, 11, 11, 29, 11, 30,
1951
+ 31, 3, 3, 3, 11, 11, 11, 11,
1952
+ 11, 11, 11, 11, 11, 11, 11, 11,
1953
+ 11, 11, 11, 11, 11, 11, 30, 11,
1954
+ 4, 11, 11, 11, 11, 11, 11, 11,
1955
+ 11, 11, 11, 11, 11, 11, 13, 13,
1956
+ 13, 13, 13, 13, 13, 13, 13, 13,
1957
+ 11, 11, 11, 11, 11, 11, 11, 13,
1958
+ 13, 13, 13, 13, 13, 13, 13, 13,
1959
+ 13, 13, 13, 13, 13, 13, 13, 13,
1960
+ 13, 13, 13, 13, 13, 13, 13, 13,
1961
+ 13, 11, 11, 11, 11, 13, 11, 13,
1962
+ 13, 13, 13, 13, 13, 13, 13, 13,
1963
+ 13, 13, 13, 13, 13, 13, 13, 13,
1964
+ 13, 13, 13, 13, 13, 13, 13, 13,
1965
+ 13, 11, 11, 32, 11, 3, 3, 3,
1966
+ 3, 3, 2, 2, 2, 2, 2, 2,
1967
+ 2, 2, 2, 2, 2, 2, 2, 2,
1968
+ 2, 2, 2, 2, 3, 2, 4, 2,
1969
+ 33, 34, 2, 2, 2, 2, 2, 2,
1970
+ 2, 2, 2, 2, 2, 2, 2, 2,
1971
+ 2, 2, 2, 2, 2, 2, 2, 33,
1972
+ 2, 2, 2, 2, 2, 2, 2, 2,
1973
+ 2, 2, 2, 35, 2, 2, 2, 2,
1974
+ 2, 2, 2, 2, 2, 2, 2, 2,
1975
+ 2, 2, 2, 2, 2, 2, 2, 2,
1976
+ 2, 2, 2, 2, 2, 2, 2, 2,
1977
+ 2, 2, 2, 2, 2, 2, 2, 2,
1978
+ 2, 2, 2, 2, 2, 2, 2, 2,
1979
+ 2, 2, 2, 2, 2, 2, 2, 2,
1980
+ 2, 2, 2, 2, 2, 2, 2, 2,
1981
+ 2, 2, 2, 2, 2, 2, 2, 2,
1982
+ 2, 2, 2, 2, 2, 2, 2, 2,
1983
+ 2, 2, 2, 2, 36, 2, 37, 38,
1984
+ 1, 1, 1, 1, 1, 1, 1, 1,
1985
+ 1, 1, 1, 1, 1, 1, 1, 1,
1986
+ 1, 1, 1, 1, 1, 37, 1, 1,
1987
+ 1, 1, 1, 1, 1, 1, 1, 1,
1988
+ 1, 12, 1, 1, 1, 1, 1, 1,
1989
+ 1, 1, 1, 1, 1, 1, 1, 1,
1990
+ 1, 1, 1, 1, 1, 1, 1, 1,
1991
+ 1, 1, 1, 1, 1, 1, 1, 1,
1992
+ 1, 1, 1, 1, 1, 1, 1, 1,
1993
+ 1, 1, 1, 1, 1, 1, 1, 1,
1994
+ 1, 1, 1, 1, 1, 1, 1, 1,
1995
+ 1, 1, 1, 1, 1, 1, 1, 1,
1996
+ 1, 1, 1, 1, 1, 1, 1, 1,
1997
+ 1, 1, 1, 1, 1, 1, 1, 1,
1998
+ 1, 1, 32, 1, 1, 40, 41, 39,
1999
+ 39, 39, 39, 39, 39, 39, 39, 39,
2000
+ 39, 39, 39, 39, 39, 39, 39, 39,
2001
+ 39, 39, 39, 39, 40, 39, 39, 39,
2002
+ 39, 39, 39, 39, 39, 39, 39, 39,
2003
+ 42, 39, 39, 39, 43, 43, 43, 43,
2004
+ 43, 43, 43, 43, 43, 43, 39, 39,
2005
+ 39, 39, 39, 39, 39, 43, 43, 43,
2006
+ 43, 43, 43, 43, 43, 43, 43, 43,
2007
+ 43, 43, 43, 43, 43, 43, 43, 43,
2008
+ 43, 43, 43, 43, 43, 43, 43, 39,
2009
+ 39, 39, 39, 43, 39, 43, 43, 43,
2010
+ 43, 43, 43, 43, 43, 43, 43, 43,
2011
+ 43, 43, 43, 43, 43, 43, 43, 43,
2012
+ 43, 43, 43, 43, 43, 43, 43, 39,
2013
+ 39, 44, 39, 45, 1, 47, 46, 46,
2014
+ 46, 46, 46, 46, 46, 46, 46, 46,
2015
+ 46, 46, 46, 46, 46, 46, 46, 46,
2016
+ 46, 46, 46, 46, 46, 46, 46, 46,
2017
+ 46, 46, 46, 46, 46, 46, 46, 46,
2018
+ 46, 46, 46, 48, 48, 48, 48, 48,
2019
+ 48, 48, 48, 48, 48, 46, 46, 46,
2020
+ 46, 46, 46, 46, 48, 48, 48, 48,
2021
+ 48, 48, 48, 48, 48, 48, 48, 48,
2022
+ 48, 48, 48, 48, 48, 48, 48, 48,
2023
+ 48, 48, 48, 48, 48, 48, 46, 46,
2024
+ 46, 46, 48, 46, 48, 48, 48, 48,
2025
+ 48, 48, 48, 48, 48, 48, 48, 48,
2026
+ 48, 48, 48, 48, 48, 48, 48, 48,
2027
+ 48, 48, 48, 48, 48, 48, 46, 46,
2028
+ 15, 0
1741
2029
  ]
1742
2030
 
1743
2031
  class << self
@@ -1745,11 +2033,13 @@ class << self
1745
2033
  private :_bel_trans_targs, :_bel_trans_targs=
1746
2034
  end
1747
2035
  self._bel_trans_targs = [
1748
- 0, 2, 0, 2, 3, 6, 7, 8,
1749
- 3, 4, 9, 0, 5, 6, 8, 5,
1750
- 6, 8, 6, 0, 5, 6, 7, 8,
1751
- 16, 0, 11, 17, 11, 0, 13, 13,
1752
- 14, 15, 18, 0
2036
+ 12, 0, 0, 2, 3, 4, 15, 6,
2037
+ 4, 15, 6, 0, 5, 18, 20, 0,
2038
+ 8, 9, 10, 22, 11, 10, 22, 11,
2039
+ 13, 14, 2, 3, 18, 19, 13, 14,
2040
+ 19, 16, 17, 5, 19, 16, 17, 0,
2041
+ 16, 17, 5, 18, 19, 17, 0, 21,
2042
+ 20
1753
2043
  ]
1754
2044
 
1755
2045
  class << self
@@ -1757,11 +2047,13 @@ class << self
1757
2047
  private :_bel_trans_actions, :_bel_trans_actions=
1758
2048
  end
1759
2049
  self._bel_trans_actions = [
1760
- 1, 2, 3, 4, 5, 6, 7, 8,
1761
- 10, 10, 10, 9, 11, 12, 13, 0,
1762
- 14, 15, 0, 16, 17, 18, 19, 20,
1763
- 21, 22, 7, 23, 19, 24, 5, 10,
1764
- 10, 10, 25, 0
2050
+ 0, 0, 2, 0, 0, 4, 5, 4,
2051
+ 0, 6, 0, 8, 0, 9, 9, 11,
2052
+ 0, 0, 4, 13, 4, 0, 14, 0,
2053
+ 16, 16, 16, 16, 17, 16, 0, 0,
2054
+ 0, 21, 21, 21, 21, 0, 0, 24,
2055
+ 25, 25, 25, 0, 25, 27, 29, 30,
2056
+ 0
1765
2057
  ]
1766
2058
 
1767
2059
  class << self
@@ -1769,9 +2061,9 @@ class << self
1769
2061
  private :_bel_eof_actions, :_bel_eof_actions=
1770
2062
  end
1771
2063
  self._bel_eof_actions = [
1772
- 0, 1, 3, 9, 9, 1, 3, 16,
1773
- 1, 9, 22, 22, 24, 24, 24, 24,
1774
- 0, 0, 0
2064
+ 0, 0, 1, 3, 3, 7, 3, 0,
2065
+ 10, 12, 12, 12, 15, 18, 19, 20,
2066
+ 22, 22, 23, 26, 28, 31, 0
1775
2067
  ]
1776
2068
 
1777
2069
  class << self
@@ -1781,37 +2073,40 @@ self.bel_start = 1;
1781
2073
  class << self
1782
2074
  attr_accessor :bel_first_final
1783
2075
  end
1784
- self.bel_first_final = 16;
2076
+ self.bel_first_final = 12;
1785
2077
  class << self
1786
2078
  attr_accessor :bel_error
1787
2079
  end
1788
2080
  self.bel_error = 0;
1789
2081
 
1790
2082
  class << self
1791
- attr_accessor :bel_en_ident
2083
+ attr_accessor :bel_en_ident_node
1792
2084
  end
1793
- self.bel_en_ident = 10;
2085
+ self.bel_en_ident_node = 7;
1794
2086
  class << self
1795
- attr_accessor :bel_en_string
2087
+ attr_accessor :bel_en_string_node
1796
2088
  end
1797
- self.bel_en_string = 12;
2089
+ self.bel_en_string_node = 8;
1798
2090
  class << self
1799
- attr_accessor :bel_en_list
2091
+ attr_accessor :bel_en_list_node
1800
2092
  end
1801
- self.bel_en_list = 1;
2093
+ self.bel_en_list_node = 1;
1802
2094
 
1803
2095
 
1804
- # end: ragel
2096
+ # end: ragel
1805
2097
  end
1806
2098
 
1807
2099
  def each
1808
- @buffers = {}
1809
- data = @content.unpack('C*')
1810
- p = 0
1811
- pe = data.length
1812
- eof = data.length
1813
-
1814
- # begin: ragel
2100
+ @buffers = {}
2101
+ @incomplete = {}
2102
+ @list_opened = false
2103
+ @list_closed = false
2104
+ data = @content.unpack('C*')
2105
+ p = 0
2106
+ pe = data.length
2107
+ eof = data.length
2108
+
2109
+ # begin: ragel
1815
2110
 
1816
2111
  begin
1817
2112
  p ||= 0
@@ -1856,506 +2151,585 @@ begin
1856
2151
  cs = _bel_trans_targs[_trans]
1857
2152
  if _bel_trans_actions[_trans] != 0
1858
2153
  case _bel_trans_actions[_trans]
1859
- when 19 then
2154
+ when 9 then
1860
2155
  begin
1861
2156
 
1862
- (@buffers[:ident] ||= []) << data[p].ord
2157
+ trace('IDENTIFIER start_identifier')
2158
+ @identifier_started = true
2159
+ id_start = p;
1863
2160
  end
1864
- when 10 then
2161
+ when 30 then
1865
2162
  begin
1866
2163
 
1867
- (@buffers[:string] ||= []) << data[p].ord
2164
+ trace('IDENTIFIER end_identifier')
2165
+ id_end = p
2166
+ chars = data[id_start...id_end]
2167
+ completed = !chars.empty?
2168
+ ast_node = identifier(utf8_string(chars), complete: completed)
2169
+ @buffers[:ident] = ast_node
1868
2170
  end
1869
- when 14 then
2171
+ when 24 then
1870
2172
  begin
1871
2173
 
1872
- @buffers.delete(:string)
1873
- @buffers.delete(:ident)
2174
+ trace('IDENTIFIER an_ident_err')
2175
+ id_end = p
2176
+ chars = data[id_start...id_end]
2177
+ ast_node = identifier(utf8_string(chars), complete: false)
2178
+ @buffers[:ident] = ast_node
1874
2179
  end
1875
- when 2 then
2180
+ when 29 then
1876
2181
  begin
1877
2182
 
1878
- @buffers[:list] = list()
2183
+ trace('IDENTIFIER ident_node_err')
2184
+ id_end = p
2185
+ chars = data[id_start...id_end]
2186
+ ast_node = identifier(utf8_string(chars), complete: false)
2187
+ yield ast_node
1879
2188
  end
1880
2189
  when 4 then
1881
2190
  begin
1882
2191
 
1883
- # Append list argument if its value is not empty.
1884
- if @buffers[:list_arg]
1885
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1886
- if list_arg_value != ''
1887
- @buffers[:list] <<= @buffers[:list_arg]
1888
- end
1889
- end
1890
- end
1891
- when 15 then
1892
- begin
1893
-
1894
- #TODO: Mark @buffers[:list] as complete.
1895
- end
1896
- when 21 then
1897
- begin
1898
-
1899
- yield @buffers[:list]
1900
- end
1901
- when 1 then
1902
- begin
1903
-
1904
- @buffers[:list] ||= list()
1905
- yield @buffers[:list]
1906
- end
1907
- when 7 then
1908
- begin
1909
-
1910
- @buffers[:ident] = []
1911
- end
1912
- begin
1913
-
1914
- (@buffers[:ident] ||= []) << data[p].ord
1915
- end
1916
- when 23 then
1917
- begin
1918
-
1919
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
2192
+ trace('STRING start_string')
2193
+ @string_opened = true
2194
+ p_start = p
1920
2195
  end
2196
+ when 2 then
1921
2197
  begin
1922
2198
 
1923
- yield @buffers[:ident]
2199
+ trace('STRING a_string_err')
2200
+ p_end = p
2201
+ chars = data[p_start...p_end]
2202
+ ast_node = string(utf8_string(chars), complete: false)
2203
+ @buffers[:string] = ast_node
1924
2204
  end
1925
- when 22 then
2205
+ when 11 then
1926
2206
  begin
1927
2207
 
1928
- unless @buffers[:ident].is_a?(::AST::Node)
1929
- @buffers[:ident] ||= []
1930
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
1931
- end
2208
+ trace('STRING string_node_err')
2209
+ p_end = p
2210
+ chars = data[p_start...p_end]
2211
+ ast_node = string(utf8_string(chars), complete: false)
2212
+ yield ast_node
1932
2213
  end
2214
+ when 16 then
1933
2215
  begin
1934
2216
 
1935
- @buffers[:ident] ||= []
1936
- yield @buffers[:ident]
2217
+ trace('LIST start_list')
2218
+ @list_opened = true
2219
+ @incomplete[:list] = list()
1937
2220
  end
1938
- when 5 then
2221
+ when 27 then
1939
2222
  begin
1940
2223
 
1941
- @buffers[:string] = []
2224
+ trace('LIST stop_list')
2225
+ @list_closed = true
1942
2226
  end
2227
+ when 21 then
1943
2228
  begin
1944
2229
 
1945
- (@buffers[:string] ||= []) << data[p].ord
2230
+ trace('LIST add_string')
2231
+ string = @buffers.delete(:string)
2232
+ item = list_item(string, complete: string.complete)
2233
+ @incomplete[:list] <<= item
1946
2234
  end
1947
2235
  when 25 then
1948
2236
  begin
1949
2237
 
1950
- @buffers[:string] = string(utf8_string(@buffers[:string]))
2238
+ trace('IDENTIFIER end_identifier')
2239
+ id_end = p
2240
+ chars = data[id_start...id_end]
2241
+ completed = !chars.empty?
2242
+ ast_node = identifier(utf8_string(chars), complete: completed)
2243
+ @buffers[:ident] = ast_node
1951
2244
  end
1952
2245
  begin
1953
2246
 
1954
- yield @buffers[:string]
1955
- end
1956
- when 24 then
1957
- begin
1958
-
1959
- @buffers[:string] ||= []
1960
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
1961
- end
1962
- begin
1963
-
1964
- @buffers[:string] ||= []
1965
- yield @buffers[:string]
2247
+ trace('LIST add_ident')
2248
+ ident = @buffers.delete(:ident)
2249
+ item = list_item(ident, complete: ident.complete)
2250
+ @incomplete[:list] <<= item
1966
2251
  end
1967
2252
  when 6 then
1968
2253
  begin
1969
2254
 
1970
- # Append list argument if its value is not empty.
1971
- if @buffers[:list_arg]
1972
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1973
- if list_arg_value != ''
1974
- @buffers[:list] <<= @buffers[:list_arg]
1975
- end
1976
- end
2255
+ trace('STRING stop_string')
2256
+ @string_closed = true
2257
+ p_end = p
1977
2258
  end
1978
2259
  begin
1979
2260
 
1980
- @buffers.delete(:string)
1981
- @buffers.delete(:ident)
2261
+ trace('STRING string_end')
2262
+ completed = @string_opened && @string_closed
2263
+ chars = data[p_start...p_end]
2264
+ ast_node = string(utf8_string(chars), complete: true)
2265
+ @buffers[:string] = ast_node
1982
2266
  end
1983
2267
  when 8 then
1984
2268
  begin
1985
2269
 
1986
- # Append list argument if its value is not empty.
1987
- if @buffers[:list_arg]
1988
- list_arg_value = @buffers[:list_arg].children[0].children[0]
1989
- if list_arg_value != ''
1990
- @buffers[:list] <<= @buffers[:list_arg]
1991
- end
1992
- end
2270
+ trace('STRING a_string_err')
2271
+ p_end = p
2272
+ chars = data[p_start...p_end]
2273
+ ast_node = string(utf8_string(chars), complete: false)
2274
+ @buffers[:string] = ast_node
1993
2275
  end
1994
2276
  begin
1995
2277
 
1996
- #TODO: Mark @buffers[:list] as complete.
2278
+ trace('IDENTIFIER an_ident_err')
2279
+ id_end = p
2280
+ chars = data[id_start...id_end]
2281
+ ast_node = identifier(utf8_string(chars), complete: false)
2282
+ @buffers[:ident] = ast_node
1997
2283
  end
1998
2284
  when 17 then
1999
2285
  begin
2000
2286
 
2001
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
2287
+ trace('LIST start_list')
2288
+ @list_opened = true
2289
+ @incomplete[:list] = list()
2002
2290
  end
2003
2291
  begin
2004
2292
 
2005
- @buffers[:list_arg] = list_item(@buffers[:ident])
2293
+ trace('IDENTIFIER start_identifier')
2294
+ @identifier_started = true
2295
+ id_start = p;
2006
2296
  end
2297
+ when 5 then
2007
2298
  begin
2008
2299
 
2009
- # Append list argument if its value is not empty.
2010
- if @buffers[:list_arg]
2011
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2012
- if list_arg_value != ''
2013
- @buffers[:list] <<= @buffers[:list_arg]
2014
- end
2015
- end
2300
+ trace('STRING start_string')
2301
+ @string_opened = true
2302
+ p_start = p
2016
2303
  end
2017
- when 11 then
2018
2304
  begin
2019
2305
 
2020
- @buffers[:string] = string(utf8_string(@buffers[:string]))
2306
+ trace('STRING stop_string')
2307
+ @string_closed = true
2308
+ p_end = p
2021
2309
  end
2022
2310
  begin
2023
2311
 
2024
- @buffers[:list_arg] = list_item(@buffers[:string])
2312
+ trace('STRING string_end')
2313
+ completed = @string_opened && @string_closed
2314
+ chars = data[p_start...p_end]
2315
+ ast_node = string(utf8_string(chars), complete: true)
2316
+ @buffers[:string] = ast_node
2025
2317
  end
2318
+ when 14 then
2026
2319
  begin
2027
2320
 
2028
- # Append list argument if its value is not empty.
2029
- if @buffers[:list_arg]
2030
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2031
- if list_arg_value != ''
2032
- @buffers[:list] <<= @buffers[:list_arg]
2033
- end
2034
- end
2321
+ trace('STRING stop_string')
2322
+ @string_closed = true
2323
+ p_end = p
2035
2324
  end
2036
- when 18 then
2037
2325
  begin
2038
2326
 
2039
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
2327
+ trace('STRING string_end')
2328
+ completed = @string_opened && @string_closed
2329
+ chars = data[p_start...p_end]
2330
+ ast_node = string(utf8_string(chars), complete: true)
2331
+ @buffers[:string] = ast_node
2040
2332
  end
2041
2333
  begin
2042
2334
 
2043
- @buffers[:list_arg] = list_item(@buffers[:ident])
2335
+ trace('STRING yield_string')
2336
+ yield @buffers[:string]
2044
2337
  end
2338
+ when 13 then
2045
2339
  begin
2046
2340
 
2047
- # Append list argument if its value is not empty.
2048
- if @buffers[:list_arg]
2049
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2050
- if list_arg_value != ''
2051
- @buffers[:list] <<= @buffers[:list_arg]
2052
- end
2053
- end
2341
+ trace('STRING start_string')
2342
+ @string_opened = true
2343
+ p_start = p
2054
2344
  end
2055
2345
  begin
2056
2346
 
2057
- @buffers.delete(:string)
2058
- @buffers.delete(:ident)
2347
+ trace('STRING stop_string')
2348
+ @string_closed = true
2349
+ p_end = p
2059
2350
  end
2060
- when 20 then
2061
2351
  begin
2062
2352
 
2063
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]))
2353
+ trace('STRING string_end')
2354
+ completed = @string_opened && @string_closed
2355
+ chars = data[p_start...p_end]
2356
+ ast_node = string(utf8_string(chars), complete: true)
2357
+ @buffers[:string] = ast_node
2064
2358
  end
2065
2359
  begin
2066
2360
 
2067
- @buffers[:list_arg] = list_item(@buffers[:ident])
2361
+ trace('STRING yield_string')
2362
+ yield @buffers[:string]
2068
2363
  end
2364
+ end
2365
+ end
2366
+ end
2367
+ if _goto_level <= _again
2368
+ if cs == 0
2369
+ _goto_level = _out
2370
+ next
2371
+ end
2372
+ p += 1
2373
+ if p != pe
2374
+ _goto_level = _resume
2375
+ next
2376
+ end
2377
+ end
2378
+ if _goto_level <= _test_eof
2379
+ if p == eof
2380
+ case _bel_eof_actions[cs]
2381
+ when 31 then
2069
2382
  begin
2070
2383
 
2071
- # Append list argument if its value is not empty.
2072
- if @buffers[:list_arg]
2073
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2074
- if list_arg_value != ''
2075
- @buffers[:list] <<= @buffers[:list_arg]
2076
- end
2077
- end
2384
+ trace('IDENTIFIER yield_identifier')
2385
+ yield @buffers[:ident]
2078
2386
  end
2387
+ when 28 then
2079
2388
  begin
2080
2389
 
2081
- #TODO: Mark @buffers[:list] as complete.
2390
+ trace('IDENTIFIER end_identifier')
2391
+ id_end = p
2392
+ chars = data[id_start...id_end]
2393
+ completed = !chars.empty?
2394
+ ast_node = identifier(utf8_string(chars), complete: completed)
2395
+ @buffers[:ident] = ast_node
2082
2396
  end
2083
- when 16 then
2084
2397
  begin
2085
2398
 
2086
- unless @buffers[:ident].is_a?(::AST::Node)
2087
- @buffers[:ident] ||= []
2088
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2089
- end
2399
+ trace('IDENTIFIER yield_identifier')
2400
+ yield @buffers[:ident]
2090
2401
  end
2402
+ when 1 then
2091
2403
  begin
2092
2404
 
2093
- #TODO: Mark @buffers[:list_arg] identifier as error.
2094
- @buffers[:list_arg] = list_item(@buffers[:ident])
2405
+ trace('STRING a_string_err')
2406
+ p_end = p
2407
+ chars = data[p_start...p_end]
2408
+ ast_node = string(utf8_string(chars), complete: false)
2409
+ @buffers[:string] = ast_node
2095
2410
  end
2096
2411
  begin
2097
2412
 
2098
- # Append list argument if its value is not empty.
2099
- if @buffers[:list_arg]
2100
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2101
- if list_arg_value != ''
2102
- @buffers[:list] <<= @buffers[:list_arg]
2103
- end
2104
- end
2413
+ trace('LIST list_node_eof')
2414
+ list = @incomplete.delete(:list)
2415
+ string = @buffers.delete(:string)
2416
+ item = list_item(string, complete: string.complete)
2417
+ list <<= item
2418
+ list.complete = false
2419
+ yield list
2105
2420
  end
2421
+ when 10 then
2106
2422
  begin
2107
2423
 
2108
- @buffers[:list] ||= list()
2109
- yield @buffers[:list]
2424
+ trace('STRING string_node_err')
2425
+ p_end = p
2426
+ chars = data[p_start...p_end]
2427
+ ast_node = string(utf8_string(chars), complete: false)
2428
+ yield ast_node
2110
2429
  end
2111
- when 12 then
2112
2430
  begin
2113
2431
 
2114
- @buffers[:string] = string(utf8_string(@buffers[:string]))
2432
+ trace('STRING string_node_eof')
2433
+ yield @buffers[:string]
2115
2434
  end
2435
+ when 22 then
2116
2436
  begin
2117
2437
 
2118
- @buffers[:list_arg] = list_item(@buffers[:string])
2438
+ trace('LIST list_end')
2439
+ if @list_opened && @list_closed
2440
+ list = @incomplete.delete(:list)
2441
+ list.complete = true
2442
+ elsif !@list_closed
2443
+ list = @incomplete.delete(:list)
2444
+ list.complete = false
2445
+ end
2446
+ @buffers[:list] = list
2119
2447
  end
2120
2448
  begin
2121
2449
 
2122
- # Append list argument if its value is not empty.
2123
- if @buffers[:list_arg]
2124
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2125
- if list_arg_value != ''
2126
- @buffers[:list] <<= @buffers[:list_arg]
2127
- end
2128
- end
2450
+ trace('LIST yield_list')
2451
+ yield @buffers[:list]
2129
2452
  end
2453
+ when 3 then
2130
2454
  begin
2131
2455
 
2132
- @buffers.delete(:string)
2133
- @buffers.delete(:ident)
2456
+ trace('STRING eof_string')
2457
+ p_end = p
2458
+ chars = data[p_start...p_end]
2459
+ ast_node = string(utf8_string(chars), complete: false)
2460
+ @buffers[:string] = ast_node
2134
2461
  end
2135
- when 13 then
2136
2462
  begin
2137
2463
 
2138
- @buffers[:string] = string(utf8_string(@buffers[:string]))
2464
+ trace('STRING a_string_err')
2465
+ p_end = p
2466
+ chars = data[p_start...p_end]
2467
+ ast_node = string(utf8_string(chars), complete: false)
2468
+ @buffers[:string] = ast_node
2139
2469
  end
2140
2470
  begin
2141
2471
 
2142
- @buffers[:list_arg] = list_item(@buffers[:string])
2472
+ trace('LIST list_node_eof')
2473
+ list = @incomplete.delete(:list)
2474
+ string = @buffers.delete(:string)
2475
+ item = list_item(string, complete: string.complete)
2476
+ list <<= item
2477
+ list.complete = false
2478
+ yield list
2143
2479
  end
2480
+ when 12 then
2144
2481
  begin
2145
2482
 
2146
- # Append list argument if its value is not empty.
2147
- if @buffers[:list_arg]
2148
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2149
- if list_arg_value != ''
2150
- @buffers[:list] <<= @buffers[:list_arg]
2151
- end
2152
- end
2483
+ trace('STRING eof_string')
2484
+ p_end = p
2485
+ chars = data[p_start...p_end]
2486
+ ast_node = string(utf8_string(chars), complete: false)
2487
+ @buffers[:string] = ast_node
2153
2488
  end
2154
2489
  begin
2155
2490
 
2156
- #TODO: Mark @buffers[:list] as complete.
2491
+ trace('STRING string_node_err')
2492
+ p_end = p
2493
+ chars = data[p_start...p_end]
2494
+ ast_node = string(utf8_string(chars), complete: false)
2495
+ yield ast_node
2157
2496
  end
2158
- when 9 then
2159
2497
  begin
2160
2498
 
2161
- @buffers[:string] ||= []
2162
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2499
+ trace('STRING string_node_eof')
2500
+ yield @buffers[:string]
2163
2501
  end
2502
+ when 26 then
2164
2503
  begin
2165
2504
 
2166
- #TODO: Mark @buffers[:list_arg] string as error.
2167
- @buffers[:list_arg] = list_item(@buffers[:string])
2505
+ trace('LIST stop_list')
2506
+ @list_closed = true
2168
2507
  end
2169
2508
  begin
2170
2509
 
2171
- # Append list argument if its value is not empty.
2172
- if @buffers[:list_arg]
2173
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2174
- if list_arg_value != ''
2175
- @buffers[:list] <<= @buffers[:list_arg]
2176
- end
2510
+ trace('LIST list_end')
2511
+ if @list_opened && @list_closed
2512
+ list = @incomplete.delete(:list)
2513
+ list.complete = true
2514
+ elsif !@list_closed
2515
+ list = @incomplete.delete(:list)
2516
+ list.complete = false
2177
2517
  end
2518
+ @buffers[:list] = list
2178
2519
  end
2179
2520
  begin
2180
2521
 
2181
- @buffers[:list] ||= list()
2522
+ trace('LIST yield_list')
2182
2523
  yield @buffers[:list]
2183
2524
  end
2184
- when 3 then
2525
+ when 20 then
2185
2526
  begin
2186
2527
 
2187
- @buffers[:string] ||= []
2188
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2528
+ trace('LIST add_string')
2529
+ string = @buffers.delete(:string)
2530
+ item = list_item(string, complete: string.complete)
2531
+ @incomplete[:list] <<= item
2189
2532
  end
2190
2533
  begin
2191
2534
 
2192
- #TODO: Mark @buffers[:list_arg] string as error.
2193
- @buffers[:list_arg] = list_item(@buffers[:string])
2535
+ trace('LIST list_end')
2536
+ if @list_opened && @list_closed
2537
+ list = @incomplete.delete(:list)
2538
+ list.complete = true
2539
+ elsif !@list_closed
2540
+ list = @incomplete.delete(:list)
2541
+ list.complete = false
2542
+ end
2543
+ @buffers[:list] = list
2194
2544
  end
2195
2545
  begin
2196
2546
 
2197
- unless @buffers[:ident].is_a?(::AST::Node)
2198
- @buffers[:ident] ||= []
2199
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2200
- end
2547
+ trace('LIST yield_list')
2548
+ yield @buffers[:list]
2201
2549
  end
2550
+ when 19 then
2202
2551
  begin
2203
2552
 
2204
- #TODO: Mark @buffers[:list_arg] identifier as error.
2205
- @buffers[:list_arg] = list_item(@buffers[:ident])
2553
+ trace('LIST list_node_eof')
2554
+ list = @incomplete.delete(:list)
2555
+ string = @buffers.delete(:string)
2556
+ item = list_item(string, complete: string.complete)
2557
+ list <<= item
2558
+ list.complete = false
2559
+ yield list
2206
2560
  end
2207
2561
  begin
2208
2562
 
2209
- # Append list argument if its value is not empty.
2210
- if @buffers[:list_arg]
2211
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2212
- if list_arg_value != ''
2213
- @buffers[:list] <<= @buffers[:list_arg]
2214
- end
2563
+ trace('LIST list_end')
2564
+ if @list_opened && @list_closed
2565
+ list = @incomplete.delete(:list)
2566
+ list.complete = true
2567
+ elsif !@list_closed
2568
+ list = @incomplete.delete(:list)
2569
+ list.complete = false
2215
2570
  end
2571
+ @buffers[:list] = list
2216
2572
  end
2217
2573
  begin
2218
2574
 
2219
- @buffers[:list] ||= list()
2575
+ trace('LIST yield_list')
2220
2576
  yield @buffers[:list]
2221
2577
  end
2222
- end
2223
- end
2224
- end
2225
- if _goto_level <= _again
2226
- if cs == 0
2227
- _goto_level = _out
2228
- next
2229
- end
2230
- p += 1
2231
- if p != pe
2232
- _goto_level = _resume
2233
- next
2234
- end
2235
- end
2236
- if _goto_level <= _test_eof
2237
- if p == eof
2238
- case _bel_eof_actions[cs]
2239
- when 1 then
2240
- begin
2241
-
2242
- @buffers[:list] ||= list()
2243
- yield @buffers[:list]
2244
- end
2245
- when 22 then
2578
+ when 18 then
2246
2579
  begin
2247
2580
 
2248
- unless @buffers[:ident].is_a?(::AST::Node)
2249
- @buffers[:ident] ||= []
2250
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2581
+ trace('IDENTIFIER an_ident_eof')
2582
+ if @identifier_started
2583
+ id_end = p
2584
+ chars = data[id_start...id_end]
2585
+ completed = !chars.empty?
2586
+ ast_node = identifier(utf8_string(chars), complete: completed)
2587
+ @buffers[:ident] = ast_node
2251
2588
  end
2252
2589
  end
2253
2590
  begin
2254
2591
 
2255
- @buffers[:ident] ||= []
2256
- yield @buffers[:ident]
2257
- end
2258
- when 24 then
2259
- begin
2260
-
2261
- @buffers[:string] ||= []
2262
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2592
+ trace('LIST list_node_eof')
2593
+ list = @incomplete.delete(:list)
2594
+ string = @buffers.delete(:string)
2595
+ item = list_item(string, complete: string.complete)
2596
+ list <<= item
2597
+ list.complete = false
2598
+ yield list
2263
2599
  end
2264
2600
  begin
2265
2601
 
2266
- @buffers[:string] ||= []
2267
- yield @buffers[:string]
2602
+ trace('LIST list_end')
2603
+ if @list_opened && @list_closed
2604
+ list = @incomplete.delete(:list)
2605
+ list.complete = true
2606
+ elsif !@list_closed
2607
+ list = @incomplete.delete(:list)
2608
+ list.complete = false
2609
+ end
2610
+ @buffers[:list] = list
2268
2611
  end
2269
- when 16 then
2270
2612
  begin
2271
2613
 
2272
- unless @buffers[:ident].is_a?(::AST::Node)
2273
- @buffers[:ident] ||= []
2274
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2275
- end
2614
+ trace('LIST yield_list')
2615
+ yield @buffers[:list]
2276
2616
  end
2617
+ when 7 then
2277
2618
  begin
2278
2619
 
2279
- #TODO: Mark @buffers[:list_arg] identifier as error.
2280
- @buffers[:list_arg] = list_item(@buffers[:ident])
2620
+ trace('STRING a_string_err')
2621
+ p_end = p
2622
+ chars = data[p_start...p_end]
2623
+ ast_node = string(utf8_string(chars), complete: false)
2624
+ @buffers[:string] = ast_node
2281
2625
  end
2282
2626
  begin
2283
2627
 
2284
- # Append list argument if its value is not empty.
2285
- if @buffers[:list_arg]
2286
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2287
- if list_arg_value != ''
2288
- @buffers[:list] <<= @buffers[:list_arg]
2289
- end
2628
+ trace('IDENTIFIER an_ident_eof')
2629
+ if @identifier_started
2630
+ id_end = p
2631
+ chars = data[id_start...id_end]
2632
+ completed = !chars.empty?
2633
+ ast_node = identifier(utf8_string(chars), complete: completed)
2634
+ @buffers[:ident] = ast_node
2290
2635
  end
2291
2636
  end
2292
2637
  begin
2293
2638
 
2294
- @buffers[:list] ||= list()
2295
- yield @buffers[:list]
2639
+ trace('IDENTIFIER an_ident_err')
2640
+ id_end = p
2641
+ chars = data[id_start...id_end]
2642
+ ast_node = identifier(utf8_string(chars), complete: false)
2643
+ @buffers[:ident] = ast_node
2296
2644
  end
2297
- when 9 then
2298
2645
  begin
2299
2646
 
2300
- @buffers[:string] ||= []
2301
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2647
+ trace('LIST list_node_eof')
2648
+ list = @incomplete.delete(:list)
2649
+ string = @buffers.delete(:string)
2650
+ item = list_item(string, complete: string.complete)
2651
+ list <<= item
2652
+ list.complete = false
2653
+ yield list
2302
2654
  end
2655
+ when 15 then
2303
2656
  begin
2304
2657
 
2305
- #TODO: Mark @buffers[:list_arg] string as error.
2306
- @buffers[:list_arg] = list_item(@buffers[:string])
2658
+ trace('LIST start_list')
2659
+ @list_opened = true
2660
+ @incomplete[:list] = list()
2307
2661
  end
2308
2662
  begin
2309
2663
 
2310
- # Append list argument if its value is not empty.
2311
- if @buffers[:list_arg]
2312
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2313
- if list_arg_value != ''
2314
- @buffers[:list] <<= @buffers[:list_arg]
2315
- end
2664
+ trace('IDENTIFIER an_ident_eof')
2665
+ if @identifier_started
2666
+ id_end = p
2667
+ chars = data[id_start...id_end]
2668
+ completed = !chars.empty?
2669
+ ast_node = identifier(utf8_string(chars), complete: completed)
2670
+ @buffers[:ident] = ast_node
2316
2671
  end
2317
2672
  end
2318
2673
  begin
2319
2674
 
2320
- @buffers[:list] ||= list()
2321
- yield @buffers[:list]
2675
+ trace('LIST list_end')
2676
+ if @list_opened && @list_closed
2677
+ list = @incomplete.delete(:list)
2678
+ list.complete = true
2679
+ elsif !@list_closed
2680
+ list = @incomplete.delete(:list)
2681
+ list.complete = false
2682
+ end
2683
+ @buffers[:list] = list
2322
2684
  end
2323
- when 3 then
2324
2685
  begin
2325
2686
 
2326
- @buffers[:string] ||= []
2327
- @buffers[:string] = string(utf8_string(@buffers[:string]).sub(/\n$/, ''))
2687
+ trace('LIST yield_list')
2688
+ yield @buffers[:list]
2328
2689
  end
2690
+ when 23 then
2329
2691
  begin
2330
2692
 
2331
- #TODO: Mark @buffers[:list_arg] string as error.
2332
- @buffers[:list_arg] = list_item(@buffers[:string])
2693
+ trace('IDENTIFIER end_identifier')
2694
+ id_end = p
2695
+ chars = data[id_start...id_end]
2696
+ completed = !chars.empty?
2697
+ ast_node = identifier(utf8_string(chars), complete: completed)
2698
+ @buffers[:ident] = ast_node
2333
2699
  end
2334
2700
  begin
2335
2701
 
2336
- unless @buffers[:ident].is_a?(::AST::Node)
2337
- @buffers[:ident] ||= []
2338
- @buffers[:ident] = identifier(utf8_string(@buffers[:ident]).sub(/\n$/, ''))
2702
+ trace('IDENTIFIER an_ident_eof')
2703
+ if @identifier_started
2704
+ id_end = p
2705
+ chars = data[id_start...id_end]
2706
+ completed = !chars.empty?
2707
+ ast_node = identifier(utf8_string(chars), complete: completed)
2708
+ @buffers[:ident] = ast_node
2339
2709
  end
2340
2710
  end
2341
2711
  begin
2342
2712
 
2343
- #TODO: Mark @buffers[:list_arg] identifier as error.
2344
- @buffers[:list_arg] = list_item(@buffers[:ident])
2713
+ trace('LIST add_ident')
2714
+ ident = @buffers.delete(:ident)
2715
+ item = list_item(ident, complete: ident.complete)
2716
+ @incomplete[:list] <<= item
2345
2717
  end
2346
2718
  begin
2347
2719
 
2348
- # Append list argument if its value is not empty.
2349
- if @buffers[:list_arg]
2350
- list_arg_value = @buffers[:list_arg].children[0].children[0]
2351
- if list_arg_value != ''
2352
- @buffers[:list] <<= @buffers[:list_arg]
2353
- end
2720
+ trace('LIST list_end')
2721
+ if @list_opened && @list_closed
2722
+ list = @incomplete.delete(:list)
2723
+ list.complete = true
2724
+ elsif !@list_closed
2725
+ list = @incomplete.delete(:list)
2726
+ list.complete = false
2354
2727
  end
2728
+ @buffers[:list] = list
2355
2729
  end
2356
2730
  begin
2357
2731
 
2358
- @buffers[:list] ||= list()
2732
+ trace('LIST yield_list')
2359
2733
  yield @buffers[:list]
2360
2734
  end
2361
2735
  end
@@ -2368,7 +2742,7 @@ begin
2368
2742
  end
2369
2743
  end
2370
2744
 
2371
- # end: ragel
2745
+ # end: ragel
2372
2746
  end
2373
2747
  end
2374
2748
  end