delorean_lang 0.3.21 → 0.3.22

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
  SHA1:
3
- metadata.gz: 99ffaf3ba9b2f09a16c99d58cad8ccacfdadc7b7
4
- data.tar.gz: 182a5449a848937a8095890e8203d69bde65222a
3
+ metadata.gz: 3b207fc973fc90335626ca0a40230e8e4de8f01b
4
+ data.tar.gz: 15d6ac7d5e9c9505ca9eb3410ab7911433380dbb
5
5
  SHA512:
6
- metadata.gz: f2d861e05d82ebc4a075836a549a8a79d4590562bb441e633dbc2601fe7127df43fc14374f872c78d2cf86522c518711f1b8226f1fd46dd5e76e2ed409e52ed8
7
- data.tar.gz: b2285623fbf97148c6513d1823487a1a98f9cecdf1974463923e4e3e3f62a2012d33ceecd6efb85da77ba5efeb8f1ccadb2b8feb4547fe46e4b694d45120d46c
6
+ metadata.gz: 9a10a56f2c88a05e3c6a5aac6885781f5d9fa77b065488ad967d3127a13bc806d770e357f2cbaf46efe9ca610324302898cf0ed75f34271e92bf235aa21df261
7
+ data.tar.gz: 70a91b3fc828e7667b0e0800c7010697987c79ae4ec16f588946ca8c815a9a22ac491b0250091109813669db395614a3c1ab85c57ffd98041dd21420750a1e16
@@ -0,0 +1,22 @@
1
+ module Delorean
2
+ class Debug
3
+ @debug_set = Set[]
4
+ @log_file = '/tmp/delorean.log'
5
+
6
+ def self.set_log_file(f)
7
+ @log_file = f
8
+ end
9
+
10
+ def self.log(obj)
11
+ File.open(@log_file, 'a+') {
12
+ |f|
13
+ f.write obj.inspect
14
+ f.write "\n"
15
+ }
16
+ end
17
+
18
+ def self.debug_set
19
+ @debug_set
20
+ end
21
+ end
22
+ end
@@ -46,7 +46,7 @@ module Delorean
46
46
  r6 = true
47
47
  @index += match_len
48
48
  else
49
- terminal_parse_failure('#')
49
+ terminal_parse_failure('\'#\'')
50
50
  r6 = nil
51
51
  end
52
52
  s5 << r6
@@ -205,7 +205,7 @@ module Delorean
205
205
  r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
206
206
  @index += match_len
207
207
  else
208
- terminal_parse_failure('=?')
208
+ terminal_parse_failure('\'=?\'')
209
209
  r6 = nil
210
210
  end
211
211
  s1 << r6
@@ -255,7 +255,7 @@ module Delorean
255
255
  r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
256
256
  @index += match_len
257
257
  else
258
- terminal_parse_failure('=?')
258
+ terminal_parse_failure('\'=?\'')
259
259
  r15 = nil
260
260
  end
261
261
  s10 << r15
@@ -292,7 +292,7 @@ module Delorean
292
292
  r21 = true
293
293
  @index += match_len
294
294
  else
295
- terminal_parse_failure('=')
295
+ terminal_parse_failure('\'=\'')
296
296
  r21 = nil
297
297
  end
298
298
  s16 << r21
@@ -331,7 +331,7 @@ module Delorean
331
331
  r27 = true
332
332
  @index += match_len
333
333
  else
334
- terminal_parse_failure(':')
334
+ terminal_parse_failure('\':\'')
335
335
  r27 = nil
336
336
  end
337
337
  s25 << r27
@@ -352,7 +352,7 @@ module Delorean
352
352
  r33 = instantiate_node(SyntaxNode,input, index...(index + match_len))
353
353
  @index += match_len
354
354
  else
355
- terminal_parse_failure('::')
355
+ terminal_parse_failure('\'::\'')
356
356
  r33 = nil
357
357
  end
358
358
  s31 << r33
@@ -396,7 +396,7 @@ module Delorean
396
396
  r37 = true
397
397
  @index += match_len
398
398
  else
399
- terminal_parse_failure(':')
399
+ terminal_parse_failure('\':\'')
400
400
  r37 = nil
401
401
  end
402
402
  s35 << r37
@@ -417,7 +417,7 @@ module Delorean
417
417
  r39 = instantiate_node(SyntaxNode,input, index...(index + match_len))
418
418
  @index += match_len
419
419
  else
