modl 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d523ed6cc09d2f413a4f0df27405a219d107c5f5219e2a8fcb2acb78f3f42370
4
- data.tar.gz: 0cb8e6e85ca9d0421f87ca0a77532fe1a1c740864007136826b60eacab73f9ec
3
+ metadata.gz: 0caf497c5981059ad90756e23646d96305d942e8156c65c38c4bb5afc9c062dd
4
+ data.tar.gz: 10025546c2ff729584277b5bfbe6c0da573dbd3619878224349095ac5397c69f
5
5
  SHA512:
6
- metadata.gz: d3aa20fafe4caddf80691a676ff0e3e60c6a12b75a0831594d2dd676f31a9198926b4deef043502d9855bb247673368df449b74793db279afd9f162e4e88e030
7
- data.tar.gz: 61414bce44abce673ce36303aa53aa981cf8445fd22d43a7843dc8d6fa906f4a466da3726bb883a730ead90daeb773df0a17eafd486dfd024a0ee1963344b2bd
6
+ metadata.gz: 25913fd65a62f4d5ad0cadc7368a9443e79b542568deabb8286e4ae9617e57e944a819c4803d0fd45c1bbdce89a62d4ac2dace2e9620ce39c8d89824116951d4
7
+ data.tar.gz: 7b9a44c8e7babe192a884a8df6b5c07c9cec48cb73194c3c86bead81082916e3ab11d73324a9152b15c0e39bc57b23008ed82247fa25175c11c69456fa71c099
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ 0.3.6
2
+ ===
3
+ - Use latest ANTLR4 Ruby.stg updated by Cameron Dutro.
4
+ - Use antrl4-runtime v0.2.2 which fixes some issues around Array2DHashSet
5
+ - Fixed a failing error test due to incorrect value type for a `*class` with supertype `num`.
6
+ - Corrected the ordering of fields within a class.
7
+ - Return `null` for empty output rather than `""`
8
+ - Fixed GitHub issue#4 - improved error reporting.
9
+
1
10
  0.3.5
2
11
  ===
3
12
  - Fixed another bug with class handling to expand classes properly.
@@ -590,7 +590,7 @@
590
590
  }, {
591
591
  "input": "_L=en;\n{\n C=ca?\n o(\n n=Tesco Canada;\n s={L=fr?\n Chaque Petite Contribution\n /?\n Every Little Helps\n }\n )\n}",
592
592
  "minimised_modl": "_L=en;{C=ca?o(n=Tesco Canada;s={L=fr?Chaque Petite Contribution/?Every Little Helps})}",
593
- "expected_output": "\n"
593
+ "expected_output": "null"
594
594
  }, {
595
595
  "input": "_letter=a;\n{\n letter=a?\n word=Apple\n /letter=b?\n word=Bee\n /?\n word=Other\n}",
596
596
  "minimised_modl": "_letter=a;{letter=a?word=Apple/letter=b?word=Bee/?word=Other}",
@@ -634,7 +634,7 @@
634
634
  }, {
635
635
  "input": "_test = 123;\n_test2 = abc",
636
636
  "minimised_modl": "_test=123;_test2=abc",
637
- "expected_output": "\n"
637
+ "expected_output": "null"
638
638
  }, {
639
639
  "input": "_co=gb;\ntest=123",
640
640
  "minimised_modl": "_co=gb;test=123",
@@ -698,7 +698,7 @@
698
698
  }, {
699
699
  "input": "_T=grammar_tests/demo;\n*L=`%T`_config",
700
700
  "minimised_modl": "_T=grammar_tests/demo;*L=`%T`_config",
701
- "expected_output": "\n"
701
+ "expected_output": "null"
702
702
  }, {
703
703
  "input": "*l=grammar_tests/1;*L=grammar_tests/1;a=1",
704
704
  "minimised_modl": "*l=grammar_tests/1;*L=grammar_tests/1;a=1",
@@ -995,5 +995,5 @@
995
995
  "expected_output": "{\"x\" : [ 1, null, null, null, null, null, null, [2, null, null, null, null, null, null, null, null, 3], null, null, null, null, null, null, null, null, null, [4, null, null, null, null, null, null, null, null, 5] ]}"},
996
996
  {"input": "*LOAD=\"http://modules.num.uk/1.txt\";o=Tesco:Every Little Helps:[t=Customer Service:0845555555];",
997
997
  "minimised_modl": "*LOAD=\"http://modules.num.uk/1.txt\";o=Tesco:Every Little Helps:[t=Customer Service:0845555555];",
998
- "expected_output": "{\n \"organisation\": {\n \"object_type\": \"entity\",\n \"object_display_name\": \"Organisation\",\n \"description_default\": \"View Organisation\",\n \"name\": \"Tesco\",\n \"slogan\": \"Every Little Helps\",\n \"objects\": [\n {\n \"telephone\": {\n \"object_type\": \"media\",\n \"object_display_name\": \"Telephone\",\n \"description_default\": \"Call\",\n \"prefix\": \"tel://\",\n \"media_type\": \"core\",\n \"description\": \"Customer Service\",\n \"value\": \"0845555555\"\n }\n }\n ]\n }\n}\n"}
998
+ "expected_output": "{\"organisation\":{\"name\":\"Tesco\",\"slogan\":\"Every Little Helps\",\"objects\":[{\"telephone\":{\"description\":\"Customer Service\",\"value\":\"0845555555\",\"object_type\":\"media\",\"object_display_name\":\"Telephone\",\"description_default\":\"Call\",\"prefix\":\"tel://\",\"media_type\":\"core\"}}],\"object_type\":\"entity\",\"object_display_name\":\"Organisation\",\"description_default\":\"View Organisation\"}}"}
999
999
  ]
@@ -128,9 +128,9 @@ class MODLParser < Antlr4::Runtime::Parser
128
128
  end
129
129
 
130
130
  class ModlContext < Antlr4::Runtime::ParserRuleContext
131
- def EOF()
132
- return token(MODLParser::EOF, 0)
133
- end
131
+ def EOF()
132
+ return token(MODLParser::EOF, 0)
133
+ end
134
134
  def modl_structure()
135
135
  return rule_contexts("Modl_structureContext")
136
136
  end
@@ -150,18 +150,18 @@ class MODLParser < Antlr4::Runtime::Parser
150
150
  return RULE_modl
151
151
  end
152
152
  def enter_rule( listener)
153
- if ( listener.is_a? MODLParserListener )
153
+ if (listener.respond_to?(:enterModl))
154
154
  listener.enterModl(self)
155
155
  end
156
156
  end
157
157
  def exit_rule( listener)
158
- if ( listener.is_a? MODLParserListener )
158
+ if (listener.respond_to?(:exitModl))
159
159
  listener.exitModl(self)
160
160
  end
161
161
  end
162
162
 
163
163
  def accept(visitor)
164
- if ( visitor.is_a? MODLParserVisitor )
164
+ if (visitor.respond_to?(:visitModl))
165
165
  return visitor.visitModl(self)
166
166
  else
167
167
  return visitor.visit_children(self)
@@ -175,9 +175,9 @@ class MODLParser < Antlr4::Runtime::Parser
175
175
  _la = 0
176
176
  begin
177
177
  _alt = 0
178
- enter_outer_alt(_localctx, 1)
178
+ enter_outer_alt(_localctx, 1)
179
179
 
180
- @_state_number = 62
180
+ @_state_number = 62
181
181
  @_err_handler.sync(self)
182
182
  case ( @_interp.adaptive_predict(@_input,3,@_ctx) )
183
183
  when 1
@@ -224,9 +224,9 @@ class MODLParser < Antlr4::Runtime::Parser
224
224
  end
225
225
 
226
226
 
227
- end
228
- @_state_number = 64
229
- match(EOF)
227
+ end
228
+ @_state_number = 64
229
+ match(EOF)
230
230
  rescue Antlr4::Runtime::RecognitionException => re
231
231
  _localctx.exception = re
232
232
  @_err_handler.report_error(self, re)
@@ -257,18 +257,18 @@ class MODLParser < Antlr4::Runtime::Parser
257
257
  return RULE_modl_structure
258
258
  end
259
259
  def enter_rule( listener)
260
- if ( listener.is_a? MODLParserListener )
260
+ if (listener.respond_to?(:enterModl_structure))
261
261
  listener.enterModl_structure(self)
262
262
  end
263
263
  end
264
264
  def exit_rule( listener)
265
- if ( listener.is_a? MODLParserListener )
265
+ if (listener.respond_to?(:exitModl_structure))
266
266
  listener.exitModl_structure(self)
267
267
  end
268
268
  end
269
269
 
270
270
  def accept(visitor)
271
- if ( visitor.is_a? MODLParserVisitor )
271
+ if (visitor.respond_to?(:visitModl_structure))
272
272
  return visitor.visitModl_structure(self)
273
273
  else
274
274
  return visitor.visit_children(self)
@@ -345,18 +345,18 @@ class MODLParser < Antlr4::Runtime::Parser
345
345
  return RULE_modl_map
346
346
  end
347
347
  def enter_rule( listener)
348
- if ( listener.is_a? MODLParserListener )
348
+ if (listener.respond_to?(:enterModl_map))
349
349
  listener.enterModl_map(self)
350
350
  end
351
351
  end
352
352
  def exit_rule( listener)
353
- if ( listener.is_a? MODLParserListener )
353
+ if (listener.respond_to?(:exitModl_map))
354
354
  listener.exitModl_map(self)
355
355
  end
356
356
  end
357
357
 
358
358
  def accept(visitor)
359
- if ( visitor.is_a? MODLParserVisitor )
359
+ if (visitor.respond_to?(:visitModl_map))
360
360
  return visitor.visitModl_map(self)
361
361
  else
362
362
  return visitor.visit_children(self)
@@ -440,18 +440,18 @@ class MODLParser < Antlr4::Runtime::Parser
440
440
  return RULE_modl_array
