modl 0.3.11 → 0.3.12

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: 583a99cd420de4767e4fdcc6bec00feeb360ddd9f404b941bba4937a1e38ebaa
4
- data.tar.gz: 6a9e4b47c3b3e2c7312fe661267d4b38488b9037ba7a9c352d45667acc2d795c
3
+ metadata.gz: 1827bb8abaccc7771bf7ea845006a499b798f37f7697949efec86d539df88815
4
+ data.tar.gz: c534d0b8a027287698d2a624c664ec19cced108a579b2b52f0518c8d9a09a2c5
5
5
  SHA512:
6
- metadata.gz: 7617ea87f64cf64f5a93e5029d9f13099ef1a825936eb2ef1680c2a81163f75716963b3d197b8de5cca4be167035aad008b82312b3ca289ea482bd943e566da6
7
- data.tar.gz: 22e49cbcdf82cc0219698e35fa38cd21039c772bd2b0d7095c2703fd2587d2612af9e62b00b0364a371f044c1d0d341b4f5217f1db032d737fcac6f21a06a9d5
6
+ metadata.gz: 4d4d737f13ad9508ba7fcdc5a9187d457d6eb03fa445b9f934eaa982c4cb36fd5f114f9b4a039c8dc8015facb2dda1b8816327b56fcd346619ea534ded83b59e
7
+ data.tar.gz: d668afa32aedf30f3ebf949a1a8f64962986c558a122c5b2d1b0b8c84c495e8fa5bce7b5a729c7a2b4f44044dac6d3bb1871268806f972f8a7967d0916a1d443
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ 0.3.12
2
+ ===
3
+ - Use file cache on load error - GitHub issue #20
4
+ - Error converting value to number - GitHub issue #21
5
+ - Problem with punycode - GitHub issue #22
6
+ - Handle orphan pairs - adopt then into a map
7
+
1
8
  0.3.11
2
9
  ===
3
10
  - Support conditional file loading.