420
- terminal_parse_failure('import')
420
+ terminal_parse_failure('\'import\'')
421
421
  r39 = nil
422
422
  end
423
423
  s38 << r39
@@ -571,7 +571,7 @@ module Delorean
571
571
  r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
572
572
  @index += match_len
573
573
  else
574
- terminal_parse_failure('ERR(')
574
+ terminal_parse_failure('\'ERR(\'')
575
575
  r2 = nil
576
576
  end
577
577
  s1 << r2
@@ -599,7 +599,7 @@ module Delorean
599
599
  r8 = true
600
600
  @index += match_len
601
601
  else
602
- terminal_parse_failure(')')
602
+ terminal_parse_failure('\')\'')
603
603
  r8 = nil
604
604
  end
605
605
  s1 << r8
@@ -650,7 +650,7 @@ module Delorean
650
650
  r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
651
651
  @index += match_len
652
652
  else
653
- terminal_parse_failure('if')
653
+ terminal_parse_failure('\'if\'')
654
654
  r15 = nil
655
655
  end
656
656
  s14 << r15
@@ -678,7 +678,7 @@ module Delorean
678
678
  r21 = instantiate_node(SyntaxNode,input, index...(index + match_len))
679
679
  @index += match_len
680
680
  else
681
- terminal_parse_failure('then')
681
+ terminal_parse_failure('\'then\'')
682
682
  r21 = nil
683
683
  end
684
684
  s14 << r21
@@ -706,7 +706,7 @@ module Delorean
706
706
  r27 = instantiate_node(SyntaxNode,input, index...(index + match_len))
707
707
  @index += match_len
708
708
  else
709
- terminal_parse_failure('else')
709
+ terminal_parse_failure('\'else\'')
710
710
  r27 = nil
711
711
  end
712
712
  s14 << r27
@@ -949,7 +949,7 @@ module Delorean
949
949
  r2 = true
950
950
  @index += match_len
951
951
  else
952
- terminal_parse_failure('[')
952
+ terminal_parse_failure('\'[\'')
953
953
  r2 = nil
954
954
  end
955
955
  s1 << r2
@@ -977,7 +977,7 @@ module Delorean
977
977
  r8 = true
978
978
  @index += match_len
979
979
  else
980
- terminal_parse_failure(']')
980
+ terminal_parse_failure('\']\'')
981
981
  r8 = nil
982
982
  end
983
983
  s1 << r8
@@ -1001,7 +1001,7 @@ module Delorean
1001
1001
  r10 = true
1002
1002
  @index += match_len
1003
1003
  else
1004
- terminal_parse_failure('(')
1004
+ terminal_parse_failure('\'(\'')
1005
1005
  r10 = nil
1006
1006
  end
1007
1007
  s9 << r10
@@ -1034,7 +1034,7 @@ module Delorean
1034
1034
  r17 = true
1035
1035
  @index += match_len
1036
1036
  else
1037
- terminal_parse_failure(')')
1037
+ terminal_parse_failure('\')\'')
1038
1038
  r17 = nil
1039
1039
  end
1040
1040
  s9 << r17
@@ -1058,7 +1058,7 @@ module Delorean
1058
1058
  r19 = true
1059
1059
  @index += match_len
1060
1060
  else
1061
- terminal_parse_failure('.')
1061
+ terminal_parse_failure('\'.\'')
1062
1062
  r19 = nil
1063
1063
  end
1064
1064
  s18 << r19
@@ -1078,7 +1078,7 @@ module Delorean
1078
1078
  r23 = true
1079
1079
  @index += match_len
1080
1080
  else
1081
- terminal_parse_failure('(')
1081
+ terminal_parse_failure('\'(\'')
1082
1082
  r23 = nil
1083
1083
  end
1084
1084
  s18 << r23
@@ -1111,7 +1111,7 @@ module Delorean
1111
1111
  r30 = true
1112
1112
  @index += match_len
1113
1113
  else
1114
- terminal_parse_failure(')')
1114
+ terminal_parse_failure('\')\'')
1115
1115
  r30 = nil
1116
1116
  end
1117
1117
  s18 << r30
@@ -1138,7 +1138,7 @@ module Delorean
1138
1138
  r32 = true
1139
1139
  @index += match_len
1140
1140
  else
1141
- terminal_parse_failure('.')
1141
+ terminal_parse_failure('\'.\'')
1142
1142
  r32 = nil
1143
1143
  end