441
441
  end
442
442
  def enter_rule( listener)
443
- if ( listener.is_a? MODLParserListener )
443
+ if (listener.respond_to?(:enterModl_array))
444
444
  listener.enterModl_array(self)
445
445
  end
446
446
  end
447
447
  def exit_rule( listener)
448
- if ( listener.is_a? MODLParserListener )
448
+ if (listener.respond_to?(:exitModl_array))
449
449
  listener.exitModl_array(self)
450
450
  end
451
451
  end
452
452
 
453
453
  def accept(visitor)
454
- if ( visitor.is_a? MODLParserVisitor )
454
+ if (visitor.respond_to?(:visitModl_array))
455
455
  return visitor.visitModl_array(self)
456
456
  else
457
457
  return visitor.visit_children(self)
@@ -573,18 +573,18 @@ class MODLParser < Antlr4::Runtime::Parser
573
573
  return RULE_modl_nb_array
574
574
  end
575
575
  def enter_rule( listener)
576
- if ( listener.is_a? MODLParserListener )
576
+ if (listener.respond_to?(:enterModl_nb_array))
577
577
  listener.enterModl_nb_array(self)
578
578
  end
579
579
  end
580
580
  def exit_rule( listener)
581
- if ( listener.is_a? MODLParserListener )
581
+ if (listener.respond_to?(:exitModl_nb_array))
582
582
  listener.exitModl_nb_array(self)
583
583
  end
584
584
  end
585
585
 
586
586
  def accept(visitor)
587
- if ( visitor.is_a? MODLParserVisitor )
587
+ if (visitor.respond_to?(:visitModl_nb_array))
588
588
  return visitor.visitModl_nb_array(self)
589
589
  else
590
590
  return visitor.visit_children(self)
@@ -708,18 +708,18 @@ class MODLParser < Antlr4::Runtime::Parser
708
708
  return RULE_modl_pair
709
709
  end
710
710
  def enter_rule( listener)
711
- if ( listener.is_a? MODLParserListener )
711
+ if (listener.respond_to?(:enterModl_pair))
712
712
  listener.enterModl_pair(self)
713
713
  end
714
714
  end
715
715
  def exit_rule( listener)
716
- if ( listener.is_a? MODLParserListener )
716
+ if (listener.respond_to?(:exitModl_pair))
717
717
  listener.exitModl_pair(self)
718
718
  end
719
719
  end
720
720
 
721
721
  def accept(visitor)
722
- if ( visitor.is_a? MODLParserVisitor )
722
+ if (visitor.respond_to?(:visitModl_pair))
723
723
  return visitor.visitModl_pair(self)
724
724
  else
725
725
  return visitor.visit_children(self)
@@ -796,18 +796,18 @@ class MODLParser < Antlr4::Runtime::Parser
796
796
  return RULE_modl_value_item
797
797
  end
798
798
  def enter_rule( listener)
799
- if ( listener.is_a? MODLParserListener )
799
+ if (listener.respond_to?(:enterModl_value_item))
800
800
  listener.enterModl_value_item(self)
801
801
  end
802
802
  end
803
803
  def exit_rule( listener)
804
- if ( listener.is_a? MODLParserListener )
804
+ if (listener.respond_to?(:exitModl_value_item))
805
805
  listener.exitModl_value_item(self)
806
806
  end
807
807
  end
808
808
 
809
809
  def accept(visitor)
810
- if ( visitor.is_a? MODLParserVisitor )
810
+ if (visitor.respond_to?(:visitModl_value_item))
811
811
  return visitor.visitModl_value_item(self)
812
812
  else
813
813
  return visitor.visit_children(self)
@@ -883,18 +883,18 @@ class MODLParser < Antlr4::Runtime::Parser
883
883
  return RULE_modl_top_level_conditional
884
884
  end
885
885
  def enter_rule( listener)
886
- if ( listener.is_a? MODLParserListener )
886
+ if (listener.respond_to?(:enterModl_top_level_conditional))
887
887
  listener.enterModl_top_level_conditional(self)
888
888
  end
889
889
  end
890
890
  def exit_rule( listener)
891
- if ( listener.is_a? MODLParserListener )
891
+ if (listener.respond_to?(:exitModl_top_level_conditional))
892
892
  listener.exitModl_top_level_conditional(self)
893
893
  end
894
894
  end
895
895
 
896
896
  def accept(visitor)
897
- if ( visitor.is_a? MODLParserVisitor )
897
+ if (visitor.respond_to?(:visitModl_top_level_conditional))
898
898
  return visitor.visitModl_top_level_conditional(self)
899
899
  else
900
900
  return visitor.visit_children(self)
@@ -968,18 +968,18 @@ class MODLParser < Antlr4::Runtime::Parser
968
968
  return RULE_modl_top_level_conditional_return
969
969
  end
970
970
  def enter_rule( listener)
971
- if ( listener.is_a? MODLParserListener )
971
+ if (listener.respond_to?(:enterModl_top_level_conditional_return))
972
972
  listener.enterModl_top_level_conditional_return(self)
973
973
  end
974
974
  end
975
975
  def exit_rule( listener)
976
- if ( listener.is_a? MODLParserListener )
976
+ if (listener.respond_to?(:exitModl_top_level_conditional_return))
977
977
  listener.exitModl_top_level_conditional_return(self)
978
978
  end
979
979
  end
980
980
 
981
981
  def accept(visitor)
982
- if ( visitor.is_a? MODLParserVisitor )
982
+ if (visitor.respond_to?(:visitModl_top_level_conditional_return))
983
983
  return visitor.visitModl_top_level_conditional_return(self)
984
984
  else
985
985
  return visitor.visit_children(self)
@@ -1054,18 +1054,18 @@ class MODLParser < Antlr4::Runtime::Parser
1054
1054
  return RULE_modl_map_conditional
1055
1055
  end
1056
1056
  def enter_rule( listener)
1057
- if ( listener.is_a? MODLParserListener )
1057
+ if (listener.respond_to?(:enterModl_map_conditional))
1058
1058
  listener.enterModl_map_conditional(self)
1059
1059
  end
1060
1060
  end
1061
1061
  def exit_rule( listener)
1062
- if ( listener.is_a? MODLParserListener )
1062
+ if (listener.respond_to?(:exitModl_map_conditional))
1063
1063
  listener.exitModl_map_conditional(self)
1064
1064
  end
1065
1065
  end
1066
1066
 
1067
1067
  def accept(visitor)
1068
- if ( visitor.is_a? MODLParserVisitor )
1068
+ if (visitor.respond_to?(:visitModl_map_conditional))
1069
1069
  return visitor.visitModl_map_conditional(self)
1070
1070
  else
1071
1071
  return visitor.visit_children(self)
@@ -1139,18 +1139,18 @@ class MODLParser < Antlr4::Runtime::Parser
1139
1139
  return RULE_modl_map_conditional_return
1140
1140
  end
1141
1141
  def enter_rule( listener)
1142
- if ( listener.is_a? MODLParserListener )
1142
+ if (listener.respond_to?(:enterModl_map_conditional_return))
1143
1143
  listener.enterModl_map_conditional_return(self)
1144
1144
  end
1145
1145
  end
1146
1146
  def exit_rule( listener)
1147
- if ( listener.is_a? MODLParserListener )
1147
+ if (listener.respond_to?(:exitModl_map_conditional_return))
1148
1148
  listener.exitModl_map_conditional_return(self)
1149
1149
  end
1150
1150
  end
1151
1151
 
1152
1152
  def accept(visitor)
1153
- if ( visitor.is_a? MODLParserVisitor )
1153
+ if (visitor.respond_to?(:visitModl_map_conditional_return))
1154
1154
  return visitor.visitModl_map_conditional_return(self)
1155
1155
  else
1156
1156
  return visitor.visit_children(self)
@@ -1202,18 +1202,18 @@ class MODLParser < Antlr4::Runtime::Parser
1202
1202
  return RULE_modl_map_item
1203
1203
  end
1204
1204
  def enter_rule( listener)
1205
- if ( listener.is_a? MODLParserListener )
1205
+ if (listener.respond_to?(:enterModl_map_item))
1206
1206
  listener.enterModl_map_item(self)
1207
1207
  end
1208
1208
  end
1209
1209
  def exit_rule( listener)
1210
- if ( listener.is_a? MODLParserListener )
1210
+ if (listener.respond_to?(:exitModl_map_item))
1211
1211
  listener.exitModl_map_item(self)
1212
1212
  end
1213
1213
  end
1214
1214
 
1215
1215
  def accept(visitor)
1216
- if ( visitor.is_a? MODLParserVisitor )
1216
+ if (visitor.respond_to?(:visitModl_map_item))
1217
1217
  return visitor.visitModl_map_item(self)
1218
1218
  else
1219
1219
  return visitor.visit_children(self)
@@ -1290,18 +1290,18 @@ class MODLParser < Antlr4::Runtime::Parser
1290
1290
  return RULE_modl_array_conditional
1291
1291
  end
1292
1292
  def enter_rule( listener)
1293
- if ( listener.is_a? MODLParserListener )
1293
+ if (listener.respond_to?(:enterModl_array_conditional))
1294
1294
  listener.enterModl_array_conditional(self)
1295
1295
  end
1296
1296
  end
1297
1297
  def exit_rule( listener)
1298
- if ( listener.is_a? MODLParserListener )
1298
+ if (listener.respond_to?(:exitModl_array_conditional))
1299
1299
  listener.exitModl_array_conditional(self)
1300
1300
  end
1301
1301
  end
1302
1302
 
1303
1303
  def accept(visitor)
1304
- if ( visitor.is_a? MODLParserVisitor )
1304
+ if (visitor.respond_to?(:visitModl_array_conditional))
1305
1305
  return visitor.visitModl_array_conditional(self)
1306
1306
  else
1307
1307
  return visitor.visit_children(self)