@@ -393,7 +393,7 @@
393
393
  {
394
394
  "id": "42",
395
395
  "input": "*class(*id=object;*superclass=arr);sales(name=John Smith;telephone=44800 555 555);service(name=Jim Brown;telephone=44800 666 666)",
396
- "expected_output": "[\n {\n \"sales\": {\n \"name\": \"John Smith\",\n \"telephone\": \"44800 555 555\"\n }\n },\n {\n \"service\": {\n \"name\": \"Jim Brown\",\n \"telephone\": \"44800 666 666\"\n }\n }\n]",
396
+ "expected_output": "{\n \"sales\": {\n \"name\": \"John Smith\",\n \"telephone\": \"44800 555 555\"\n },\n \"service\": {\n \"name\": \"Jim Brown\",\n \"telephone\": \"44800 666 666\"\n }\n}",
397
397
  "tested_features": [
398
398
  "class"
399
399
  ],
@@ -474,7 +474,7 @@
474
474
  {
475
475
  "id": "51",
476
476
  "input": "?=one:two:three;test1=%0;test2=%1;test3=%2;test4=%3;test5=%4;test6=%5;test7=%6;test8=%7;test9=%8",
477
- "expected_output": "[\n {\n \"test1\": \"one\"\n },\n {\n \"test2\": \"two\"\n },\n {\n \"test3\": \"three\"\n },\n {\n \"test4\": \"%3\"\n },\n {\n \"test5\": \"%4\"\n },\n {\n \"test6\": \"%5\"\n },\n {\n \"test7\": \"%6\"\n },\n {\n \"test8\": \"%7\"\n },\n {\n \"test9\": \"%8\"\n }\n]",
477
+ "expected_output": "{\n \"test1\": \"one\",\n \"test2\": \"two\",\n \"test3\": \"three\",\n \"test4\": \"%3\",\n \"test5\": \"%4\",\n \"test6\": \"%5\",\n \"test7\": \"%6\",\n \"test8\": \"%7\",\n \"test9\": \"%8\"\n}",
478
478
  "tested_features": [
479
479
  "object_ref"
480
480
  ],
@@ -483,7 +483,7 @@
483
483
  {
484
484
  "id": "52",
485
485
  "input": "a=1:2:3;b=4:5:6",
486
- "expected_output": "[\n {\n \"a\": [\n 1,\n 2,\n 3\n ]\n },\n {\n \"b\": [\n 4,\n 5,\n 6\n ]\n }\n]",
486
+ "expected_output": "{\n \"a\": [\n 1,\n 2,\n 3\n ],\n \"b\": [\n 4,\n 5,\n 6\n ]\n}",
487
487
  "tested_features": [
488
488
  "nbArray"
489
489
  ],
@@ -510,7 +510,7 @@
510
510
  {
511
511
  "id": "55",
512
512
  "input": "a=1:2:3;\nb=4:5:6",
513
- "expected_output": "[\n {\n \"a\": [\n 1,\n 2,\n 3\n ]\n },\n {\n \"b\": [\n 4,\n 5,\n 6\n ]\n }\n]",
513
+ "expected_output": "{\n \"a\": [\n 1,\n 2,\n 3\n ],\n \"b\": [\n 4,\n 5,\n 6\n ]\n}",
514
514
  "tested_features": [
515
515
  "nbArray"
516
516
  ],
@@ -528,7 +528,7 @@
528
528
  {
529
529
  "id": "57",
530
530
  "input": "a=1:2:3\n;\nb=4:5:6",
531
- "expected_output": "[\n {\n \"a\": [\n 1,\n 2,\n 3\n ]\n },\n {\n \"b\": [\n 4,\n 5,\n 6\n ]\n }\n]",
531
+ "expected_output": "{\n \"a\": [\n 1,\n 2,\n 3\n ],\n \"b\": [\n 4,\n 5,\n 6\n ]\n}",
532
532
  "tested_features": [
533
533
  "nbArray"
534
534
  ],
@@ -546,7 +546,7 @@
546
546
  {
547
547
  "id": "59",
548
548
  "input": "a(b(c(d(e(f=1)))));\ntesting=%a.b.c.d.e.f",
549
- "expected_output": "[\n {\n \"a\": {\n \"b\": {\n \"c\": {\n \"d\": {\n \"e\": {\n \"f\": 1\n }\n }\n }\n }\n }\n },\n {\n \"testing\": 1\n }\n]",
549
+ "expected_output": "{\n \"a\": {\n \"b\": {\n \"c\": {\n \"d\": {\n \"e\": {\n \"f\": 1\n }\n }\n }\n }\n },\n \"testing\": 1\n}",
550
550
  "tested_features": [
551
551
  "object_ref"
552
552
  ],
@@ -564,7 +564,7 @@
564
564
  {
565
565
  "id": "61",
566
566
  "input": "a=\nb\n=c;\nd=e",
567
- "expected_output": "[\n {\n \"a\": {\n \"b\": \"c\"\n }\n },\n {\n \"d\": \"e\"\n }\n]",
567
+ "expected_output": "{\n \"a\": {\n \"b\": \"c\"\n },\n \"d\": \"e\"\n}",
568
568
  "tested_features": [
569
569
  "map"
570
570
  ],
@@ -573,7 +573,7 @@
573
573
  {
574
574
  "id": "62",
575
575
  "input": "test=this is a #hashtag test;test2=#testing 123",
576
- "expected_output": "[\n {\n \"test\": \"this is a #hashtag test\"\n },\n {\n \"test2\": \"#testing 123\"\n }\n]",
576
+ "expected_output": "{\n \"test\": \"this is a #hashtag test\",\n \"test2\": \"#testing 123\"\n}",
577
577
  "tested_features": [
578
578
  "pair"
579
579
  ],
@@ -609,7 +609,7 @@
609
609
  {
610
610
  "id": "66",
611
611
  "input": "country=gb;\nx=[{ country=gb ? this /country=us? that }]",
612
- "expected_output": "[\n {\n \"country\": \"gb\"\n },\n {\n \"x\": [\n \"this\"\n ]\n }\n]",
612
+ "expected_output": "{\n \"country\": \"gb\",\n \"x\": [\n \"this\"\n ]\n}",
613
613
  "tested_features": [
614
614
  "object_ref",
615
615
  "conditional"
@@ -628,12 +628,12 @@
628
628
  },
629
629
  {
630
630
  "id": "68",
631
- "input": "a=1;b=2;b={{a=1}|{b=2}?true/?false}",
632
- "expected_output": "[\n {\n \"a\": 1\n },\n {\n \"b\": 2\n },\n {\n \"b\": true\n }\n]",
631
+ "input": "a=1;b=2;c={{a=1}|{b=2}?true/?false}",
632
+ "expected_output": "{\n \"a\": 1,\n \"b\": 2,\n \"c\": true\n}",
633
633
  "tested_features": [
634
634
  "conditional"
635
635
  ],
636
- "minimised_modl": "a=1;b=2;b={{a=1}|{b=2}?true/?false}"
636
+ "minimised_modl": "a=1;b=2;c={{a=1}|{b=2}?true/?false}"
637
637
  },
638
638
  {
639
639
  "id": "69",
@@ -658,7 +658,7 @@
658
658
  {
659
659
  "id": "71",
660
660
  "input": "_testing = quick-test of John's variable_methods;\nupcase_example = %testing.u;\ndowncase_example = %testing.d;\ninitcap_example = %testing.i;\nsentence_example = %testing.s;\nurl_encode_example = %testing.u.e",
661
- "expected_output": "[\n {\n \"upcase_example\": \"QUICK-TEST OF JOHN'S VARIABLE_METHODS\"\n },\n {\n \"downcase_example\": \"quick-test of john's variable_methods\"\n },\n {\n \"initcap_example\": \"Quick-test Of John's Variable_methods\"\n },\n {\n \"sentence_example\": \"Quick-test of John's variable_methods\"\n },\n {\n \"url_encode_example\": \"QUICK-TEST+OF+JOHN%27S+VARIABLE_METHODS\"\n }\n]",
661
+ "expected_output": "{\n \"upcase_example\": \"QUICK-TEST OF JOHN'S VARIABLE_METHODS\",\n \"downcase_example\": \"quick-test of john's variable_methods\",\n \"initcap_example\": \"Quick-test Of John's Variable_methods\",\n \"sentence_example\": \"Quick-test of John's variable_methods\",\n \"url_encode_example\": \"QUICK-TEST+OF+JOHN%27S+VARIABLE_METHODS\"\n}",
662
662
  "tested_features": [
663
663
  "string_method"
664
664
  ],
@@ -746,7 +746,7 @@
746
746
  {
747
747
  "id": "80",
748
748
  "input": "_root=tesco.com;\n_branch=direct.;\nnamespace1=%branch%numrecord.%root;\nnamespace2=%branch%_%root%.numq.net",
749
- "expected_output": "[\n {\n \"namespace1\": \"direct.numrecord.tesco.com\"\n },\n {\n \"namespace2\": \"direct._tesco.com.numq.net\"\n }\n]",
749
+ "expected_output": "{\n \"namespace1\": \"direct.numrecord.tesco.com\",\n \"namespace2\": \"direct._tesco.com.numq.net\"\n}",
750
750
  "tested_features": [
751
751
  "object_ref",
752
752
  "graves"
@@ -882,7 +882,7 @@
882
882
  {
883
883
  "id": "94",
884
884
  "input": "_co=at;\n_l=de;\n{\n co=at?\n country=Austria\n language={\n l=fr?\n French\n /l=de?\n German\n /?\n Other\n }\n /?\n country=Other\n}",
885
- "expected_output": "[\n {\n \"country\": \"Austria\"\n },\n {\n \"language\": \"German\"\n }\n]",
885
+ "expected_output": "{\n \"country\": \"Austria\",\n \"language\": \"German\"\n}",
886
886
  "tested_features": [
887
887
  "conditional"
888
888
  ],
@@ -891,7 +891,7 @@
891
891
  {
892
892
  "id": "95",
893
893
  "input": "true2 = 01;\ntrue1 = true;\nfalse2 = 00;\nfalse1 = false;\nnull2 = 000;\nnull1 = null",
894
- "expected_output": "[\n {\n \"true2\": true\n },\n {\n \"true1\": true\n },\n {\n \"false2\": false\n },\n {\n \"false1\": false\n },\n {\n \"null2\": null\n },\n {\n \"null1\": null\n }\n]",
894
+ "expected_output": "{\n \"true2\": true,\n \"true1\": true,\n \"false2\": false,\n \"false1\": false,\n \"null2\": null,\n \"null1\": null\n}",
895
895
  "tested_features": [
896
896
  "bool",
897
897
  "map",
@@ -1075,7 +1075,7 @@
1075
1075
  {
1076
1076
  "id": "114",
1077
1077
  "input": "?[[a;b;c];[one;two;three]];letters=%0;numbers=%1",
1078
- "expected_output": "[\n {\n \"letters\": [\n \"a\",\n \"b\",\n \"c\"\n ]\n },\n {\n \"numbers\": [\n \"one\",\n \"two\",\n \"three\"\n ]\n }\n]",
1078
+ "expected_output": "{\n \"letters\": [\n \"a\",\n \"b\",\n \"c\"\n ],\n \"numbers\": [\n \"one\",\n \"two\",\n \"three\"\n ]\n}",
1079
1079
  "tested_features": [
1080
1080
  "object_ref"
1081
1081
  ],
@@ -1084,7 +1084,7 @@
1084
1084
  {
1085
1085
  "id": "115",
1086
1086
  "input": "?=[a;b;c]:[one;two;three];letters=%0;numbers=%1",
1087
- "expected_output": "[\n {\n \"letters\": [\n \"a\",\n \"b\",\n \"c\"\n ]\n },\n {\n \"numbers\": [\n \"one\",\n \"two\",\n \"three\"\n ]\n }\n]",
1087
+ "expected_output": "{\n \"letters\": [\n \"a\",\n \"b\",\n \"c\"\n ],\n \"numbers\": [\n \"one\",\n \"two\",\n \"three\"\n ]\n}",
1088
1088
  "tested_features": [
1089
1089
  "object_ref"
1090
1090
  ],
@@ -1130,7 +1130,7 @@
1130
1130
  {
1131
1131
  "id": "120",
1132
1132
  "input": "?[zero;one;two];\nfirst_var=%0;\nsecond_var=%1;\nthird_var=%2",
1133
- "expected_output": "[\n {\n \"first_var\": \"zero\"\n },\n {\n \"second_var\": \"one\"\n },\n {\n \"third_var\": \"two\"\n }\n]",
1133
+ "expected_output": "{\n \"first_var\": \"zero\",\n \"second_var\": \"one\",\n \"third_var\": \"two\"\n}",
1134
1134
  "tested_features": [
1135
1135
  "object_ref"
1136
1136
  ],
@@ -1321,7 +1321,7 @@
1321
1321
  {
1322
1322
  "id": "140",
1323
1323
  "input": "?=0:1:2;\nzero=%0;\none=%1;\ntwo=%2",
1324
- "expected_output": "[\n {\n \"zero\": 0\n },\n {\n \"one\": 1\n },\n {\n \"two\": 2\n }\n]",
1324
+ "expected_output": "{\n \"zero\": 0,\n \"one\": 1,\n \"two\": 2\n}",
1325
1325
  "tested_features": [
1326
1326
  "object_ref"
1327
1327
  ],
@@ -1330,7 +1330,7 @@
1330
1330
  {
1331
1331
  "id": "141",
1332
1332
  "input": "?=a:b:c;\nzero=%0;\none=%1;\ntwo=%2\n",
1333
- "expected_output": "[\n {\n \"zero\": \"a\"\n },\n {\n \"one\": \"b\"\n },\n {\n \"two\": \"c\"\n }\n]",
1333
+ "expected_output": "{\n \"zero\": \"a\",\n \"one\": \"b\",\n \"two\": \"c\"\n}",
1334
1334
  "tested_features": [
1335
1335
  "object_ref"
1336
1336
  ],
@@ -1505,7 +1505,7 @@
1505
1505
  {
1506
1506
  "id": "159",
1507
1507
  "input": "COUNTRY=gb;\ncountry=The country is %COUNTRY",
1508
- "expected_output": "[\n {\n \"COUNTRY\": \"gb\"\n },\n {\n \"country\": \"The country is gb\"\n }\n]",
1508
+ "expected_output": "{\n \"COUNTRY\": \"gb\",\n \"country\": \"The country is gb\"\n}",
1509
1509
  "tested_features": [
1510
1510
  "object_ref"
1511
1511
  ],
@@ -1658,12 +1658,12 @@
1658
1658
  },
1659
1659
  {
1660
1660
  "id": "175",
1661
- "input": "*L=\"https://www.modl.uk/tests/message-thread.txt\";\n\nm=out:2018-03-22 15\\:25:Hi;\nm=in:2018-03-22 15\\:26:Hello, how are you?;\nm=out:2018-03-22 15\\:25:Hi, good thanks;\nm=out:2018-03-22 15\\:26:How about you?;\nm=in:2018-03-22 15\\:26:Yes, fine thanks. What are you up to?;\nm=out:2018-03-22 15\\:25:Just testing out MODL;\nm=in:2018-03-22 15\\:26:Cool!",
1661
+ "input": "*L=\"https://www.modl.uk/tests/message-thread.txt\";\n[\nm=out:2018-03-22 15\\:25:Hi;\nm=in:2018-03-22 15\\:26:Hello, how are you?;\nm=out:2018-03-22 15\\:25:Hi, good thanks;\nm=out:2018-03-22 15\\:26:How about you?;\nm=in:2018-03-22 15\\:26:Yes, fine thanks. What are you up to?;\nm=out:2018-03-22 15\\:25:Just testing out MODL;\nm=in:2018-03-22 15\\:26:Cool!\n]",
1662
1662
  "expected_output": "[\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Hi\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Hello, how are you?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Hi, good thanks\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"How about you?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Yes, fine thanks. What are you up to?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Just testing out MODL\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Cool!\",\n \"method\": \"sms\"\n }\n }\n]",
1663
1663
  "tested_features": [
1664
1664
  "load"
1665
1665
  ],
1666
- "minimised_modl": "*L=\"https://www.modl.uk/demo/message-thread.txt\";m=out:2018-03-22 15~:25:Hi;m=in:2018-03-22 15~:26:Hello, how are you?;m=out:2018-03-22 15~:25:Hi, good thanks;m=out:2018-03-22 15~:26:How about you?;m=in:2018-03-22 15~:26:Yes, fine thanks. What are you up to?;m=out:2018-03-22 15~:25:Just testing out MODL;m=in:2018-03-22 15~:26:Cool!"
1666
+ "minimised_modl": "*L=\"https://www.modl.uk/demo/message-thread.txt\";[m=out:2018-03-22 15~:25:Hi;m=in:2018-03-22 15~:26:Hello, how are you?;m=out:2018-03-22 15~:25:Hi, good thanks;m=out:2018-03-22 15~:26:How about you?;m=in:2018-03-22 15~:26:Yes, fine thanks. What are you up to?;m=out:2018-03-22 15~:25:Just testing out MODL;m=in:2018-03-22 15~:26:Cool!]"
1667
1667
  },
1668
1668
  {
1669
1669
  "id": "176",
@@ -1746,18 +1746,18 @@
1746
1746
  },
1747
1747
  {
1748
1748
  "id": "184",
1749
- "input": "*L=grammar_tests/demo_config;\n\nm=out:2018-03-22 15\\:25:Hi;\nm=in:2018-03-22 15\\:26:Hello, how are you?;\nm=out:2018-03-22 15\\:25:Hi, good thanks;\nm=out:2018-03-22 15\\:26:How about you?;\nm=in:2018-03-22 15\\:26:Yes, fine thanks. What are you up to?;\nm=out:2018-03-22 15\\:25:Just testing out MODL;\nm=in:2018-03-22 15\\:26:Cool!",
1749
+ "input": "*L=grammar_tests/demo_config;\n[\nm=out:2018-03-22 15\\:25:Hi;\nm=in:2018-03-22 15\\:26:Hello, how are you?;\nm=out:2018-03-22 15\\:25:Hi, good thanks;\nm=out:2018-03-22 15\\:26:How about you?;\nm=in:2018-03-22 15\\:26:Yes, fine thanks. What are you up to?;\nm=out:2018-03-22 15\\:25:Just testing out MODL;\nm=in:2018-03-22 15\\:26:Cool!\n]",
1750
1750
  "expected_output": "[\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Hi\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Hello, how are you?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Hi, good thanks\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"How about you?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Yes, fine thanks. What are you up to?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Just testing out MODL\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Cool!\",\n \"method\": \"sms\"\n }\n }\n]",
1751
1751
  "tested_features": [
1752
1752
  "object_ref",
1753
1753
  "load"
1754
1754
  ],
1755
- "minimised_modl": "*L=grammar_tests/demo_config;m=out:2018-03-22 15~:25:Hi;m=in:2018-03-22 15~:26:Hello, how are you?;m=out:2018-03-22 15~:25:Hi, good thanks;m=out:2018-03-22 15~:26:How about you?;m=in:2018-03-22 15~:26:Yes, fine thanks. What are you up to?;m=out:2018-03-22 15~:25:Just testing out MODL;m=in:2018-03-22 15~:26:Cool!"
1755
+ "minimised_modl": "*L=grammar_tests/demo_config;m=out:2018-03-22 15~:25:Hi;[m=in:2018-03-22 15~:26:Hello, how are you?;m=out:2018-03-22 15~:25:Hi, good thanks;m=out:2018-03-22 15~:26:How about you?;m=in:2018-03-22 15~:26:Yes, fine thanks. What are you up to?;m=out:2018-03-22 15~:25:Just testing out MODL;m=in:2018-03-22 15~:26:Cool!]"
1756
1756
  },
1757
1757
  {
1758
1758
  "id": "185",
1759
1759
  "input": "## country\n_c = us;\n## language\n_l = en;\n\n*L=grammar_tests/import_config.modl;\n\ncountry = %c;\nlanguage = %l;\ntime_zone = %tz",
1760
- "expected_output": "[\n {\n \"country\": \"us\"\n },\n {\n \"language\": \"en\"\n },\n {\n \"time_zone\": \"EST\"\n }\n]",
1760
+ "expected_output": "{\n \"country\": \"us\",\n \"language\": \"en\",\n \"time_zone\": \"EST\"\n}",
1761
1761
  "tested_features": [
1762
1762
  "object_ref",
1763
1763
  "load",
@@ -1767,13 +1767,13 @@
1767
1767
  },
1768
1768
  {
1769
1769
  "id": "186",
1770
- "input": "*L=grammar_tests/test_import_dir/test_import.txt;\n\nm=out:2018-03-22 15\\:25:Hi;\nm=in:2018-03-22 15\\:26:Hello, how are you?;\nm=out:2018-03-22 15\\:25:Hi, good thanks;\nm=out:2018-03-22 15\\:26:How about you?;\nm=in:2018-03-22 15\\:26:Yes, fine thanks. What are you up to?;\nm=out:2018-03-22 15\\:25:Just testing out MODL;\nm=in:2018-03-22 15\\:26:Cool!",
1770
+ "input": "*L=grammar_tests/test_import_dir/test_import.txt;\n[\nm=out:2018-03-22 15\\:25:Hi;\nm=in:2018-03-22 15\\:26:Hello, how are you?;\nm=out:2018-03-22 15\\:25:Hi, good thanks;\nm=out:2018-03-22 15\\:26:How about you?;\nm=in:2018-03-22 15\\:26:Yes, fine thanks. What are you up to?;\nm=out:2018-03-22 15\\:25:Just testing out MODL;\nm=in:2018-03-22 15\\:26:Cool!\n]",
1771
1771
  "expected_output": "[\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Hi\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Hello, how are you?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Hi, good thanks\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"How about you?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Yes, fine thanks. What are you up to?\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"out\",\n \"date_time\": \"2018-03-22 15:25\",\n \"message\": \"Just testing out MODL\",\n \"method\": \"sms\"\n }\n },\n {\n \"message\": {\n \"direction\": \"in\",\n \"date_time\": \"2018-03-22 15:26\",\n \"message\": \"Cool!\",\n \"method\": \"sms\"\n }\n }\n]",
1772
1772
  "tested_features": [
1773
1773
  "object_ref",
1774
1774
  "load"
1775
1775
  ],
1776
- "minimised_modl": "*L=grammar_tests/test_import_dir/test_import.txt;m=out:2018-03-22 15~:25:Hi;m=in:2018-03-22 15~:26:Hello, how are you?;m=out:2018-03-22 15~:25:Hi, good thanks;m=out:2018-03-22 15~:26:How about you?;m=in:2018-03-22 15~:26:Yes, fine thanks. What are you up to?;m=out:2018-03-22 15~:25:Just testing out MODL;m=in:2018-03-22 15~:26:Cool!"
1776
+ "minimised_modl": "*L=grammar_tests/test_import_dir/test_import.txt;[m=out:2018-03-22 15~:25:Hi;m=in:2018-03-22 15~:26:Hello, how are you?;m=out:2018-03-22 15~:25:Hi, good thanks;m=out:2018-03-22 15~:26:How about you?;m=in:2018-03-22 15~:26:Yes, fine thanks. What are you up to?;m=out:2018-03-22 15~:25:Just testing out MODL;m=in:2018-03-22 15~:26:Cool!]"
1777
1777
  },
1778
1778
  {
1779
1779
  "id": "187",
@@ -1817,7 +1817,7 @@
1817
1817
  {
1818
1818
  "id": "191",
1819
1819
  "input": "one=1;two=2;three=3",
1820
- "expected_output": "[\n {\n \"one\": 1\n },\n {\n \"two\": 2\n },\n {\n \"three\": 3\n }\n]",
1820
+ "expected_output": "{\n \"one\": 1,\n \"two\": 2,\n \"three\": 3\n}",
1821
1821
  "tested_features": [
1822
1822
  "map",
1823
1823
  "pair"
@@ -1836,14 +1836,14 @@
1836
1836
  },
1837
1837
  {
1838
1838
  "id": "193",
1839
- "input": "R=0;\nnumber=1;number=2;number=3",
1840
- "expected_output": "[\n {\n \"R\": 0\n },\n {\n \"number\": 1\n },\n {\n \"number\": 2\n },\n {\n \"number\": 3\n }\n]",
1839
+ "input": "R=0;\nnumber1=1;number2=2;number3=3",
1840
+ "expected_output": "{\n \"R\": 0,\n \"number1\": 1,\n \"number2\": 2,\n \"number3\": 3\n}",
1841
1841
  "tested_features": [
1842
1842
  "map",
1843
1843
  "array",
1844
1844
  "pair"
1845
1845
  ],
1846
- "minimised_modl": "R=0;number=1;number=2;number=3"
1846
+ "minimised_modl": "R=0;number1=1;number2=2;number3=3"
1847
1847
  },
1848
1848
  {
1849
1849
  "id": "194",
@@ -1935,23 +1935,23 @@
1935
1935
  },
1936
1936
  {
1937
1937
  "id": "203",
1938
- "input": "o(n=test);\no(n=test2)",
1939
- "expected_output": "[\n {\n \"o\": {\n \"n\": \"test\"\n }\n },\n {\n \"o\": {\n \"n\": \"test2\"\n }\n }\n]",
1938
+ "input": "o1(n=test);\no2(n=test2)",
1939
+ "expected_output": "{\n \"o1\": {\n \"n\": \"test\"\n },\n \"o2\": {\n \"n\": \"test2\"\n }\n}",
1940
1940
  "tested_features": [
1941
1941
  "map",
1942
1942
  "array"
1943
1943
  ],
1944
- "minimised_modl": "o(n=test);o(n=test2)"
1944
+ "minimised_modl": "o1(n=test);o2(n=test2)"
1945
1945
  },
1946
1946
  {
1947
1947
  "id": "204",
1948
- "input": "o(n=test);o(n=test2)",
1949
- "expected_output": "[\n {\n \"o\": {\n \"n\": \"test\"\n }\n },\n {\n \"o\": {\n \"n\": \"test2\"\n }\n }\n]",
1948
+ "input": "o1(n=test);o2(n=test2)",
1949
+ "expected_output": "{\n \"o1\": {\n \"n\": \"test\"\n },\n \"o2\": {\n \"n\": \"test2\"\n }\n}",
1950
1950
  "tested_features": [
1951
1951
  "map",
1952
1952
  "array"
1953
1953
  ],
1954
- "minimised_modl": "o(n=test);o(n=test2)"
1954
+ "minimised_modl": "o1(n=test);o2(n=test2)"
1955
1955
  },
1956
1956
  {
1957
1957
  "id": "205",
@@ -2139,8 +2139,8 @@
2139
2139
  },
2140
2140
  {
2141
2141
  "id": "224",
2142
- "input": "b=2;c=2;d=2;e=2;a={{b=c & d=e}?v1:v2:v3/?v4:v5:v6}",
2143
- "expected_output": "[\n {\n \"b\": 2\n },\n {\n \"c\": 2\n },\n {\n \"d\": 2\n },\n {\n \"e\": 2\n },\n {\n \"a\": [\n \"v1\",\n \"v2\",\n \"v3\"\n ]\n }\n]",
2142
+ "input": "b=2;\nc=2;\nd=2;\ne=2;\na={\n {b=c & d=e}?\n v1:v2:v3\n /?\n v4:v5:v6\n }",
2143
+ "expected_output": "{\n \"b\": 2,\n \"c\": 2,\n \"d\": 2,\n \"e\": 2,\n \"a\": [\n \"v1\",\n \"v2\",\n \"v3\"\n ]\n}",
2144
2144
  "tested_features": [
2145
2145
  "conditional"
2146
2146
  ],
@@ -2310,13 +2310,13 @@
2310
2310
  },
2311
2311
  {
2312
2312
  "id": "243",
2313
- "input": "tony=hungry;\nneeds_food_1={tony=hungry?true/?false};\nneeds_food_2={!tony=hungry?false/?true};\nneeds_food_3={tony!=hungry?false/?true};\nneeds_food_3={!tony!=hungry?true/?false}",
2314
- "expected_output": "[\n {\n \"tony\": \"hungry\"\n },\n {\n \"needs_food_1\": true\n },\n {\n \"needs_food_2\": true\n },\n {\n \"needs_food_3\": true\n },\n {\n \"needs_food_3\": true\n }\n]",
2313
+ "input": "tony=hungry;\nneeds_food_1={tony=hungry?true/?false};\nneeds_food_2={!tony=hungry?false/?true};\nneeds_food_3={tony!=hungry?false/?true};\nneeds_food_4={!tony!=hungry?true/?false}",
2314
+ "expected_output": "{\n \"tony\": \"hungry\",\n \"needs_food_1\": true,\n \"needs_food_2\": true,\n \"needs_food_3\": true,\n \"needs_food_4\": true\n}",
2315
2315
  "tested_features": [
2316
2316
  "object_ref",
2317
2317
  "conditional"
2318
2318
  ],
2319
- "minimised_modl": "tony=hungry\nneeds_food_1={tony=hungry?true/?false}\nneeds_food_2={!tony=hungry?false/?true}\nneeds_food_3={tony!=hungry?false/?true}\nneeds_food_3={!tony!=hungry?true/?false}"
2319
+ "minimised_modl": "tony=hungry;needs_food_1={tony=hungry?true/?false};needs_food_2={!tony=hungry?false/?true};needs_food_3={tony!=hungry?false/?true};needs_food_4={!tony!=hungry?true/?false}"
2320
2320
  },
2321
2321
  {
2322
2322
  "id": "244",
@@ -2370,12 +2370,12 @@
2370
2370
  },
2371
2371
  {
2372
2372
  "id": "249",
2373
- "input": "*class(\n *id=p;\n *name=person;\n *superclass=map;\n actions=[call;email]\n);\n*class(\n *id=c;\n *name=customer;\n *superclass=person;\n *assign=[\n [title;name;email]\n ]\n);\n*class(\n *id=e;\n *name=employee;\n *superclass=person;\n *assign=[\n [title;name;job_title;email]\n ]\n);\n\n## An employee:\ne=Mr:John Smith:Sales Director:john.smith@example.com;\n## A customer:\nc=Mr:Joe Bloggs:joe.bloggs@example.com;\n## Another customer:\nc=Mrs:Jane Wilson:jane.wilson@example.com",
2373
+ "input": "*class(\n *id=p;\n *name=person;\n *superclass=map;\n actions=[call;email]\n);\n*class(\n *id=c;\n *name=customer;\n *superclass=person;\n *assign=[\n [title;name;email]\n ]\n);\n*class(\n *id=e;\n *name=employee;\n *superclass=person;\n *assign=[\n [title;name;job_title;email]\n ]\n);\n[\n## An employee:\ne=Mr:John Smith:Sales Director:john.smith@example.com;\n## A customer:\nc=Mr:Joe Bloggs:joe.bloggs@example.com;\n## Another customer:\nc=Mrs:Jane Wilson:jane.wilson@example.com\n]",
2374
2374
  "expected_output": "[\n {\n \"employee\": {\n \"title\": \"Mr\",\n \"name\": \"John Smith\",\n \"job_title\": \"Sales Director\",\n \"email\": \"john.smith@example.com\",\n \"actions\": [\n \"call\",\n \"email\"\n ]\n }\n },\n {\n \"customer\": {\n \"title\": \"Mr\",\n \"name\": \"Joe Bloggs\",\n \"email\": \"joe.bloggs@example.com\",\n \"actions\": [\n \"call\",\n \"email\"\n ]\n }\n },\n {\n \"customer\": {\n \"title\": \"Mrs\",\n \"name\": \"Jane Wilson\",\n \"email\": \"jane.wilson@example.com\",\n \"actions\": [\n \"call\",\n \"email\"\n ]\n }\n }\n]",
2375
2375
  "tested_features": [
2376
2376
  "class"
2377
2377
  ],
2378
- "minimised_modl": "*class(*id=p;*name=person;*superclass=map;actions=[call;email]);*class(*id=c;*name=customer;*superclass=person;*assign=[[title;name;email]]);*class(*id=e;*name=employee;*superclass=person;*assign=[[title;name;job_title;email]]);## An employee:;e=Mr:John Smith:Sales Director:john.smith@example.com;## A customer:;c=Mr:Joe Bloggs:joe.bloggs@example.com;## Another customer:;c=Mrs:Jane Wilson:jane.wilson@example.com"
2378
+ "minimised_modl": "*class(*id=p;*name=person;*superclass=map;actions=[call;email]);*class(*id=c;*name=customer;*superclass=person;*assign=[[title;name;email]]);*class(*id=e;*name=employee;*superclass=person;*assign=[[title;name;job_title;email]]);[## An employee:;e=Mr:John Smith:Sales Director:john.smith@example.com;## A customer:;c=Mr:Joe Bloggs:joe.bloggs@example.com;## Another customer:;c=Mrs:Jane Wilson:jane.wilson@example.com]"
2379
2379
  },
2380
2380
  {
2381
2381
  "id": "250",
@@ -2429,7 +2429,7 @@
2429
2429
  {
2430
2430
  "id": "255",
2431
2431
  "input": "*class(*id=a;*name=alpha);a=[1;2;3];b=4:5:6",
2432
- "expected_output": "[\n {\n \"alpha\": [\n 1,\n 2,\n 3\n ]\n },\n {\n \"b\": [\n 4,\n 5,\n 6\n ]\n }\n]",
2432
+ "expected_output": "{\n \"alpha\": [\n 1,\n 2,\n 3\n ],\n \"b\": [\n 4,\n 5,\n 6\n ]\n}",
2433
2433
  "tested_features": [
2434
2434
  "class",
2435
2435
  "superclass_inference"
@@ -2596,7 +2596,7 @@
2596
2596
  {
2597
2597
  "id": "272",
2598
2598
  "input": "ref=123;\nkey=%ref%%",
2599
- "expected_output": "[\n {\n \"ref\": 123\n },\n {\n \"key\": \"123%\"\n }\n]",
2599
+ "expected_output": "{\n \"ref\": 123,\n \"key\": \"123%\"\n}",
2600
2600
  "tested_features": [
2601
2601
  "object_ref"
2602
2602
  ],
@@ -2624,7 +2624,7 @@
2624
2624
  {
2625
2625
  "id": "275",
2626
2626
  "input": "vat=20;\ns=VAT at %vat% added",
2627
- "expected_output": "[\n {\n \"vat\": 20\n },\n {\n \"s\": \"VAT at 20 added\"\n }\n]",
2627
+ "expected_output": "{\n \"vat\": 20,\n \"s\": \"VAT at 20 added\"\n}",
2628
2628
  "tested_features": [
2629
2629
  "object_ref"
2630
2630
  ],
@@ -2633,7 +2633,7 @@
2633
2633
  {
2634
2634
  "id": "276",
2635
2635
  "input": "vat=20;\ns=VAT at %vat%% added",
2636
- "expected_output": "[\n {\n \"vat\": 20\n },\n {\n \"s\": \"VAT at 20% added\"\n }\n]",
2636
+ "expected_output": "{\n \"vat\": 20,\n \"s\": \"VAT at 20% added\"\n}",
2637
2637
  "tested_features": [
2638
2638
  "object_ref"
2639
2639
  ],
@@ -2669,7 +2669,7 @@
2669
2669
  {
2670
2670
  "id": "280",
2671
2671
  "input": "_a=one;\n_b=two;\n_c=three;\n\nd=%a:%b:%c;\ne=[%a;%b;%c]",
2672
- "expected_output": "[\n {\n \"d\": [\n \"one\",\n \"two\",\n \"three\"\n ]\n },\n {\n \"e\": [\n \"one\",\n \"two\",\n \"three\"\n ]\n }\n]",
2672
+ "expected_output": "{\n \"d\": [\n \"one\",\n \"two\",\n \"three\"\n ],\n \"e\": [\n \"one\",\n \"two\",\n \"three\"\n ]\n}",
2673
2673
  "tested_features": [
2674
2674
  "object_ref"
2675
2675
  ],
@@ -2714,7 +2714,7 @@
2714
2714
  {
2715
2715
  "id": "285",
2716
2716
  "input": "_replace_me=new value;\n\none=%replace_me.u;\n\ntwo=`replace_me`.u;\n\nthree=`replace_me.u`;\n\nfour=`%replace_me.u`;\n\nfive=`%replace_me`.u;\n\nsix=%replace_me.u%_added;\n\nseven=replace_me.u;\n\neight=%`replace_me`.u;\n\nnine=%`replace_me`.u%;",
2717
- "expected_output": "[\n {\n \"one\": \"NEW VALUE\"\n },\n {\n \"two\": \"`replace_me`.u\"\n },\n {\n \"three\": \"replace_me.u\"\n },\n {\n \"four\": \"NEW VALUE\"\n },\n {\n \"five\": \"`new value`.u\"\n },\n {\n \"six\": \"NEW VALUE_added\"\n },\n {\n \"seven\": \"replace_me.u\"\n },\n {\n \"eight\": \"REPLACE_ME\"\n },\n {\n \"nine\": \"REPLACE_ME\"\n }\n]",
2717
+ "expected_output": "{\n \"one\": \"NEW VALUE\",\n \"two\": \"`replace_me`.u\",\n \"three\": \"replace_me.u\",\n \"four\": \"NEW VALUE\",\n \"five\": \"`new value`.u\",\n \"six\": \"NEW VALUE_added\",\n \"seven\": \"replace_me.u\",\n \"eight\": \"REPLACE_ME\",\n \"nine\": \"REPLACE_ME\"\n}",
2718
2718
  "tested_features": [
2719
2719
  "object_ref"
2720
2720
  ],
@@ -2789,7 +2789,7 @@
2789
2789
  {
2790
2790
  "id": "293",
2791
2791
  "input": "key=\"string including ` a single grave\"",
2792
- "expected_output": "{\n \"key\": \"string including ` a single grave\"\n}",
2792
+ "expected_output": "{\n \"key\": \"string including ` a single grave\"\n}",
2793
2793
  "tested_features": [
2794
2794
  "quotes",
2795
2795
  "graves"
@@ -2799,7 +2799,7 @@
2799
2799
  {
2800
2800
  "id": "294",
2801
2801
  "input": "key=\"string including some `graved text` here\"",
2802
- "expected_output": "{\n \"key\": \"string including some `graved text` here\"\n}",
2802
+ "expected_output": "{\n \"key\": \"string including some `graved text` here\"\n}",
2803
2803
  "tested_features": [
2804
2804
  "quotes",
2805
2805
  "graves"
@@ -2809,7 +2809,7 @@
2809
2809
  {
2810
2810
  "id": "295",
2811
2811
  "input": "key=`string including \" a quote`",
2812
- "expected_output": "{\n \"key\": \"string including \\\" a quote\"\n}",
2812
+ "expected_output": "{\n \"key\": \"string including \\\" a quote\"\n}",
2813
2813
  "tested_features": [
2814
2814
  "quotes",
2815
2815
  "graves"
@@ -2819,7 +2819,7 @@
2819
2819
  {
2820
2820
  "id": "296",
2821
2821
  "input": "key=`a string including a quote from Winston: \"We'll fight them on the beaches\"`",
2822
- "expected_output": "{\n \"key\": \"a string including a quote from Winston: \\\"We'll fight them on the beaches\\\"\"\n}",
2822
+ "expected_output": "{\n \"key\": \"a string including a quote from Winston: \\\"We'll fight them on the beaches\\\"\"\n}",
2823
2823
  "tested_features": [
2824
2824
  "quotes",
2825
2825
  "graves"
@@ -2829,7 +2829,7 @@
2829
2829
  {
2830
2830
  "id": "297",
2831
2831
  "input": "key=lots of `graved` text is in `this` value",
2832
- "expected_output": "{\n \"key\": \"lots of `graved` text is in `this` value\"\n}",
2832
+ "expected_output": "{\n \"key\": \"lots of `graved` text is in `this` value\"\n}",
2833
2833
  "tested_features": [
2834
2834
  "quotes",
2835
2835
  "graves"
@@ -2839,7 +2839,7 @@
2839
2839
  {
2840
2840
  "id": "298",
2841
2841
  "input": "key=`this `could` be `a` controversial `test` because `the` grammar `splits` this `string` in `a` different `way``",
2842
- "expected_output": "{\n \"key\": \"this `could` be `a` controversial `test` because `the` grammar `splits` this `string` in `a` different `way`\"\n}",
2842
+ "expected_output": "{\n \"key\": \"this `could` be `a` controversial `test` because `the` grammar `splits` this `string` in `a` different `way`\"\n}",
2843
2843
  "tested_features": [
2844
2844
  "quotes",
2845
2845
  "graves"
@@ -2849,7 +2849,7 @@
2849
2849
  {
2850
2850
  "id": "299",
2851
2851
  "input": "_test=abc;\nkey=%test.u",
2852
- "expected_output": "{\n \"key\": \"ABC\"\n}",
2852
+ "expected_output": "{\n \"key\": \"ABC\"\n}",
2853
2853
  "tested_features": [
2854
2854
  "object_ref"
2855
2855
  ],
@@ -2858,7 +2858,7 @@
2858
2858
  {
2859
2859
  "id": "300",
2860
2860
  "input": "_test=replace the word this in this string;\ntesting=%test.replace<`this`,`that`>",
2861
- "expected_output": "{\n \"testing\": \"replace the word that in that string\"\n}",
2861
+ "expected_output": "{\n \"testing\": \"replace the word that in that string\"\n}",
2862
2862
  "tested_features": [
2863
2863
  "methods",
2864
2864
  "object_ref",
@@ -2869,7 +2869,7 @@
2869
2869
  {
2870
2870
  "id": "301",
2871
2871
  "input": "_test=replace the word this in this string;\ntesting=%test.replace<this,``>",
2872
- "expected_output": "{\n \"testing\": \"replace the word in string\"\n}",
2872
+ "expected_output": "{\n \"testing\": \"replace the word in string\"\n}",
2873
2873
  "tested_features": [
2874
2874
  "methods",
2875
2875
  "object_ref",
@@ -2880,7 +2880,7 @@
2880
2880
  {
2881
2881
  "id": "302",
2882
2882
  "input": "key=%`this`.replace<is,at>",
2883
- "expected_output": "{\n \"key\" : \"that\"\n}",
2883
+ "expected_output": "{\n \"key\": \"that\"\n}",
2884
2884
  "tested_features": [
2885
2885
  "methods",
2886
2886
  "object_ref",
@@ -2891,7 +2891,7 @@
2891
2891
  {
2892
2892
  "id": "303",
2893
2893
  "input": "key=`this \"is\" a \"string\" with \"lots\" of \"quoted\" strings`",
2894
- "expected_output": "{\n \"key\": \"this \\\"is\\\" a \\\"string\\\" with \\\"lots\\\" of \\\"quoted\\\" strings\"\n}",
2894
+ "expected_output": "{\n \"key\": \"this \\\"is\\\" a \\\"string\\\" with \\\"lots\\\" of \\\"quoted\\\" strings\"\n}",
2895
2895
  "tested_features": [
2896
2896
  "graves",
2897
2897
  "quotes"
@@ -2901,7 +2901,7 @@
2901
2901
  {
2902
2902
  "id": "304",
2903
2903
  "input": "_vat=20;\nkey=vat rate is %vat%%",
2904
- "expected_output": "{\n \"key\": \"vat rate is 20%\"\n}",
2904
+ "expected_output": "{\n \"key\": \"vat rate is 20%\"\n}",
2905
2905
  "tested_features": [
2906
2906
  "object_ref"
2907
2907
  ],
@@ -2910,7 +2910,7 @@
2910
2910
  {
2911
2911
  "id": "305",
2912
2912
  "input": "_vat=20;\nkey=vat rate is %vat%",
2913
- "expected_output": "{\n \"key\": \"vat rate is 20\"\n}",
2913
+ "expected_output": "{\n \"key\": \"vat rate is 20\"\n}",
2914
2914
  "tested_features": [
2915
2915
  "object_ref"
2916
2916
  ],
@@ -2919,7 +2919,7 @@
2919
2919
  {
2920
2920
  "id": "306",
2921
2921
  "input": "_vat=20;\nkey=vat rate is %vat%%",
2922
- "expected_output": "{\n \"key\": \"vat rate is 20%\"\n}",
2922
+ "expected_output": "{\n \"key\": \"vat rate is 20%\"\n}",
2923
2923
  "tested_features": [
2924
2924
  "object_ref",
2925
2925
  "escapes"
@@ -2938,7 +2938,7 @@
2938
2938
  {
2939
2939
  "id": "308",
2940
2940
  "input": "_vat=20;\nkey=vat rate is %vat %",
2941
- "expected_output": "{\n \"key\": \"vat rate is 20 %\"\n}",
2941
+ "expected_output": "{\n \"key\": \"vat rate is 20 %\"\n}",
2942
2942
  "tested_features": [
2943
2943
  "object_ref"
2944
2944
  ],
@@ -2947,7 +2947,7 @@
2947
2947
  {
2948
2948
  "id": "309",
2949
2949
  "input": "_vat=20;\nkey=`vat rate is %vat%%`",
2950
- "expected_output": "{\n \"key\": \"vat rate is 20%\"\n}",
2950
+ "expected_output": "{\n \"key\": \"vat rate is 20%\"\n}",
2951
2951
  "tested_features": [
2952
2952
  "object_ref",
2953
2953
  "graves"
@@ -2957,7 +2957,7 @@
2957
2957
  {
2958
2958
  "id": "310",
2959
2959
  "input": "_vat=20;\nkey=\"vat rate is %vat%%\"",
2960
- "expected_output": "{\n \"key\": \"vat rate is 20%\"\n}",
2960
+ "expected_output": "{\n \"key\": \"vat rate is 20%\"\n}",
2961
2961
  "tested_features": [
2962
2962
  "object_ref",
2963
2963
  "quotes"
@@ -2967,7 +2967,7 @@
2967
2967
  {
2968
2968
  "id": "311",
2969
2969
  "input": "_vat=20;\nkey=\"vat rate is %vat%`%`\"",
2970
- "expected_output": "{\n \"key\": \"vat rate is 20`%`\"\n}",
2970
+ "expected_output": "{\n \"key\": \"vat rate is 20`%`\"\n}",
2971
2971
  "tested_features": [
2972
2972
  "objetct_ref",
2973
2973
  "graves"
@@ -2977,11 +2977,21 @@
2977
2977
  {
2978
2978
  "id": "312",
2979
2979
  "input": "_vat=20;\nkey=\"vat rate is %vat`%`\"",
2980
- "expected_output": "{\n \"key\": \"vat rate is 20`%`\"\n}",
2980
+ "expected_output": "{\n \"key\": \"vat rate is 20`%`\"\n}",
2981
2981
  "tested_features": [
2982
2982
  "object_ref",
2983
2983
  "graves"
2984
2984
  ],
2985
2985
  "minimised_modl": "_vat=20;key=\"vat rate is %vat`%`\""
2986
+ },
2987
+ {
2988
+ "id": "313",
2989
+ "input": "_test1=e1afmkfd;\nrussian1=%test1.p;\n\n_test2=\"e1afmkfd\";\nrussian2=%test2.p;\n\n_test3=`e1afmkfd`;\nrussian3=%test3.p;",
2990
+ "expected_output": "{\n \"russian1\": \"пример\",\n \"russian2\": \"пример\",\n \"russian3\": \"пример\"\n}",
2991
+ "tested_features": [
2992
+ "punycode",
2993
+ "methods"
2994
+ ],
2995
+ "minimised_modl": "_test1=e1afmkfd;russian1=%test1.p;_test2=\"e1afmkfd\";russian2=%test2.p;_test3=`e1afmkfd`;russian3=%test3.p;"
2986
2996
  }
2987
2997
  ]
@@ -164,6 +164,8 @@ module MODL
164
164
  elsif tc == 'num'
165
165
  if (v.is_a? String) && (v.to_i.to_s == v.to_s)
166
166
  new_value = v.to_i
167
+ elsif (v.is_a? String) && (v.to_f.to_s == v.to_s)
168
+ new_value = v.to_f
167
169
  elsif v.is_a? TrueClass
168
170
  new_value = 1
169
171
  elsif v.is_a? FalseClass
@@ -71,7 +71,11 @@ module MODL
71
71
  txt = File.readlines(file_name).join
72
72
  end
73
73
  rescue StandardError => e
74
- raise InterpreterError, 'File not found: ' + file_name + ', error: ' + e.message
74
+ # Force load from the cache if possible
75
+ parsed = @cache.force_get(file_name)
76
+ if parsed.nil?
77
+ raise InterpreterError, 'File not found: ' + file_name + ', error: ' + e.message
78
+ end
75
79
  end
76
80
  global.loaded_file(file_name)
77
81
 
@@ -27,6 +27,7 @@ require 'modl/parser/MODLParserVisitor'
27
27
  require 'modl/parser/MODLLexer'
28
28
  require 'modl/parser/MODLParser'
29
29
  require 'modl/parser/class_processor'
30
+ require 'modl/parser/orphan_handler'
30
31
  require 'modl/parser/parser'
31
32
  require 'json'
32
33
 
@@ -59,6 +60,9 @@ module MODL
59
60
  # Parse the MODL string into a MODL::Parser::Parsed object.
60
61
  parsed = MODL::Parser::Parser.parse(string)
61
62
 
63
+ # Check for orphan pairs and adopt them.
64
+ parsed.structures = MODL::Parser::OrphanHandler.adopt(parsed.global, parsed.structures)
65
+
62
66
  # Convert the Parsed object into a simpler structure of and Array or Hash
63
67
  interpreted = parsed.extract_hash
64
68
 
@@ -70,6 +70,17 @@ module MODL
70
70
  return if entry.expired?
71
71
 
72
72
  # Otherwise return the cached object.
73
+ # We don't delete the cached entry because we might need to force its use if its expired and offline
74
+ entry.object
75
+ end
76
+
77
+ # If the file is offline this can be used to retrieve the cached version if we have one.
78
+ def force_get(key)
79
+ # Return nothing if not in the cache or it has expired.
80
+ return if key.nil?
81
+
82
+ entry = @cache[key]
83
+ return unless entry
73
84
  entry.object
74
85
  end
75
86
  end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) 2019 NUM Technology Ltd
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
25
+ module MODL
26
+ module Parser
27
+ class OrphanHandler
28
+ #
29
+ # Return true if all strings start with '_'
30
+ #
31
+ def self.all_hidden(str_array)
32
+ if str_array && str_array.length > 0
33
+ str_array.each do |s|
34
+ return false unless s.start_with?('_')
35
+ end
36
+ end
37
+ true
38
+ end
39
+
40
+ #
41
+ # Look for any orphan pairs at the top level and adopt them into a map
42
+ # Its an error if there are duplicate keys or mixed types at the top.
43
+ #
44
+ def self.adopt(global, structures)
45
+ #
46
+ # Separate out any top-level pairs into a separate hash, checking for duplicates on the way.
47
+ #
48
+ if structures
49
+ pairs = Hash.new
50
+
51
+ # This will replace the existing structures array
52
+ new_structures = []
53
+
54
+ structures.each do |s|
55
+ if s.pair
56
+ # skip hidden pairs and instructions
57
+ if s.pair.key.start_with?('*') || s.pair.key.start_with?('_') || s.pair.key == '?'
58
+ new_structures.push(s)
59
+ next
60
+ end
61
+
62
+ if pairs.has_key?(s.pair.key)
63
+ # TODO: raise an exception
64
+ puts 'Duplicate top level key.'
65
+ else
66
+ pairs[s.pair.key] = s
67
+ end
68
+ else
69
+ if pairs.length > 0 && !all_hidden(pairs.keys)
70
+ # TODO: raise an exception
71
+ puts 'Mixed top-level types.'
72
+ else
73
+ new_structures.push(s)
74
+ end
75
+ end
76
+ end
77
+
78
+ if pairs.length > 0
79
+ #
80
+ # Create a map for the pairs and insert them into it.
81
+ #
82
+ new_map = MODL::Parser::Parsed::ParsedMap.new(global)
83
+ pairs.values.each do |p|
84
+ new_map.mapItems.push p unless p.pair.key.start_with?('_')
85
+ end
86
+
87
+ # Add the map to a new structure and insert it at the front of the structures list
88
+ new_struct = MODL::Parser::Parsed::ParsedStructure.new(global)
89
+ new_struct.map = new_map
90
+ new_structures.unshift(new_struct)
91
+
92
+ # Replace the existing structures with the new structures.
93
+ return new_structures
94
+ end
95
+ end
96
+ structures
97
+ end
98
+ end
99
+ end
100
+ end
@@ -64,7 +64,7 @@ module MODL
64
64
  @structures << structure
65
65
  end
66
66
 
67
- @structures = global.structures + structures
67
+ @structures = @global.structures + @structures
68
68
 
69
69
  @global
70
70
  end
@@ -1041,6 +1041,7 @@ module MODL
1041
1041
  end
1042
1042
  end
1043
1043
  end
1044
+ item.structures = OrphanHandler.adopt(@global, item.structures)
1044
1045
  return item.extract_hash
1045
1046
  end
1046
1047
  return unless @topLevelConditionalReturns.length > @conditionTests.length
@@ -162,7 +162,7 @@ module MODL
162
162
  prop = result.find_property(p)
163
163
  if result.text && !prop
164
164
  if StandardMethods.valid_method?(p)
165
- StandardMethods.run_method(p, result.text)
165
+ StandardMethods.run_method(p, Sutil.unquote(result.text))
166
166
  else
167
167
  mthd = global.user_method(p)
168
168
  if !mthd.nil?
@@ -24,6 +24,6 @@
24
24
 
25
25
  module MODL
26
26
  module Parser
27
- VERSION = "0.3.11"
27
+ VERSION = "0.3.12"
28
28
  end
29
29
  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.11
4
+ version: 0.3.12
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-06-25 00:00:00.000000000 Z
11
+ date: 2019-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: antlr4-runtime
@@ -138,6 +138,7 @@ files:
138
138
  - lib/modl/parser/modl_keylist.rb
139
139
  - lib/modl/parser/modl_method.rb
140
140
  - lib/modl/parser/object_cache.rb
141
+ - lib/modl/parser/orphan_handler.rb
141
142
  - lib/modl/parser/parsed.rb
142
143
  - lib/modl/parser/parser.rb
143
144
  - lib/modl/parser/ref_processor.rb