1144
1144
  s31 << r32
@@ -1236,7 +1236,7 @@ module Delorean
1236
1236
  r6 = true
1237
1237
  @index += match_len
1238
1238
  else
1239
- terminal_parse_failure(',')
1239
+ terminal_parse_failure('\',\'')
1240
1240
  r6 = nil
1241
1241
  end
1242
1242
  s3 << r6
@@ -1355,7 +1355,7 @@ module Delorean
1355
1355
  r1 = instantiate_node(ListExpr,input, index...(index + match_len))
1356
1356
  @index += match_len
1357
1357
  else
1358
- terminal_parse_failure('[]')
1358
+ terminal_parse_failure('\'[]\'')
1359
1359
  r1 = nil
1360
1360
  end
1361
1361
  if r1
@@ -1367,7 +1367,7 @@ module Delorean
1367
1367
  r3 = true
1368
1368
  @index += match_len
1369
1369
  else
1370
- terminal_parse_failure('[')
1370
+ terminal_parse_failure('\'[\'')
1371
1371
  r3 = nil
1372
1372
  end
1373
1373
  s2 << r3
@@ -1390,7 +1390,7 @@ module Delorean
1390
1390
  r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1391
1391
  @index += match_len
1392
1392
  else
1393
- terminal_parse_failure('for')
1393
+ terminal_parse_failure('\'for\'')
1394
1394
  r8 = nil
1395
1395
  end
1396
1396
  s2 << r8
@@ -1408,7 +1408,7 @@ module Delorean
1408
1408
  r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1409
1409
  @index += match_len
1410
1410
  else
1411
- terminal_parse_failure('in')
1411
+ terminal_parse_failure('\'in\'')
1412
1412
  r12 = nil
1413
1413
  end
1414
1414
  s2 << r12
@@ -1432,7 +1432,7 @@ module Delorean
1432
1432
  r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1433
1433
  @index += match_len
1434
1434
  else
1435
- terminal_parse_failure('if')
1435
+ terminal_parse_failure('\'if\'')
1436
1436
  r19 = nil
1437
1437
  end
1438
1438
  s18 << r19
@@ -1471,7 +1471,7 @@ module Delorean
1471
1471
  r24 = true
1472
1472
  @index += match_len
1473
1473
  else
1474
- terminal_parse_failure(']')
1474
+ terminal_parse_failure('\']\'')
1475
1475
  r24 = nil
1476
1476
  end
1477
1477
  s2 << r24
@@ -1504,7 +1504,7 @@ module Delorean
1504
1504
  r26 = true
1505
1505
  @index += match_len
1506
1506
  else
1507
- terminal_parse_failure('[')
1507
+ terminal_parse_failure('\'[\'')
1508
1508
  r26 = nil
1509
1509
  end
1510
1510
  s25 << r26
@@ -1532,7 +1532,7 @@ module Delorean
1532
1532
  r32 = true
1533
1533
  @index += match_len
1534
1534
  else
1535
- terminal_parse_failure(']')
1535
+ terminal_parse_failure('\']\'')
1536
1536
  r32 = nil
1537
1537
  end
1538
1538
  s25 << r32
@@ -1631,7 +1631,7 @@ module Delorean
1631
1631
  r1 = instantiate_node(SetExpr,input, index...(index + match_len))
1632
1632
  @index += match_len
1633
1633
  else
1634
- terminal_parse_failure('{-}')
1634
+ terminal_parse_failure('\'{-}\'')
1635
1635
  r1 = nil
1636
1636
  end
1637
1637
  if r1
@@ -1643,7 +1643,7 @@ module Delorean
1643
1643
  r3 = true
1644
1644
  @index += match_len
1645
1645
  else
1646
- terminal_parse_failure('{')
1646
+ terminal_parse_failure('\'{\'')
1647
1647
  r3 = nil
1648
1648
  end
1649
1649
  s2 << r3
@@ -1666,7 +1666,7 @@ module Delorean
1666
1666
  r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1667
1667
  @index += match_len
1668
1668
  else
1669
- terminal_parse_failure('for')
1669
+ terminal_parse_failure('\'for\'')
1670
1670
  r8 = nil
1671
1671
  end
1672
1672
  s2 << r8
@@ -1684,7 +1684,7 @@ module Delorean
1684
1684
  r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1685
1685
  @index += match_len
1686
1686
  else