@@ -1375,18 +1375,18 @@ class MODLParser < Antlr4::Runtime::Parser
1375
1375
  return RULE_modl_array_conditional_return
1376
1376
  end
1377
1377
  def enter_rule( listener)
1378
- if ( listener.is_a? MODLParserListener )
1378
+ if (listener.respond_to?(:enterModl_array_conditional_return))
1379
1379
  listener.enterModl_array_conditional_return(self)
1380
1380
  end
1381
1381
  end
1382
1382
  def exit_rule( listener)
1383
- if ( listener.is_a? MODLParserListener )
1383
+ if (listener.respond_to?(:exitModl_array_conditional_return))
1384
1384
  listener.exitModl_array_conditional_return(self)
1385
1385
  end
1386
1386
  end
1387
1387
 
1388
1388
  def accept(visitor)
1389
- if ( visitor.is_a? MODLParserVisitor )
1389
+ if (visitor.respond_to?(:visitModl_array_conditional_return))
1390
1390
  return visitor.visitModl_array_conditional_return(self)
1391
1391
  else
1392
1392
  return visitor.visit_children(self)
@@ -1438,18 +1438,18 @@ class MODLParser < Antlr4::Runtime::Parser
1438
1438
  return RULE_modl_array_item
1439
1439
  end
1440
1440
  def enter_rule( listener)
1441
- if ( listener.is_a? MODLParserListener )
1441
+ if (listener.respond_to?(:enterModl_array_item))
1442
1442
  listener.enterModl_array_item(self)
1443
1443
  end
1444
1444
  end
1445
1445
  def exit_rule( listener)
1446
- if ( listener.is_a? MODLParserListener )
1446
+ if (listener.respond_to?(:exitModl_array_item))
1447
1447
  listener.exitModl_array_item(self)
1448
1448
  end
1449
1449
  end
1450
1450
 
1451
1451
  def accept(visitor)
1452
- if ( visitor.is_a? MODLParserVisitor )
1452
+ if (visitor.respond_to?(:visitModl_array_item))
1453
1453
  return visitor.visitModl_array_item(self)
1454
1454
  else
1455
1455
  return visitor.visit_children(self)
@@ -1526,18 +1526,18 @@ class MODLParser < Antlr4::Runtime::Parser
1526
1526
  return RULE_modl_value_conditional
1527
1527
  end
1528
1528
  def enter_rule( listener)
1529
- if ( listener.is_a? MODLParserListener )
1529
+ if (listener.respond_to?(:enterModl_value_conditional))
1530
1530
  listener.enterModl_value_conditional(self)
1531
1531
  end
1532
1532
  end
1533
1533
  def exit_rule( listener)
1534
- if ( listener.is_a? MODLParserListener )
1534
+ if (listener.respond_to?(:exitModl_value_conditional))
1535
1535
  listener.exitModl_value_conditional(self)
1536
1536
  end
1537
1537
  end
1538
1538
 
1539
1539
  def accept(visitor)
1540
- if ( visitor.is_a? MODLParserVisitor )
1540
+ if (visitor.respond_to?(:visitModl_value_conditional))
1541
1541
  return visitor.visitModl_value_conditional(self)
1542
1542
  else
1543
1543
  return visitor.visit_children(self)
@@ -1627,18 +1627,18 @@ class MODLParser < Antlr4::Runtime::Parser
1627
1627
  return RULE_modl_value_conditional_return
1628
1628
  end
1629
1629
  def enter_rule( listener)
1630
- if ( listener.is_a? MODLParserListener )
1630
+ if (listener.respond_to?(:enterModl_value_conditional_return))
1631
1631
  listener.enterModl_value_conditional_return(self)
1632
1632
  end
1633
1633
  end
1634
1634
  def exit_rule( listener)
1635
- if ( listener.is_a? MODLParserListener )
1635
+ if (listener.respond_to?(:exitModl_value_conditional_return))
1636
1636
  listener.exitModl_value_conditional_return(self)
1637
1637
  end
1638
1638
  end
1639
1639
 
1640
1640
  def accept(visitor)
1641
- if ( visitor.is_a? MODLParserVisitor )
1641
+ if (visitor.respond_to?(:visitModl_value_conditional_return))
1642
1642
  return visitor.visitModl_value_conditional_return(self)
1643
1643
  else
1644
1644
  return visitor.visit_children(self)
@@ -1717,18 +1717,18 @@ class MODLParser < Antlr4::Runtime::Parser
1717
1717
  return RULE_modl_condition_test
1718
1718
  end
1719
1719
  def enter_rule( listener)
1720
- if ( listener.is_a? MODLParserListener )
1720
+ if (listener.respond_to?(:enterModl_condition_test))
1721
1721
  listener.enterModl_condition_test(self)
1722
1722
  end
1723
1723
  end
1724
1724
  def exit_rule( listener)
1725
- if ( listener.is_a? MODLParserListener )
1725
+ if (listener.respond_to?(:exitModl_condition_test))
1726
1726
  listener.exitModl_condition_test(self)
1727
1727
  end
1728
1728
  end
1729
1729
 
1730
1730
  def accept(visitor)
1731
- if ( visitor.is_a? MODLParserVisitor )
1731
+ if (visitor.respond_to?(:visitModl_condition_test))
1732
1732
  return visitor.visitModl_condition_test(self)
1733
1733
  else
1734
1734
  return visitor.visit_children(self)
@@ -1844,18 +1844,18 @@ class MODLParser < Antlr4::Runtime::Parser
1844
1844
  return RULE_modl_operator
1845
1845
  end
1846
1846
  def enter_rule( listener)
1847
- if ( listener.is_a? MODLParserListener )
1847
+ if (listener.respond_to?(:enterModl_operator))
1848
1848
  listener.enterModl_operator(self)
1849
1849
  end
1850
1850
  end
1851
1851
  def exit_rule( listener)
1852
- if ( listener.is_a? MODLParserListener )
1852
+ if (listener.respond_to?(:exitModl_operator))
1853
1853
  listener.exitModl_operator(self)
1854
1854
  end
1855
1855
  end
1856
1856
 
1857
1857
  def accept(visitor)
1858
- if ( visitor.is_a? MODLParserVisitor )
1858
+ if (visitor.respond_to?(:visitModl_operator))
1859
1859
  return visitor.visitModl_operator(self)
1860
1860
  else
1861
1861
  return visitor.visit_children(self)
@@ -1949,18 +1949,18 @@ class MODLParser < Antlr4::Runtime::Parser
1949
1949
  return RULE_modl_condition
1950
1950
  end
1951
1951
  def enter_rule( listener)
1952
- if ( listener.is_a? MODLParserListener )
1952
+ if (listener.respond_to?(:enterModl_condition))
1953
1953
  listener.enterModl_condition(self)
1954
1954
  end
1955
1955
  end
1956
1956
  def exit_rule( listener)
1957
- if ( listener.is_a? MODLParserListener )
1957
+ if (listener.respond_to?(:exitModl_condition))
1958
1958
  listener.exitModl_condition(self)
1959
1959
  end
1960
1960
  end
1961
1961
 
1962
1962
  def accept(visitor)
1963
- if ( visitor.is_a? MODLParserVisitor )
1963
+ if (visitor.respond_to?(:visitModl_condition))
1964
1964
  return visitor.visitModl_condition(self)
1965
1965
  else
1966
1966
  return visitor.visit_children(self)
@@ -2051,18 +2051,18 @@ class MODLParser < Antlr4::Runtime::Parser
2051
2051
  return RULE_modl_condition_group
2052
2052
  end
2053
2053
  def enter_rule( listener)
2054
- if ( listener.is_a? MODLParserListener )
2054
+ if (listener.respond_to?(:enterModl_condition_group))
2055
2055
  listener.enterModl_condition_group(self)
2056
2056
  end
2057
2057
  end
2058
2058
  def exit_rule( listener)
2059
- if ( listener.is_a? MODLParserListener )
2059
+ if (listener.respond_to?(:exitModl_condition_group))
2060
2060
  listener.exitModl_condition_group(self)
2061
2061
  end
2062
2062
  end
2063
2063
 
2064
2064
  def accept(visitor)
2065
- if ( visitor.is_a? MODLParserVisitor )
2065
+ if (visitor.respond_to?(:visitModl_condition_group))
2066
2066
  return visitor.visitModl_condition_group(self)
2067
2067
  else
2068
2068
  return visitor.visit_children(self)
@@ -2140,18 +2140,18 @@ class MODLParser < Antlr4::Runtime::Parser
2140
2140
  return RULE_modl_value
2141
2141
  end
2142
2142
  def enter_rule( listener)
2143
- if ( listener.is_a? MODLParserListener )
2143
+ if (listener.respond_to?(:enterModl_value))
2144
2144
  listener.enterModl_value(self)
2145
2145
  end
2146
2146
  end
2147
2147
  def exit_rule( listener)
2148
- if ( listener.is_a? MODLParserListener )
2148
+ if (listener.respond_to?(:exitModl_value))
2149
2149
  listener.exitModl_value(self)
2150
2150
  end
2151
2151
  end
2152
2152
 
2153
2153
  def accept(visitor)
2154
- if ( visitor.is_a? MODLParserVisitor )
2154
+ if (visitor.respond_to?(:visitModl_value))
2155
2155
  return visitor.visitModl_value(self)
2156
2156
  else
2157
2157
  return visitor.visit_children(self)
@@ -2227,18 +2227,18 @@ class MODLParser < Antlr4::Runtime::Parser
2227
2227
  return RULE_modl_array_value_item
2228
2228
  end
2229
2229
  def enter_rule( listener)
2230
- if ( listener.is_a? MODLParserListener )
2230
+ if (listener.respond_to?(:enterModl_array_value_item))
2231
2231
  listener.enterModl_array_value_item(self)
2232
2232
  end
2233
2233
  end