1687
- terminal_parse_failure('in')
1687
+ terminal_parse_failure('\'in\'')
1688
1688
  r12 = nil
1689
1689
  end
1690
1690
  s2 << r12
@@ -1708,7 +1708,7 @@ module Delorean
1708
1708
  r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1709
1709
  @index += match_len
1710
1710
  else
1711
- terminal_parse_failure('if')
1711
+ terminal_parse_failure('\'if\'')
1712
1712
  r19 = nil
1713
1713
  end
1714
1714
  s18 << r19
@@ -1747,7 +1747,7 @@ module Delorean
1747
1747
  r24 = true
1748
1748
  @index += match_len
1749
1749
  else
1750
- terminal_parse_failure('}')
1750
+ terminal_parse_failure('\'}\'')
1751
1751
  r24 = nil
1752
1752
  end
1753
1753
  s2 << r24
@@ -1780,7 +1780,7 @@ module Delorean
1780
1780
  r26 = true
1781
1781
  @index += match_len
1782
1782
  else
1783
- terminal_parse_failure('{')
1783
+ terminal_parse_failure('\'{\'')
1784
1784
  r26 = nil
1785
1785
  end
1786
1786
  s25 << r26
@@ -1808,7 +1808,7 @@ module Delorean
1808
1808
  r32 = true
1809
1809
  @index += match_len
1810
1810
  else
1811
- terminal_parse_failure('}')
1811
+ terminal_parse_failure('\'}\'')
1812
1812
  r32 = nil
1813
1813
  end
1814
1814
  s25 << r32
@@ -1911,7 +1911,7 @@ module Delorean
1911
1911
  r1 = instantiate_node(HashExpr,input, index...(index + match_len))
1912
1912
  @index += match_len
1913
1913
  else
1914
- terminal_parse_failure('{}')
1914
+ terminal_parse_failure('\'{}\'')
1915
1915
  r1 = nil
1916
1916
  end
1917
1917
  if r1
@@ -1923,7 +1923,7 @@ module Delorean
1923
1923
  r3 = true
1924
1924
  @index += match_len
1925
1925
  else
1926
- terminal_parse_failure('{')
1926
+ terminal_parse_failure('\'{\'')
1927
1927
  r3 = nil
1928
1928
  end
1929
1929
  s2 << r3
@@ -1951,7 +1951,7 @@ module Delorean
1951
1951
  r9 = true
1952
1952
  @index += match_len
1953
1953
  else
1954
- terminal_parse_failure(':')
1954
+ terminal_parse_failure('\':\'')
1955
1955
  r9 = nil
1956
1956
  end
1957
1957
  s2 << r9
@@ -1974,7 +1974,7 @@ module Delorean
1974
1974
  r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1975
1975
  @index += match_len
1976
1976
  else
1977
- terminal_parse_failure('for')
1977
+ terminal_parse_failure('\'for\'')
1978
1978
  r14 = nil
1979
1979
  end
1980
1980
  s2 << r14
@@ -1992,7 +1992,7 @@ module Delorean
1992
1992
  r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1993
1993
  @index += match_len
1994
1994
  else
1995
- terminal_parse_failure('in')
1995
+ terminal_parse_failure('\'in\'')
1996
1996
  r18 = nil
1997
1997
  end
1998
1998
  s2 << r18
@@ -2016,7 +2016,7 @@ module Delorean
2016
2016
  r25 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2017
2017
  @index += match_len
2018
2018
  else
2019
- terminal_parse_failure('if')
2019
+ terminal_parse_failure('\'if\'')
2020
2020
  r25 = nil
2021
2021
  end
2022
2022
  s24 << r25
@@ -2055,7 +2055,7 @@ module Delorean
2055
2055
  r30 = true
2056
2056
  @index += match_len
2057
2057
  else
2058
- terminal_parse_failure('}')
2058
+ terminal_parse_failure('\'}\'')
2059
2059
  r30 = nil
2060
2060
  end
2061
2061
  s2 << r30
@@ -2092,7 +2092,7 @@ module Delorean
2092
2092
  r32 = true
2093
2093
  @index += match_len
2094
2094
  else
2095
- terminal_parse_failure('{')
2095
+ terminal_parse_failure('\'{\'')
2096
2096
  r32 = nil
2097
2097
  end
2098
2098
  s31 << r32
@@ -2120,7 +2120,7 @@ module Delorean
2120
2120
  r38 = true
2121
2121
  @index += match_len
2122
2122
  else