2234
2234
  def exit_rule( listener)
2235
- if ( listener.is_a? MODLParserListener )
2235
+ if (listener.respond_to?(:exitModl_array_value_item))
2236
2236
  listener.exitModl_array_value_item(self)
2237
2237
  end
2238
2238
  end
2239
2239
 
2240
2240
  def accept(visitor)
2241
- if ( visitor.is_a? MODLParserVisitor )
2241
+ if (visitor.respond_to?(:visitModl_array_value_item))
2242
2242
  return visitor.visitModl_array_value_item(self)
2243
2243
  else
2244
2244
  return visitor.visit_children(self)
@@ -2314,18 +2314,18 @@ class MODLParser < Antlr4::Runtime::Parser
2314
2314
  return RULE_modl_primitive
2315
2315
  end
2316
2316
  def enter_rule( listener)
2317
- if ( listener.is_a? MODLParserListener )
2317
+ if (listener.respond_to?(:enterModl_primitive))
2318
2318
  listener.enterModl_primitive(self)
2319
2319
  end
2320
2320
  end
2321
2321
  def exit_rule( listener)
2322
- if ( listener.is_a? MODLParserListener )
2322
+ if (listener.respond_to?(:exitModl_primitive))
2323
2323
  listener.exitModl_primitive(self)
2324
2324
  end
2325
2325
  end
2326
2326
 
2327
2327
  def accept(visitor)
2328
- if ( visitor.is_a? MODLParserVisitor )
2328
+ if (visitor.respond_to?(:visitModl_primitive))
2329
2329
  return visitor.visitModl_primitive(self)
2330
2330
  else
2331
2331
  return visitor.visit_children(self)
@@ -2363,128 +2363,128 @@ class MODLParser < Antlr4::Runtime::Parser
2363
2363
  end
2364
2364
 
2365
2365
  @@_serializedATN = ["\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
2366
- "\3 \u0145\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4",
2367
- "\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t",
2368
- "\20\4\21\t\21\4\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27",
2369
- "\t\27\4\30\t\30\4\31\t\31\3\2\5\2\64\n\2\3\2\3\2\3\2\7\29\n\2\f\2\16",
2370
- "\2<\13\2\3\2\5\2?\n\2\5\2A\n\2\3\2\3\2\3\3\3\3\3\3\3\3\5\3I\n\3\3\4",
2371
- "\3\4\3\4\3\4\7\4O\n\4\f\4\16\4R\13\4\5\4T\n\4\3\4\3\4\3\5\3\5\3\5\5",
2372
- "\5[\n\5\3\5\6\5^\n\5\r\5\16\5_\3\5\3\5\5\5d\n\5\3\5\7\5g\n\5\f\5\16",
2373
- "\5j\13\5\7\5l\n\5\f\5\16\5o\13\5\5\5q\n\5\3\5\3\5\3\6\3\6\6\6w\n\6",
2374
- "\r\6\16\6x\6\6{\n\6\r\6\16\6|\3\6\7\6\u0080\n\6\f\6\16\6\u0083\13\6",
2375
- "\3\6\5\6\u0086\n\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\5\7\u008f\n\7\3\b\3",
2376
- "\b\5\b\u0093\n\b\3\t\3\t\3\t\3\t\3\t\3\t\5\t\u009b\n\t\3\t\3\t\7\t",
2377
- "\u009f\n\t\f\t\16\t\u00a2\13\t\3\t\3\t\3\n\7\n\u00a7\n\n\f\n\16\n\u00aa",
2378
- "\13\n\3\13\3\13\3\13\3\13\3\13\3\13\5\13\u00b2\n\13\3\13\3\13\7\13",
2379
- "\u00b6\n\13\f\13\16\13\u00b9\13\13\3\13\3\13\3\f\6\f\u00be\n\f\r\f",
2380
- "\16\f\u00bf\3\r\3\r\5\r\u00c4\n\r\3\16\3\16\3\16\3\16\3\16\3\16\5\16",
2381
- "\u00cc\n\16\3\16\3\16\7\16\u00d0\n\16\f\16\16\16\u00d3\13\16\3\16\3",
2382
- "\16\3\17\6\17\u00d8\n\17\r\17\16\17\u00d9\3\20\3\20\5\20\u00de\n\20",
2383
- "\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\7\21\u00e9\n\21\f\21",
2384
- "\16\21\u00ec\13\21\3\21\3\21\3\21\3\21\5\21\u00f2\n\21\3\21\3\21\3",
2385
- "\22\3\22\3\22\7\22\u00f9\n\22\f\22\16\22\u00fc\13\22\3\23\5\23\u00ff",
2386
- "\n\23\3\23\3\23\5\23\u0103\n\23\3\23\3\23\5\23\u0107\n\23\3\23\3\23",
2387
- "\5\23\u010b\n\23\7\23\u010d\n\23\f\23\16\23\u0110\13\23\3\24\3\24\3",
2388
- "\24\3\24\3\24\3\24\3\24\3\24\3\24\5\24\u011b\n\24\3\25\5\25\u011e\n",
2389
- "\25\3\25\5\25\u0121\n\25\3\25\3\25\3\25\7\25\u0126\n\25\f\25\16\25",
2390
- "\u0129\13\25\3\26\3\26\3\26\3\26\7\26\u012f\n\26\f\26\16\26\u0132\13",
2391
- "\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27\5\27\u013b\n\27\3\30\3\30\3",
2392
- "\30\3\30\5\30\u0141\n\30\3\31\3\31\3\31\2\2\32\2\4\6\b\n\f\16\20\22",
2393
- "\24\26\30\32\34\36 \"$&(*,.\60\2\4\6\2\4\6\17\17\21\21\23\23\3\2\34",
2394
- "\35\2\u0165\2@\3\2\2\2\4H\3\2\2\2\6J\3\2\2\2\bW\3\2\2\2\nz\3\2\2\2",
2395
- "\f\u008e\3\2\2\2\16\u0092\3\2\2\2\20\u0094\3\2\2\2\22\u00a8\3\2\2\2",
2396
- "\24\u00ab\3\2\2\2\26\u00bd\3\2\2\2\30\u00c3\3\2\2\2\32\u00c5\3\2\2",
2397
- "\2\34\u00d7\3\2\2\2\36\u00dd\3\2\2\2 \u00df\3\2\2\2\"\u00f5\3\2\2\2",
2398
- "$\u00fe\3\2\2\2&\u011a\3\2\2\2(\u011d\3\2\2\2*\u012a\3\2\2\2,\u013a",
2399
- "\3\2\2\2.\u0140\3\2\2\2\60\u0142\3\2\2\2\62\64\5\4\3\2\63\62\3\2\2",
2400
- "\2\63\64\3\2\2\2\64A\3\2\2\2\65:\5\4\3\2\66\67\7\t\2\2\679\5\4\3\2",
2401
- "8\66\3\2\2\29<\3\2\2\2:8\3\2\2\2:;\3\2\2\2;>\3\2\2\2<:\3\2\2\2=?\7",
2402
- "\t\2\2>=\3\2\2\2>?\3\2\2\2?A\3\2\2\2@\63\3\2\2\2@\65\3\2\2\2AB\3\2",
2403
- "\2\2BC\7\2\2\3C\3\3\2\2\2DI\5\6\4\2EI\5\b\5\2FI\5\20\t\2GI\5\f\7\2",
2404
- "HD\3\2\2\2HE\3\2\2\2HF\3\2\2\2HG\3\2\2\2I\5\3\2\2\2JS\7\13\2\2KP\5",
2405
- "\30\r\2LM\7\t\2\2MO\5\30\r\2NL\3\2\2\2OR\3\2\2\2PN\3\2\2\2PQ\3\2\2",
2406
- "\2QT\3\2\2\2RP\3\2\2\2SK\3\2\2\2ST\3\2\2\2TU\3\2\2\2UV\7\f\2\2V\7\3",
2407
- "\2\2\2Wp\7\r\2\2X[\5\36\20\2Y[\5\n\6\2ZX\3\2\2\2ZY\3\2\2\2[m\3\2\2",
2408
- "\2\\^\7\t\2\2]\\\3\2\2\2^_\3\2\2\2_]\3\2\2\2_`\3\2\2\2`c\3\2\2\2ad",
2409
- "\5\36\20\2bd\5\n\6\2ca\3\2\2\2cb\3\2\2\2dh\3\2\2\2eg\7\t\2\2fe\3\2",
2410
- "\2\2gj\3\2\2\2hf\3\2\2\2hi\3\2\2\2il\3\2\2\2jh\3\2\2\2k]\3\2\2\2lo",
2411
- "\3\2\2\2mk\3\2\2\2mn\3\2\2\2nq\3\2\2\2om\3\2\2\2pZ\3\2\2\2pq\3\2\2",
2412
- "\2qr\3\2\2\2rs\7\16\2\2s\t\3\2\2\2tv\5\36\20\2uw\7\7\2\2vu\3\2\2\2",
2413
- "wx\3\2\2\2xv\3\2\2\2xy\3\2\2\2y{\3\2\2\2zt\3\2\2\2{|\3\2\2\2|z\3\2",
2414
- "\2\2|}\3\2\2\2}\u0081\3\2\2\2~\u0080\5\36\20\2\177~\3\2\2\2\u0080\u0083",
2415
- "\3\2\2\2\u0081\177\3\2\2\2\u0081\u0082\3\2\2\2\u0082\u0085\3\2\2\2",
2416
- "\u0083\u0081\3\2\2\2\u0084\u0086\7\7\2\2\u0085\u0084\3\2\2\2\u0085",
2417
- "\u0086\3\2\2\2\u0086\13\3\2\2\2\u0087\u0088\t\2\2\2\u0088\u0089\7\b",
2418
- "\2\2\u0089\u008f\5\16\b\2\u008a\u008b\7\21\2\2\u008b\u008f\5\6\4\2",
2419
- "\u008c\u008d\7\21\2\2\u008d\u008f\5\b\5\2\u008e\u0087\3\2\2\2\u008e",
2420
- "\u008a\3\2\2\2\u008e\u008c\3\2\2\2\u008f\r\3\2\2\2\u0090\u0093\5,\27",
2421
- "\2\u0091\u0093\5 \21\2\u0092\u0090\3\2\2\2\u0092\u0091\3\2\2\2\u0093",
2422
- "\17\3\2\2\2\u0094\u0095\7\25\2\2\u0095\u0096\5$\23\2\u0096\u0097\7",
2423
- "\27\2\2\u0097\u00a0\5\22\n\2\u0098\u009a\7\30\2\2\u0099\u009b\5$\23",
2424
- "\2\u009a\u0099\3\2\2\2\u009a\u009b\3\2\2\2\u009b\u009c\3\2\2\2\u009c",
2425
- "\u009d\7\27\2\2\u009d\u009f\5\22\n\2\u009e\u0098\3\2\2\2\u009f\u00a2",
2426
- "\3\2\2\2\u00a0\u009e\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u00a3\3\2\2",
2427
- "\2\u00a2\u00a0\3\2\2\2\u00a3\u00a4\7 \2\2\u00a4\21\3\2\2\2\u00a5\u00a7",
2428
- "\5\4\3\2\u00a6\u00a5\3\2\2\2\u00a7\u00aa\3\2\2\2\u00a8\u00a6\3\2\2",
2429
- "\2\u00a8\u00a9\3\2\2\2\u00a9\23\3\2\2\2\u00aa\u00a8\3\2\2\2\u00ab\u00ac",
2430
- "\7\25\2\2\u00ac\u00ad\5$\23\2\u00ad\u00ae\7\27\2\2\u00ae\u00b7\5\26",
2431
- "\f\2\u00af\u00b1\7\30\2\2\u00b0\u00b2\5$\23\2\u00b1\u00b0\3\2\2\2\u00b1",
2432
- "\u00b2\3\2\2\2\u00b2\u00b3\3\2\2\2\u00b3\u00b4\7\27\2\2\u00b4\u00b6",
2433
- "\5\26\f\2\u00b5\u00af\3\2\2\2\u00b6\u00b9\3\2\2\2\u00b7\u00b5\3\2\2",
2434
- "\2\u00b7\u00b8\3\2\2\2\u00b8\u00ba\3\2\2\2\u00b9\u00b7\3\2\2\2\u00ba",
2435
- "\u00bb\7 \2\2\u00bb\25\3\2\2\2\u00bc\u00be\5\30\r\2\u00bd\u00bc\3\2",
2436
- "\2\2\u00be\u00bf\3\2\2\2\u00bf\u00bd\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0",
2437
- "\27\3\2\2\2\u00c1\u00c4\5\f\7\2\u00c2\u00c4\5\24\13\2\u00c3\u00c1\3",
2438
- "\2\2\2\u00c3\u00c2\3\2\2\2\u00c4\31\3\2\2\2\u00c5\u00c6\7\25\2\2\u00c6",
2439
- "\u00c7\5$\23\2\u00c7\u00c8\7\27\2\2\u00c8\u00d1\5\34\17\2\u00c9\u00cb",
2440
- "\7\30\2\2\u00ca\u00cc\5$\23\2\u00cb\u00ca\3\2\2\2\u00cb\u00cc\3\2\2",
2441
- "\2\u00cc\u00cd\3\2\2\2\u00cd\u00ce\7\27\2\2\u00ce\u00d0\5\34\17\2\u00cf",
2442
- "\u00c9\3\2\2\2\u00d0\u00d3\3\2\2\2\u00d1\u00cf\3\2\2\2\u00d1\u00d2",
2443
- "\3\2\2\2\u00d2\u00d4\3\2\2\2\u00d3\u00d1\3\2\2\2\u00d4\u00d5\7 \2\2",
2444
- "\u00d5\33\3\2\2\2\u00d6\u00d8\5\36\20\2\u00d7\u00d6\3\2\2\2\u00d8\u00d9",
2445
- "\3\2\2\2\u00d9\u00d7\3\2\2\2\u00d9\u00da\3\2\2\2\u00da\35\3\2\2\2\u00db",
2446
- "\u00de\5.\30\2\u00dc\u00de\5\32\16\2\u00dd\u00db\3\2\2\2\u00dd\u00dc",
2447
- "\3\2\2\2\u00de\37\3\2\2\2\u00df\u00e0\7\25\2\2\u00e0\u00e1\5$\23\2",
2448
- "\u00e1\u00f1\7\27\2\2\u00e2\u00ea\5\"\22\2\u00e3\u00e4\7\30\2\2\u00e4",
2449
- "\u00e5\5$\23\2\u00e5\u00e6\7\27\2\2\u00e6\u00e7\5\"\22\2\u00e7\u00e9",
2450
- "\3\2\2\2\u00e8\u00e3\3\2\2\2\u00e9\u00ec\3\2\2\2\u00ea\u00e8\3\2\2",
2451
- "\2\u00ea\u00eb\3\2\2\2\u00eb\u00ed\3\2\2\2\u00ec\u00ea\3\2\2\2\u00ed",
2452
- "\u00ee\7\30\2\2\u00ee\u00ef\7\27\2\2\u00ef\u00f0\5\"\22\2\u00f0\u00f2",
2453
- "\3\2\2\2\u00f1\u00e2\3\2\2\2\u00f1\u00f2\3\2\2\2\u00f2\u00f3\3\2\2",
2454
- "\2\u00f3\u00f4\7 \2\2\u00f4!\3\2\2\2\u00f5\u00fa\5\16\b\2\u00f6\u00f7",
2455
- "\7\7\2\2\u00f7\u00f9\5\16\b\2\u00f8\u00f6\3\2\2\2\u00f9\u00fc\3\2\2",
2456
- "\2\u00fa\u00f8\3\2\2\2\u00fa\u00fb\3\2\2\2\u00fb#\3\2\2\2\u00fc\u00fa",
2457
- "\3\2\2\2\u00fd\u00ff\7\36\2\2\u00fe\u00fd\3\2\2\2\u00fe\u00ff\3\2\2",
2458
- "\2\u00ff\u0102\3\2\2\2\u0100\u0103\5(\25\2\u0101\u0103\5*\26\2\u0102",
2459
- "\u0100\3\2\2\2\u0102\u0101\3\2\2\2\u0103\u010e\3\2\2\2\u0104\u0106",
2460
- "\t\3\2\2\u0105\u0107\7\36\2\2\u0106\u0105\3\2\2\2\u0106\u0107\3\2\2",
2461
- "\2\u0107\u010a\3\2\2\2\u0108\u010b\5(\25\2\u0109\u010b\5*\26\2\u010a",
2462
- "\u0108\3\2\2\2\u010a\u0109\3\2\2\2\u010b\u010d\3\2\2\2\u010c\u0104",
2463
- "\3\2\2\2\u010d\u0110\3\2\2\2\u010e\u010c\3\2\2\2\u010e\u010f\3\2\2",
2464
- "\2\u010f%\3\2\2\2\u0110\u010e\3\2\2\2\u0111\u011b\7\b\2\2\u0112\u011b",
2465
- "\7\31\2\2\u0113\u0114\7\31\2\2\u0114\u011b\7\b\2\2\u0115\u011b\7\32",
2466
- "\2\2\u0116\u0117\7\32\2\2\u0117\u011b\7\b\2\2\u0118\u0119\7\36\2\2",
2467
- "\u0119\u011b\7\b\2\2\u011a\u0111\3\2\2\2\u011a\u0112\3\2\2\2\u011a",
2468
- "\u0113\3\2\2\2\u011a\u0115\3\2\2\2\u011a\u0116\3\2\2\2\u011a\u0118",
2469
- "\3\2\2\2\u011b\'\3\2\2\2\u011c\u011e\7\21\2\2\u011d\u011c\3\2\2\2\u011d",
2470
- "\u011e\3\2\2\2\u011e\u0120\3\2\2\2\u011f\u0121\5&\24\2\u0120\u011f",
2471
- "\3\2\2\2\u0120\u0121\3\2\2\2\u0121\u0122\3\2\2\2\u0122\u0127\5,\27",
2472
- "\2\u0123\u0124\7\30\2\2\u0124\u0126\5,\27\2\u0125\u0123\3\2\2\2\u0126",
2473
- "\u0129\3\2\2\2\u0127\u0125\3\2\2\2\u0127\u0128\3\2\2\2\u0128)\3\2\2",
2474
- "\2\u0129\u0127\3\2\2\2\u012a\u012b\7\25\2\2\u012b\u0130\5$\23\2\u012c",
2475
- "\u012d\t\3\2\2\u012d\u012f\5$\23\2\u012e\u012c\3\2\2\2\u012f\u0132",
2476
- "\3\2\2\2\u0130\u012e\3\2\2\2\u0130\u0131\3\2\2\2\u0131\u0133\3\2\2",
2477
- "\2\u0132\u0130\3\2\2\2\u0133\u0134\7 \2\2\u0134+\3\2\2\2\u0135\u013b",
2478
- "\5\6\4\2\u0136\u013b\5\b\5\2\u0137\u013b\5\n\6\2\u0138\u013b\5\f\7",
2479
- "\2\u0139\u013b\5\60\31\2\u013a\u0135\3\2\2\2\u013a\u0136\3\2\2\2\u013a",
2480
- "\u0137\3\2\2\2\u013a\u0138\3\2\2\2\u013a\u0139\3\2\2\2\u013b-\3\2\2",
2481
- "\2\u013c\u0141\5\6\4\2\u013d\u0141\5\f\7\2\u013e\u0141\5\b\5\2\u013f",
2482
- "\u0141\5\60\31\2\u0140\u013c\3\2\2\2\u0140\u013d\3\2\2\2\u0140\u013e",
2483
- "\3\2\2\2\u0140\u013f\3\2\2\2\u0141/\3\2\2\2\u0142\u0143\t\2\2\2\u0143",
2484
- "\61\3\2\2\2/\63:>@HPSZ_chmpx|\u0081\u0085\u008e\u0092\u009a\u00a0\u00a8",
2485
- "\u00b1\u00b7\u00bf\u00c3\u00cb\u00d1\u00d9\u00dd\u00ea\u00f1\u00fa",
2486
- "\u00fe\u0102\u0106\u010a\u010e\u011a\u011d\u0120\u0127\u0130\u013a",
2487
- "\u0140"].join("")
2366
+ "\3 \u0145\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4",
2367
+ "\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t",
2368
+ "\20\4\21\t\21\4\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27",
2369
+ "\t\27\4\30\t\30\4\31\t\31\3\2\5\2\64\n\2\3\2\3\2\3\2\7\29\n\2\f\2\16",
2370
+ "\2<\13\2\3\2\5\2?\n\2\5\2A\n\2\3\2\3\2\3\3\3\3\3\3\3\3\5\3I\n\3\3\4",
2371
+ "\3\4\3\4\3\4\7\4O\n\4\f\4\16\4R\13\4\5\4T\n\4\3\4\3\4\3\5\3\5\3\5\5",
2372
+ "\5[\n\5\3\5\6\5^\n\5\r\5\16\5_\3\5\3\5\5\5d\n\5\3\5\7\5g\n\5\f\5\16",
2373
+ "\5j\13\5\7\5l\n\5\f\5\16\5o\13\5\5\5q\n\5\3\5\3\5\3\6\3\6\6\6w\n\6",
2374
+ "\r\6\16\6x\6\6{\n\6\r\6\16\6|\3\6\7\6\u0080\n\6\f\6\16\6\u0083\13\6",
2375
+ "\3\6\5\6\u0086\n\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\5\7\u008f\n\7\3\b\3",
2376
+ "\b\5\b\u0093\n\b\3\t\3\t\3\t\3\t\3\t\3\t\5\t\u009b\n\t\3\t\3\t\7\t",
2377
+ "\u009f\n\t\f\t\16\t\u00a2\13\t\3\t\3\t\3\n\7\n\u00a7\n\n\f\n\16\n\u00aa",
2378
+ "\13\n\3\13\3\13\3\13\3\13\3\13\3\13\5\13\u00b2\n\13\3\13\3\13\7\13",
2379
+ "\u00b6\n\13\f\13\16\13\u00b9\13\13\3\13\3\13\3\f\6\f\u00be\n\f\r\f",
2380
+ "\16\f\u00bf\3\r\3\r\5\r\u00c4\n\r\3\16\3\16\3\16\3\16\3\16\3\16\5\16",
2381
+ "\u00cc\n\16\3\16\3\16\7\16\u00d0\n\16\f\16\16\16\u00d3\13\16\3\16\3",
2382
+ "\16\3\17\6\17\u00d8\n\17\r\17\16\17\u00d9\3\20\3\20\5\20\u00de\n\20",
2383
+ "\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\7\21\u00e9\n\21\f\21",
2384
+ "\16\21\u00ec\13\21\3\21\3\21\3\21\3\21\5\21\u00f2\n\21\3\21\3\21\3",
2385
+ "\22\3\22\3\22\7\22\u00f9\n\22\f\22\16\22\u00fc\13\22\3\23\5\23\u00ff",
2386
+ "\n\23\3\23\3\23\5\23\u0103\n\23\3\23\3\23\5\23\u0107\n\23\3\23\3\23",
2387
+ "\5\23\u010b\n\23\7\23\u010d\n\23\f\23\16\23\u0110\13\23\3\24\3\24\3",
2388
+ "\24\3\24\3\24\3\24\3\24\3\24\3\24\5\24\u011b\n\24\3\25\5\25\u011e\n",
2389
+ "\25\3\25\5\25\u0121\n\25\3\25\3\25\3\25\7\25\u0126\n\25\f\25\16\25",
2390
+ "\u0129\13\25\3\26\3\26\3\26\3\26\7\26\u012f\n\26\f\26\16\26\u0132\13",
2391
+ "\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27\5\27\u013b\n\27\3\30\3\30\3",
2392
+ "\30\3\30\5\30\u0141\n\30\3\31\3\31\3\31\2\2\32\2\4\6\b\n\f\16\20\22",
2393
+ "\24\26\30\32\34\36 \"$&(*,.\60\2\4\6\2\4\6\17\17\21\21\23\23\3\2\34",
2394
+ "\35\2\u0165\2@\3\2\2\2\4H\3\2\2\2\6J\3\2\2\2\bW\3\2\2\2\nz\3\2\2\2",
2395
+ "\f\u008e\3\2\2\2\16\u0092\3\2\2\2\20\u0094\3\2\2\2\22\u00a8\3\2\2\2",
2396
+ "\24\u00ab\3\2\2\2\26\u00bd\3\2\2\2\30\u00c3\3\2\2\2\32\u00c5\3\2\2",
2397
+ "\2\34\u00d7\3\2\2\2\36\u00dd\3\2\2\2 \u00df\3\2\2\2\"\u00f5\3\2\2\2",
2398
+ "$\u00fe\3\2\2\2&\u011a\3\2\2\2(\u011d\3\2\2\2*\u012a\3\2\2\2,\u013a",
2399
+ "\3\2\2\2.\u0140\3\2\2\2\60\u0142\3\2\2\2\62\64\5\4\3\2\63\62\3\2\2",
2400
+ "\2\63\64\3\2\2\2\64A\3\2\2\2\65:\5\4\3\2\66\67\7\t\2\2\679\5\4\3\2",
2401
+ "8\66\3\2\2\29<\3\2\2\2:8\3\2\2\2:;\3\2\2\2;>\3\2\2\2<:\3\2\2\2=?\7",
2402
+ "\t\2\2>=\3\2\2\2>?\3\2\2\2?A\3\2\2\2@\63\3\2\2\2@\65\3\2\2\2AB\3\2",
2403
+ "\2\2BC\7\2\2\3C\3\3\2\2\2DI\5\6\4\2EI\5\b\5\2FI\5\20\t\2GI\5\f\7\2",
2404
+ "HD\3\2\2\2HE\3\2\2\2HF\3\2\2\2HG\3\2\2\2I\5\3\2\2\2JS\7\13\2\2KP\5",
2405
+ "\30\r\2LM\7\t\2\2MO\5\30\r\2NL\3\2\2\2OR\3\2\2\2PN\3\2\2\2PQ\3\2\2",
2406
+ "\2QT\3\2\2\2RP\3\2\2\2SK\3\2\2\2ST\3\2\2\2TU\3\2\2\2UV\7\f\2\2V\7\3",
2407
+ "\2\2\2Wp\7\r\2\2X[\5\36\20\2Y[\5\n\6\2ZX\3\2\2\2ZY\3\2\2\2[m\3\2\2",
2408
+ "\2\\^\7\t\2\2]\\\3\2\2\2^_\3\2\2\2_]\3\2\2\2_`\3\2\2\2`c\3\2\2\2ad",
2409
+ "\5\36\20\2bd\5\n\6\2ca\3\2\2\2cb\3\2\2\2dh\3\2\2\2eg\7\t\2\2fe\3\2",
2410
+ "\2\2gj\3\2\2\2hf\3\2\2\2hi\3\2\2\2il\3\2\2\2jh\3\2\2\2k]\3\2\2\2lo",
2411
+ "\3\2\2\2mk\3\2\2\2mn\3\2\2\2nq\3\2\2\2om\3\2\2\2pZ\3\2\2\2pq\3\2\2",
2412
+ "\2qr\3\2\2\2rs\7\16\2\2s\t\3\2\2\2tv\5\36\20\2uw\7\7\2\2vu\3\2\2\2",
2413
+ "wx\3\2\2\2xv\3\2\2\2xy\3\2\2\2y{\3\2\2\2zt\3\2\2\2{|\3\2\2\2|z\3\2",
2414
+ "\2\2|}\3\2\2\2}\u0081\3\2\2\2~\u0080\5\36\20\2\177~\3\2\2\2\u0080\u0083",
2415
+ "\3\2\2\2\u0081\177\3\2\2\2\u0081\u0082\3\2\2\2\u0082\u0085\3\2\2\2",
2416
+ "\u0083\u0081\3\2\2\2\u0084\u0086\7\7\2\2\u0085\u0084\3\2\2\2\u0085",
2417
+ "\u0086\3\2\2\2\u0086\13\3\2\2\2\u0087\u0088\t\2\2\2\u0088\u0089\7\b",
2418
+ "\2\2\u0089\u008f\5\16\b\2\u008a\u008b\7\21\2\2\u008b\u008f\5\6\4\2",
2419
+ "\u008c\u008d\7\21\2\2\u008d\u008f\5\b\5\2\u008e\u0087\3\2\2\2\u008e",
2420
+ "\u008a\3\2\2\2\u008e\u008c\3\2\2\2\u008f\r\3\2\2\2\u0090\u0093\5,\27",
2421
+ "\2\u0091\u0093\5 \21\2\u0092\u0090\3\2\2\2\u0092\u0091\3\2\2\2\u0093",
2422
+ "\17\3\2\2\2\u0094\u0095\7\25\2\2\u0095\u0096\5$\23\2\u0096\u0097\7",
2423
+ "\27\2\2\u0097\u00a0\5\22\n\2\u0098\u009a\7\30\2\2\u0099\u009b\5$\23",
2424
+ "\2\u009a\u0099\3\2\2\2\u009a\u009b\3\2\2\2\u009b\u009c\3\2\2\2\u009c",
2425
+ "\u009d\7\27\2\2\u009d\u009f\5\22\n\2\u009e\u0098\3\2\2\2\u009f\u00a2",
2426
+ "\3\2\2\2\u00a0\u009e\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u00a3\3\2\2",
2427
+ "\2\u00a2\u00a0\3\2\2\2\u00a3\u00a4\7 \2\2\u00a4\21\3\2\2\2\u00a5\u00a7",
2428
+ "\5\4\3\2\u00a6\u00a5\3\2\2\2\u00a7\u00aa\3\2\2\2\u00a8\u00a6\3\2\2",
2429
+ "\2\u00a8\u00a9\3\2\2\2\u00a9\23\3\2\2\2\u00aa\u00a8\3\2\2\2\u00ab\u00ac",
2430
+ "\7\25\2\2\u00ac\u00ad\5$\23\2\u00ad\u00ae\7\27\2\2\u00ae\u00b7\5\26",
2431
+ "\f\2\u00af\u00b1\7\30\2\2\u00b0\u00b2\5$\23\2\u00b1\u00b0\3\2\2\2\u00b1",
2432
+ "\u00b2\3\2\2\2\u00b2\u00b3\3\2\2\2\u00b3\u00b4\7\27\2\2\u00b4\u00b6",
2433
+ "\5\26\f\2\u00b5\u00af\3\2\2\2\u00b6\u00b9\3\2\2\2\u00b7\u00b5\3\2\2",
2434
+ "\2\u00b7\u00b8\3\2\2\2\u00b8\u00ba\3\2\2\2\u00b9\u00b7\3\2\2\2\u00ba",
2435
+ "\u00bb\7 \2\2\u00bb\25\3\2\2\2\u00bc\u00be\5\30\r\2\u00bd\u00bc\3\2",
2436
+ "\2\2\u00be\u00bf\3\2\2\2\u00bf\u00bd\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0",
2437
+ "\27\3\2\2\2\u00c1\u00c4\5\f\7\2\u00c2\u00c4\5\24\13\2\u00c3\u00c1\3",
2438
+ "\2\2\2\u00c3\u00c2\3\2\2\2\u00c4\31\3\2\2\2\u00c5\u00c6\7\25\2\2\u00c6",
2439
+ "\u00c7\5$\23\2\u00c7\u00c8\7\27\2\2\u00c8\u00d1\5\34\17\2\u00c9\u00cb",
2440
+ "\7\30\2\2\u00ca\u00cc\5$\23\2\u00cb\u00ca\3\2\2\2\u00cb\u00cc\3\2\2",
2441
+ "\2\u00cc\u00cd\3\2\2\2\u00cd\u00ce\7\27\2\2\u00ce\u00d0\5\34\17\2\u00cf",
2442
+ "\u00c9\3\2\2\2\u00d0\u00d3\3\2\2\2\u00d1\u00cf\3\2\2\2\u00d1\u00d2",
2443
+ "\3\2\2\2\u00d2\u00d4\3\2\2\2\u00d3\u00d1\3\2\2\2\u00d4\u00d5\7 \2\2",
2444
+ "\u00d5\33\3\2\2\2\u00d6\u00d8\5\36\20\2\u00d7\u00d6\3\2\2\2\u00d8\u00d9",
2445
+ "\3\2\2\2\u00d9\u00d7\3\2\2\2\u00d9\u00da\3\2\2\2\u00da\35\3\2\2\2\u00db",
2446
+ "\u00de\5.\30\2\u00dc\u00de\5\32\16\2\u00dd\u00db\3\2\2\2\u00dd\u00dc",
2447
+ "\3\2\2\2\u00de\37\3\2\2\2\u00df\u00e0\7\25\2\2\u00e0\u00e1\5$\23\2",
2448
+ "\u00e1\u00f1\7\27\2\2\u00e2\u00ea\5\"\22\2\u00e3\u00e4\7\30\2\2\u00e4",
2449
+ "\u00e5\5$\23\2\u00e5\u00e6\7\27\2\2\u00e6\u00e7\5\"\22\2\u00e7\u00e9",
2450
+ "\3\2\2\2\u00e8\u00e3\3\2\2\2\u00e9\u00ec\3\2\2\2\u00ea\u00e8\3\2\2",
2451
+ "\2\u00ea\u00eb\3\2\2\2\u00eb\u00ed\3\2\2\2\u00ec\u00ea\3\2\2\2\u00ed",
2452
+ "\u00ee\7\30\2\2\u00ee\u00ef\7\27\2\2\u00ef\u00f0\5\"\22\2\u00f0\u00f2",
2453
+ "\3\2\2\2\u00f1\u00e2\3\2\2\2\u00f1\u00f2\3\2\2\2\u00f2\u00f3\3\2\2",
2454
+ "\2\u00f3\u00f4\7 \2\2\u00f4!\3\2\2\2\u00f5\u00fa\5\16\b\2\u00f6\u00f7",
2455
+ "\7\7\2\2\u00f7\u00f9\5\16\b\2\u00f8\u00f6\3\2\2\2\u00f9\u00fc\3\2\2",
2456
+ "\2\u00fa\u00f8\3\2\2\2\u00fa\u00fb\3\2\2\2\u00fb#\3\2\2\2\u00fc\u00fa",
2457
+ "\3\2\2\2\u00fd\u00ff\7\36\2\2\u00fe\u00fd\3\2\2\2\u00fe\u00ff\3\2\2",
2458
+ "\2\u00ff\u0102\3\2\2\2\u0100\u0103\5(\25\2\u0101\u0103\5*\26\2\u0102",
2459
+ "\u0100\3\2\2\2\u0102\u0101\3\2\2\2\u0103\u010e\3\2\2\2\u0104\u0106",
2460
+ "\t\3\2\2\u0105\u0107\7\36\2\2\u0106\u0105\3\2\2\2\u0106\u0107\3\2\2",
2461
+ "\2\u0107\u010a\3\2\2\2\u0108\u010b\5(\25\2\u0109\u010b\5*\26\2\u010a",
2462
+ "\u0108\3\2\2\2\u010a\u0109\3\2\2\2\u010b\u010d\3\2\2\2\u010c\u0104",
2463
+ "\3\2\2\2\u010d\u0110\3\2\2\2\u010e\u010c\3\2\2\2\u010e\u010f\3\2\2",
2464
+ "\2\u010f%\3\2\2\2\u0110\u010e\3\2\2\2\u0111\u011b\7\b\2\2\u0112\u011b",
2465
+ "\7\31\2\2\u0113\u0114\7\31\2\2\u0114\u011b\7\b\2\2\u0115\u011b\7\32",
2466
+ "\2\2\u0116\u0117\7\32\2\2\u0117\u011b\7\b\2\2\u0118\u0119\7\36\2\2",
2467
+ "\u0119\u011b\7\b\2\2\u011a\u0111\3\2\2\2\u011a\u0112\3\2\2\2\u011a",
2468
+ "\u0113\3\2\2\2\u011a\u0115\3\2\2\2\u011a\u0116\3\2\2\2\u011a\u0118",
2469
+ "\3\2\2\2\u011b\'\3\2\2\2\u011c\u011e\7\21\2\2\u011d\u011c\3\2\2\2\u011d",
2470
+ "\u011e\3\2\2\2\u011e\u0120\3\2\2\2\u011f\u0121\5&\24\2\u0120\u011f",
2471
+ "\3\2\2\2\u0120\u0121\3\2\2\2\u0121\u0122\3\2\2\2\u0122\u0127\5,\27",
2472
+ "\2\u0123\u0124\7\30\2\2\u0124\u0126\5,\27\2\u0125\u0123\3\2\2\2\u0126",
2473
+ "\u0129\3\2\2\2\u0127\u0125\3\2\2\2\u0127\u0128\3\2\2\2\u0128)\3\2\2",
2474
+ "\2\u0129\u0127\3\2\2\2\u012a\u012b\7\25\2\2\u012b\u0130\5$\23\2\u012c",
2475
+ "\u012d\t\3\2\2\u012d\u012f\5$\23\2\u012e\u012c\3\2\2\2\u012f\u0132",
2476
+ "\3\2\2\2\u0130\u012e\3\2\2\2\u0130\u0131\3\2\2\2\u0131\u0133\3\2\2",
2477
+ "\2\u0132\u0130\3\2\2\2\u0133\u0134\7 \2\2\u0134+\3\2\2\2\u0135\u013b",
2478
+ "\5\6\4\2\u0136\u013b\5\b\5\2\u0137\u013b\5\n\6\2\u0138\u013b\5\f\7",
2479
+ "\2\u0139\u013b\5\60\31\2\u013a\u0135\3\2\2\2\u013a\u0136\3\2\2\2\u013a",
2480
+ "\u0137\3\2\2\2\u013a\u0138\3\2\2\2\u013a\u0139\3\2\2\2\u013b-\3\2\2",
2481
+ "\2\u013c\u0141\5\6\4\2\u013d\u0141\5\f\7\2\u013e\u0141\5\b\5\2\u013f",
2482
+ "\u0141\5\60\31\2\u0140\u013c\3\2\2\2\u0140\u013d\3\2\2\2\u0140\u013e",
2483
+ "\3\2\2\2\u0140\u013f\3\2\2\2\u0141/\3\2\2\2\u0142\u0143\t\2\2\2\u0143",
2484
+ "\61\3\2\2\2/\63:>@HPSZ_chmpx|\u0081\u0085\u008e\u0092\u009a\u00a0\u00a8",
2485
+ "\u00b1\u00b7\u00bf\u00c3\u00cb\u00d1\u00d9\u00dd\u00ea\u00f1\u00fa",
2486
+ "\u00fe\u0102\u0106\u010a\u010e\u011a\u011d\u0120\u0127\u0130\u013a",
2487
+ "\u0140"].join("")
2488
2488
 