2123
- terminal_parse_failure('}')
2123
+ terminal_parse_failure('\'}\'')
2124
2124
  r38 = nil
2125
2125
  end
2126
2126
  s31 << r38
@@ -2172,7 +2172,7 @@ module Delorean
2172
2172
  r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2173
2173
  @index += match_len
2174
2174
  else
2175
- terminal_parse_failure('==')
2175
+ terminal_parse_failure('\'==\'')
2176
2176
  r1 = nil
2177
2177
  end
2178
2178
  if r1
@@ -2183,7 +2183,7 @@ module Delorean
2183
2183
  r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2184
2184
  @index += match_len
2185
2185
  else
2186
- terminal_parse_failure('!=')
2186
+ terminal_parse_failure('\'!=\'')
2187
2187
  r2 = nil
2188
2188
  end
2189
2189
  if r2
@@ -2194,7 +2194,7 @@ module Delorean
2194
2194
  r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2195
2195
  @index += match_len
2196
2196
  else
2197
- terminal_parse_failure('>=')
2197
+ terminal_parse_failure('\'>=\'')
2198
2198
  r3 = nil
2199
2199
  end
2200
2200
  if r3
@@ -2205,7 +2205,7 @@ module Delorean
2205
2205
  r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2206
2206
  @index += match_len
2207
2207
  else
2208
- terminal_parse_failure('<=')
2208
+ terminal_parse_failure('\'<=\'')
2209
2209
  r4 = nil
2210
2210
  end
2211
2211
  if r4
@@ -2216,7 +2216,7 @@ module Delorean
2216
2216
  r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2217
2217
  @index += match_len
2218
2218
  else
2219
- terminal_parse_failure('&&')
2219
+ terminal_parse_failure('\'&&\'')
2220
2220
  r5 = nil
2221
2221
  end
2222
2222
  if r5
@@ -2227,7 +2227,7 @@ module Delorean
2227
2227
  r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2228
2228
  @index += match_len
2229
2229
  else
2230
- terminal_parse_failure('||')
2230
+ terminal_parse_failure('\'||\'')
2231
2231
  r6 = nil
2232
2232
  end
2233
2233
  if r6
@@ -2238,7 +2238,7 @@ module Delorean
2238
2238
  r7 = true
2239
2239
  @index += match_len
2240
2240
  else
2241
- terminal_parse_failure('>')
2241
+ terminal_parse_failure('\'>\'')
2242
2242
  r7 = nil
2243
2243
  end
2244
2244
  if r7
@@ -2249,7 +2249,7 @@ module Delorean
2249
2249
  r8 = true
2250
2250
  @index += match_len
2251
2251
  else
2252
- terminal_parse_failure('<')
2252
+ terminal_parse_failure('\'<\'')
2253
2253
  r8 = nil
2254
2254
  end
2255
2255
  if r8
@@ -2260,7 +2260,7 @@ module Delorean
2260
2260
  r9 = true
2261
2261
  @index += match_len
2262
2262
  else
2263
- terminal_parse_failure('+')
2263
+ terminal_parse_failure('\'+\'')
2264
2264
  r9 = nil
2265
2265
  end
2266
2266
  if r9
@@ -2271,7 +2271,7 @@ module Delorean
2271
2271
  r10 = true
2272
2272
  @index += match_len
2273
2273
  else
2274
- terminal_parse_failure('-')
2274
+ terminal_parse_failure('\'-\'')
2275
2275
  r10 = nil
2276
2276
  end
2277
2277
  if r10
@@ -2282,7 +2282,7 @@ module Delorean
2282
2282
  r11 = true
2283
2283
  @index += match_len
2284
2284
  else
2285
- terminal_parse_failure('*')
2285
+ terminal_parse_failure('\'*\'')
2286
2286
  r11 = nil
2287
2287
  end
2288
2288
  if r11
@@ -2293,7 +2293,7 @@ module Delorean
2293
2293
  r12 = true
2294
2294
  @index += match_len
2295
2295
  else
2296
- terminal_parse_failure('/')
2296
+ terminal_parse_failure('\'/\'')
2297
2297
  r12 = nil
2298
2298
  end
2299
2299
  if r12
@@ -2304,7 +2304,7 @@ module Delorean
2304
2304
  r13 = true
2305
2305
  @index += match_len
2306
2306
  else
2307
- terminal_parse_failure('%')
2307
+ terminal_parse_failure('\'%\'')
2308
2308
  r13 = nil