2489
2489
  @@_ATN = Antlr4::Runtime::ATNDeserializer.new().deserialize(@@_serializedATN)
2490
2490
 
@@ -22,8 +22,29 @@ module MODL
22
22
 
23
23
  private
24
24
 
25
+ def self.check_class_type(global, key, value)
26
+ clazz = global.classs(key)
27
+ top = top_class(clazz, global)
28
+ case top
29
+ when 'num'
30
+ unless value.is_a?(Numeric)
31
+ raise InterpreterError, 'Interpreter Error: Numeric value expected, but found: ' + value.to_s + ' of type ' + value.class.to_s
32
+ end
33
+ return value
34
+ when 'str'
35
+ return value.to_s
36
+ end
37
+ value
38
+ end
39
+
25
40
  # Process the contents of the supplied hash obj
26
41
  def self.process_obj(global, obj)
42
+ if obj.length == 1
43
+ k = obj.keys[0]
44
+ nv = check_class_type(global, k, obj[k])
45
+ obj[k] = nv
46
+ end
47
+
27
48
  obj.keys.each do |k|
28
49
  value = obj[k]
29
50
  # Does the key refer to a class that we have parsed or loaded?
@@ -32,17 +53,45 @@ module MODL
32
53
  # Yes so convert this value to an instance of that class