2309
2309
  end
2310
2310
  if r13
@@ -2315,7 +2315,7 @@ module Delorean
2315
2315
  r14 = true
2316
2316
  @index += match_len
2317
2317
  else
2318
- terminal_parse_failure('&')
2318
+ terminal_parse_failure('\'&\'')
2319
2319
  r14 = nil
2320
2320
  end
2321
2321
  if r14
@@ -2326,7 +2326,7 @@ module Delorean
2326
2326
  r15 = true
2327
2327
  @index += match_len
2328
2328
  else
2329
- terminal_parse_failure('^')
2329
+ terminal_parse_failure('\'^\'')
2330
2330
  r15 = nil
2331
2331
  end
2332
2332
  if r15
@@ -2337,7 +2337,7 @@ module Delorean
2337
2337
  r16 = true
2338
2338
  @index += match_len
2339
2339
  else
2340
- terminal_parse_failure('|')
2340
+ terminal_parse_failure('\'|\'')
2341
2341
  r16 = nil
2342
2342
  end
2343
2343
  if r16
@@ -2349,7 +2349,7 @@ module Delorean
2349
2349
  r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2350
2350
  @index += match_len
2351
2351
  else
2352
- terminal_parse_failure('in')
2352
+ terminal_parse_failure('\'in\'')
2353
2353
  r18 = nil
2354
2354
  end
2355
2355
  s17 << r18
@@ -2409,7 +2409,7 @@ module Delorean
2409
2409
  r1 = true
2410
2410
  @index += match_len
2411
2411
  else
2412
- terminal_parse_failure('!')
2412
+ terminal_parse_failure('\'!\'')
2413
2413
  r1 = nil
2414
2414
  end
2415
2415
  if r1
@@ -2420,7 +2420,7 @@ module Delorean
2420
2420
  r2 = true
2421
2421
  @index += match_len
2422
2422
  else
2423
- terminal_parse_failure('-')
2423
+ terminal_parse_failure('\'-\'')
2424
2424
  r2 = nil
2425
2425
  end
2426
2426
  if r2
@@ -2532,7 +2532,7 @@ module Delorean
2532
2532
  r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2533
2533
  @index += match_len
2534
2534
  else
2535
- terminal_parse_failure('::')
2535
+ terminal_parse_failure('\'::\'')
2536
2536
  r15 = nil
2537
2537
  end
2538
2538
  s13 << r15
@@ -2570,7 +2570,7 @@ module Delorean
2570
2570
  r18 = true
2571
2571
  @index += match_len
2572
2572
  else
2573
- terminal_parse_failure('(')
2573
+ terminal_parse_failure('\'(\'')
2574
2574
  r18 = nil
2575
2575
  end
2576
2576
  s17 << r18
@@ -2598,7 +2598,7 @@ module Delorean
2598
2598
  r24 = true
2599
2599
  @index += match_len
2600
2600
  else
2601
- terminal_parse_failure(')')
2601
+ terminal_parse_failure('\')\'')
2602
2602
  r24 = nil
2603
2603
  end
2604
2604
  s17 << r24
@@ -2681,7 +2681,7 @@ module Delorean
2681
2681
  r6 = true
2682
2682
  @index += match_len
2683
2683
  else
2684
- terminal_parse_failure(',')
2684
+ terminal_parse_failure('\',\'')
2685
2685
  r6 = nil
2686
2686
  end
2687
2687
  s3 << r6
@@ -2778,7 +2778,7 @@ module Delorean
2778
2778
  r4 = true
2779
2779
  @index += match_len
2780
2780
  else
2781
- terminal_parse_failure(':')
2781
+ terminal_parse_failure('\':\'')
2782
2782
  r4 = nil
2783
2783
  end
2784
2784
  s0 << r4
@@ -2807,7 +2807,7 @@ module Delorean
2807
2807
  r12 = true
2808
2808
  @index += match_len
2809
2809
  else
2810
- terminal_parse_failure(',')
2810
+ terminal_parse_failure('\',\'')
2811
2811
  r12 = nil
2812
2812
  end
2813
2813
  s9 << r12
@@ -2916,7 +2916,7 @@ module Delorean
2916
2916
  r6 = true
2917
2917
  @index += match_len
2918
2918
  else
2919
- terminal_parse_failure('=')
2919
+ terminal_parse_failure('\'=\'')
2920
2920
  r6 = nil
2921
2921
  end