33
54
  new_k, new_v = process_class global, k, value
34
55
  # Replace the existing object with the new class instance and a new key
35
- obj.delete k
36
- obj[new_k] = new_v
56
+ # We need to keep the same key order, hence this method below
57
+ replaceValue(obj, k, new_k, new_v)
58
+ else
59
+ new_v = value
37
60
  end
38
61
  # Recurse into the value in case it has contents that also refer to classes.
39
- process global, value
62
+ process global, new_v
63
+ end
64
+ end
65
+
66
+ def self.replaceValue(obj, old_k, new_k, new_v)
67
+ tmp = obj.dup
68
+ obj.clear
69
+ tmp.keys.each do |tmpk|
70
+ tmpv = tmp[tmpk]
71
+ if tmpk == old_k
72
+ obj[new_k] = new_v
73
+ else
74
+ obj[tmpk] = tmpv
75
+ end
40
76
  end
41
77
  end
42
78
 
43
79
  # Convert the supplied object val into an instance of the class with key k
44
80
  def self.process_class(global, k, v)
45
81
  clazz = global.classs(k)
82
+ if k != clazz.id && !(v.is_a?(Hash) || v.is_a?(Array))
83
+ return [k, v]
84
+ end
85
+
86
+ if k == clazz.name && !(v.is_a?(Array) || v.is_a?(Hash))
87
+ new_value = transform_to_class(clazz, global, [v], true)
88
+ if new_value.is_a?(Array) && new_value.length == 1
89
+ return [clazz.name_or_id, new_value[0]]
90
+ else
91
+ return [clazz.name_or_id, new_value]
92
+ end
93
+ end
94
+
46
95
  new_value = transform_to_class(clazz, global, v)