2922
2922
  s2 << r6
@@ -2961,7 +2961,7 @@ module Delorean
2961
2961
  r14 = true
2962
2962
  @index += match_len
2963
2963
  else
2964
- terminal_parse_failure(',')
2964
+ terminal_parse_failure('\',\'')
2965
2965
  r14 = nil
2966
2966
  end
2967
2967
  s11 << r14
@@ -3038,7 +3038,7 @@ module Delorean
3038
3038
  r2 = true
3039
3039
  @index += match_len
3040
3040
  else
3041
- terminal_parse_failure('.')
3041
+ terminal_parse_failure('\'.\'')
3042
3042
  r2 = nil
3043
3043
  end
3044
3044
  s0 << r2
@@ -3099,7 +3099,7 @@ module Delorean
3099
3099
  r1 = instantiate_node(Literal,input, index...(index + match_len))
3100
3100
  @index += match_len
3101
3101
  else
3102
- terminal_parse_failure('0')
3102
+ terminal_parse_failure('\'0\'')
3103
3103
  r1 = nil
3104
3104
  end
3105
3105
  if r1
@@ -3226,7 +3226,7 @@ module Delorean
3226
3226
  r1 = instantiate_node(Literal,input, index...(index + match_len))
3227
3227
  @index += match_len
3228
3228
  else
3229
- terminal_parse_failure('true')
3229
+ terminal_parse_failure('\'true\'')
3230
3230
  r1 = nil
3231
3231
  end
3232
3232
  if r1
@@ -3237,7 +3237,7 @@ module Delorean
3237
3237
  r2 = instantiate_node(Literal,input, index...(index + match_len))
3238
3238
  @index += match_len
3239
3239
  else
3240
- terminal_parse_failure('false')
3240
+ terminal_parse_failure('\'false\'')
3241
3241
  r2 = nil
3242
3242
  end
3243
3243
  if r2
@@ -3269,7 +3269,7 @@ module Delorean
3269
3269
  r0 = instantiate_node(Self,input, index...(index + match_len))
3270
3270
  @index += match_len
3271
3271
  else
3272
- terminal_parse_failure('_')
3272
+ terminal_parse_failure('\'_\'')
3273
3273
  r0 = nil
3274
3274
  end
3275
3275
 
@@ -3293,7 +3293,7 @@ module Delorean
3293
3293
  r0 = instantiate_node(Literal,input, index...(index + match_len))
3294
3294
  @index += match_len
3295
3295
  else
3296
- terminal_parse_failure('nil')
3296
+ terminal_parse_failure('\'nil\'')
3297
3297
  r0 = nil
3298
3298
  end
3299
3299
 
@@ -3317,7 +3317,7 @@ module Delorean
3317
3317
  r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3318
3318
  @index += match_len
3319
3319
  else
3320
- terminal_parse_failure(' ')
3320
+ terminal_parse_failure('\' \'')
3321
3321
  r0 = nil
3322
3322
  end
3323
3323
 
@@ -3390,7 +3390,7 @@ module Delorean
3390
3390
  r2 = true
3391
3391
  @index += match_len
3392
3392
  else
3393
- terminal_parse_failure('"')
3393
+ terminal_parse_failure('\'"\'')
3394
3394
  r2 = nil
3395
3395
  end
3396
3396
  s1 << r2
@@ -3402,7 +3402,7 @@ module Delorean
3402
3402
  r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3403
3403
  @index += match_len
3404
3404
  else
3405
- terminal_parse_failure('\"')
3405
+ terminal_parse_failure('\'\\"\'')
3406
3406
  r5 = nil
3407
3407
  end
3408
3408
  if r5
@@ -3415,12 +3415,15 @@ module Delorean
3415
3415
  r8 = true
3416
3416
  @index += match_len
3417
3417
  else
3418
- terminal_parse_failure('"')
3418
+ terminal_parse_failure('\'"\'')
3419
3419
  r8 = nil
3420
3420
  end
3421
3421
  if r8
3422
+ @index = i7
3422
3423
  r7 = nil
3424
+ terminal_parse_failure('\'"\'', true)
3423
3425
  else
3426
+ terminal_failures.pop
3424
3427
  @index = i7
3425
3428
  r7 = instantiate_node(SyntaxNode,input, index...index)
3426
3429
  end
@@ -3463,7 +3466,7 @@ module Delorean
3463
3466
  r10 = true
3464
3467
  @index += match_len
3465
3468
  else
3466
- terminal_parse_failure('"')
3469
+ terminal_parse_failure('\'"\'')
3467
3470
  r10 = nil
3468
3471
  end
3469
3472
  s1 << r10
@@ -3485,7 +3488,7 @@ module Delorean
3485
3488
  r12 = true
3486
3489
  @index += match_len
3487
3490
  else
3488
- terminal_parse_failure("'")
3491
+ terminal_parse_failure('"\'"')
3489
3492
  r12 = nil
3490
3493
  end
3491
3494
  s11 << r12
@@ -3512,7 +3515,7 @@ module Delorean
3512
3515
  r15 = true
3513
3516
  @index += match_len
3514
3517
  else
3515
- terminal_parse_failure("'")
3518
+ terminal_parse_failure('"\'"')
3516
3519
  r15 = nil
3517
3520
  end
3518
3521
  s11 << r15
@@ -102,10 +102,16 @@ eos
102
102
  end
103
103
 
104
104
  def rewrite(context)
105
+ dname = [context.module_name, context.last_node, i.text_value].join('.')
106
+ debug = Debug.debug_set.member?(dname)
107
+
105
108
  # an attr is defined as a class function on the node class.
106
109
  "class #{context.last_node}; " +
107
110
  "def self.#{i.text_value}#{POST}(_e); " +
108
- "_e[self.name+'.#{i.text_value}'] ||= #{e.rewrite(context)}; end; end;"
111
+ (debug ? "_debug =" : '') +
112
+ "_e[self.name+'.#{i.text_value}'] ||= #{e.rewrite(context)};" +
113
+ (debug ? 'Delorean::Debug.log(_debug); _debug;' : '') +
114
+ "end; end;"
109
115
  end
110
116
  end
111
117
 
@@ -1,3 +1,3 @@
1
1
  module Delorean
2
- VERSION = "0.3.21"
2
+ VERSION = "0.3.22"
3
3
  end
@@ -8,4 +8,4 @@ require 'delorean/base'
8
8
  require 'delorean/error'
9
9
  require 'delorean/container'
10
10
  require 'delorean/model'
11
-
11
+ require 'delorean/debug'
@@ -985,4 +985,14 @@ eof
985
985
  r = engine.evaluate("A", "b")
986
986
  expect(r).to eq ["hello"]
987
987
  end
988
+
989
+ it "node calls are not memoized/cached" do
990
+ engine.parse defn("A:",
991
+ " x = Dummy.side_effect",
992
+ "B: A",
993
+ " x = (A() + _).x + (A() + _).x"
994
+ )
995
+ r = engine.evaluate("B", "x")
996
+ expect(r).to eq 3
997
+ end
988
998
  end
@@ -673,7 +673,7 @@ describe "Delorean" do
673
673
  engine.reset
674
674
  end
675
675
 
676
- it "should accept hash comprehension 2-var unpacking" do
676
+ it "should handle nested comprehension variables" do
677
677
  engine.parse defn("A:",
678
678
  " b = [ a+b for a, b in [] ]",
679
679
  )
@@ -26,7 +26,7 @@ ActiveRecord::Migration.create_table :dummies do |t|
26
26
  t.string :name
27
27
  t.decimal :number
28
28
  t.references :dummy
29
- t.timestamps
29
+ t.timestamps null: true
30
30
  end
31
31
 
32
32
  class Dummy < ActiveRecord::Base
@@ -83,6 +83,11 @@ class Dummy < ActiveRecord::Base
83
83
  end
84
84
 
85
85
  delorean_instance_method :name3, String
86
+
87
+ @@foo = 0
88
+ delorean_fn :side_effect, sig: 0 do
89
+ @@foo += 1
90
+ end
86
91
  end
87
92
 
88
93
  module M
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delorean_lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.21
4
+ version: 0.3.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop
@@ -84,6 +84,7 @@ files:
84
84
  - lib/delorean/base.rb
85
85
  - lib/delorean/const.rb
86
86
  - lib/delorean/container.rb
87
+ - lib/delorean/debug.rb
87
88
  - lib/delorean/delorean.rb
88
89
  - lib/delorean/delorean.treetop
89
90
  - lib/delorean/engine.rb
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  version: '0'
118
119
  requirements: []
119
120
  rubyforge_project:
120
- rubygems_version: 2.4.3
121
+ rubygems_version: 2.5.2
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: Delorean compiler