47
96
 
48
97
  if v.is_a?(Array)
@@ -68,7 +117,6 @@ module MODL
68
117
  end
69
118
  end
70
119
 
71
- process_nested_classes(global, new_value)
72
120
  [clazz.name_or_id, new_value]
73
121
  end
74
122
 
@@ -113,8 +161,7 @@ module MODL
113
161
 
114
162
  # Replace the value for this key if we've changed anything.
115
163
  if new_value[new_k] != new_v
116
- new_value.delete nk
117
- new_value[new_k] = new_v
164
+ replaceValue(new_value, new_k, new_k, new_v)
118
165
  end
119
166
  end
120
167
  elsif new_value.is_a?(Array)
@@ -126,17 +173,25 @@ module MODL
126
173
 
127
174
  # Process the *assign lists ('keylist' in this code) and any extra pairs defined by the class.
128
175
  # The id, name, and superclass can be ignored here.
129
- def self.transform_to_class(clazz, global, v)
176
+ def self.transform_to_class(clazz, global, v, ignore_assign = false)
130
177
  new_value = {} # the replacement for val after conversion to a class instance
178
+ process_nested_classes(global, v)
131
179
 
132
180
  # Process the key list if we found one otherwise raise an error
133
181
  # Slightly different processing for hashes and arrays
134
- if v.is_a? Array
135
- keys = key_list(global, clazz, v.length)
136
- lam = ->(i) {v[i]}
137
- elsif !v.is_a?(Hash)
138
- keys = key_list(global, clazz, 1)
139
- lam = ->(i) {v}
182
+ unless ignore_assign
183
+ if v.is_a? Array
184
+ keys = key_list(global, clazz, v.length)
185
+ if keys.empty?
186
+ return v
187
+ else
188
+ lam = ->(i) {v[i]}
189
+ end
190
+ elsif !v.is_a?(Hash)
191
+ keys = key_list(global, clazz, 1)
192
+ lam = ->(i) {v}
193
+ return v if keys.length.zero?
194
+ end
140
195
  end
141
196
 
142
197
  keys&.each_index do |i|
@@ -162,6 +217,7 @@ module MODL
162
217
  def self.top_class(clazz, global, depth = 0)
163
218
  # Check for self-referential classes that cause infinite recursion
164
219
  return if depth > MAX_RECURSION_DEPTH
220
+ return nil? if clazz.nil?
165
221
 
166
222
  superclass = clazz.superclass
167
223
  c = global.classs(superclass)
@@ -11,20 +11,14 @@ module MODL
11
11
  class InterpreterError < StandardError
12
12
  end
13
13
 
14
+ class ParserError < StandardError
15
+ end
16
+
14
17
  # This is the main Ruby Interpreter entry point. Supply a String containing MODL text and it will return a String
15
18
  # containing the JSON equivalent. The JSON isn't pretty-printed unless pretty is true
16
19
  class Interpreter
17
20
  def self.interpret(str, pretty = false)
18
- # Parse the MODL string into a MODL::Parser::Parsed object.
19
- parsed = MODL::Parser::Parser.parse str
20
-
21
- # Convert the Parsed object into a simpler structure of and Array or Hash
22
- interpreted = parsed.extract_hash
23
-
24
- # Process any class definitions used by the MODL file.
25
- MODL::Parser::ClassProcessor.process(parsed.global, interpreted)
26
- MODL::Parser::InstructionProcessor.process(parsed.global, interpreted)
27
- # If the result is a simple string then just return it.
21
+ interpreted = MODL.parse(str)
28
22
  return interpreted if interpreted.is_a? String
29
23
 
30
24
  # Otherwise generate a JSON string.
@@ -22,7 +22,7 @@ module MODL
22
22
  return kl if kl.length == len
23
23
  end
24
24
  raise InterpreterError,
25
- 'No key list of the correct length in class ' + @id + ' - looking for one of length ' + len.to_s
25
+ 'Interpreter Error: No key list of the correct length in class ' + @id + ' - looking for one of length ' + len.to_s
26
26
  end
27
27
 
28
28
  def merge_content(new_value)
@@ -344,10 +344,8 @@ module MODL
344
344
  IndexExtractor.extract(self, @global)
345
345
  when 'hidden'
346
346
  extract_value
347
- invoke_deref
348
347
  else
349
348
  extract_value
350
- invoke_deref
351
349
  end
352
350
 
353
351
  return if @global.in_condition? # Don't store pairs in conditionals until we evaluate the conditions
@@ -1401,7 +1399,7 @@ module MODL
1401
1399
  end
1402
1400
  case result.length
1403
1401
  when 0
1404
- return ''
1402
+ return nil
1405
1403
  when 1
1406
1404
  return result[0]
1407
1405
  end
@@ -23,18 +23,24 @@ module MODL
23
23
  parsed = Parsed.new(global)
24
24
  parser.modl.enter_rule(parsed)
25
25
  parsed
26
+ rescue Antlr4::Runtime::ParseCancellationException => e
27
+ check_modl_version(global)
28
+ raise ParserError, 'Parser Error: ' + e.message
26
29
  rescue StandardError => e
27
- puts e.message
28
- puts e.backtrace
29
-
30
- if global.syntax_version > global.interpreter_syntax_version
31
- raise InterpreterError, 'MODL Version ' +
32
- global.interpreter_syntax_version.to_s +
33
- ' interpreter cannot process this MODL Version ' +
34
- global.syntax_version.to_s + ' file.'
35
- end
30
+ check_modl_version(global)
31
+ raise InterpreterError, 'Interpreter Error: ' + e.message
32
+ rescue InterpreterError => e
33
+ check_modl_version(global)
34
+ raise InterpreterError, 'Interpreter Error: ' + e.message
35
+ end
36
+ end
36
37
 
37
- raise InterpreterError, 'Parser Error: ' + e.message
38
+ def self.check_modl_version(global)
39
+ if global.syntax_version > global.interpreter_syntax_version
40
+ raise InterpreterError, 'Interpreter Error: MODL Version ' +
41
+ global.interpreter_syntax_version.to_s +
42
+ ' interpreter cannot process this MODL Version ' +
43
+ global.syntax_version.to_s + ' file.'
38
44
  end
39
45
  end
40
46
  end
@@ -1,5 +1,5 @@
1
1
  module MODL
2
2
  module Parser
3
- VERSION = "0.3.5"
3
+ VERSION = "0.3.6"
4
4
  end
5
5
  end
data/modl.gemspec CHANGED
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'antlr4-runtime', '>= 0.0.1'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
28
28
  spec.add_development_dependency 'rspec', '~> 3.0'
29
- spec.add_runtime_dependency 'antlr4-runtime', '= 0.2.1'
29
+ spec.add_runtime_dependency 'antlr4-runtime', '= 0.2.3'
30
30
  spec.add_runtime_dependency 'punycode4r', '>= 0.2.0'
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Walmsley
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-10 00:00:00.000000000 Z
11
+ date: 2019-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: antlr4-runtime
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.1
61
+ version: 0.2.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.1
68
+ version: 0.2.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: punycode4r
71
71
  requirement: !ruby/object:Gem::Requirement