Last active
December 15, 2015 20:41
-
-
Save olasd/5320553 to your computer and use it in GitHub Desktop.
Parsley is fun.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⏚ [nicolasd:~/code/parsley] [parsley] $ python test_parsley.py | |
('root', | |
[(1, 0), (346, 0)], | |
('parens', | |
[(3, 0), (3, 36)], | |
('token', [(3, 1), (3, 12)], 'import-from'), | |
('token', | |
[(3, 13), (3, 28)], | |
'tests.resources'), | |
('token', [(3, 29), (3, 35)], 'kwtest')), | |
('parens', | |
[(4, 0), (4, 41)], | |
('token', [(4, 1), (4, 12)], 'import-from'), | |
('token', [(4, 13), (4, 20)], 'os.path'), | |
('token', [(4, 21), (4, 27)], 'exists'), | |
('token', [(4, 28), (4, 33)], 'isdir'), | |
('token', [(4, 34), (4, 40)], 'isfile')), | |
('parens', | |
[(5, 0), (5, 12)], | |
('token', [(5, 1), (5, 7)], 'import'), | |
('token', [(5, 8), (5, 11)], 'sys')), | |
('parens', | |
[(6, 0), (6, 23)], | |
('token', [(6, 1), (6, 10)], 'import-as'), | |
('token', [(6, 11), (6, 14)], 'sys'), | |
('token', [(6, 15), (6, 22)], 'systest')), | |
('parens', | |
[(9, 0), (14, 38)], | |
('token', [(9, 1), (9, 5)], 'defn'), | |
('token', [(9, 6), (9, 19)], 'test-sys-argv'), | |
('list', [(9, 20), (9, 22)]), | |
('string', | |
[(10, 2), (10, 25)], | |
'NATIVE: test sys.argv'), | |
('parens', | |
[(14, 2), (14, 37)], | |
('token', [(14, 3), (14, 9)], 'assert'), | |
('parens', | |
[(14, 10), (14, 36)], | |
('token', | |
[(14, 11), (14, 21)], | |
'isinstance'), | |
('token', | |
[(14, 22), (14, 30)], | |
'sys.argv'), | |
('token', [(14, 31), (14, 35)], 'list')))), | |
('parens', | |
[(17, 0), (19, 41)], | |
('token', [(17, 1), (17, 5)], 'defn'), | |
('token', [(17, 6), (17, 16)], 'test-lists'), | |
('list', [(17, 17), (17, 19)]), | |
('string', | |
[(18, 2), (18, 33)], | |
'NATIVE: test lists work right'), | |
('parens', | |
[(19, 2), (19, 40)], | |
('token', [(19, 3), (19, 9)], 'assert'), | |
('parens', | |
[(19, 10), (19, 39)], | |
('token', [(19, 11), (19, 12)], '='), | |
('list', | |
[(19, 13), (19, 22)], | |
('number', [(19, 14), (19, 15)], '1'), | |
('number', [(19, 16), (19, 17)], '2'), | |
('number', [(19, 18), (19, 19)], '3'), | |
('number', [(19, 20), (19, 21)], '4')), | |
('parens', | |
[(19, 23), (19, 38)], | |
('token', [(19, 24), (19, 25)], '+'), | |
('list', | |
[(19, 26), (19, 31)], | |
('number', [(19, 27), (19, 28)], '1'), | |
('number', [(19, 29), (19, 30)], '2')), | |
('list', | |
[(19, 32), (19, 37)], | |
('number', [(19, 33), (19, 34)], '3'), | |
('number', [(19, 35), (19, 36)], '4')))))), | |
('parens', | |
[(22, 0), (32, 25)], | |
('token', [(22, 1), (22, 5)], 'defn'), | |
('token', | |
[(22, 6), (22, 19)], | |
'test-for-loop'), | |
('list', [(22, 20), (22, 22)]), | |
('string', | |
[(23, 2), (23, 27)], | |
'NATIVE: test for loops?'), | |
('parens', | |
[(24, 2), (24, 16)], | |
('token', [(24, 3), (24, 7)], 'setv'), | |
('token', [(24, 8), (24, 13)], 'count'), | |
('number', [(24, 14), (24, 15)], '0')), | |
('parens', | |
[(25, 2), (26, 29)], | |
('token', [(25, 3), (25, 6)], 'for'), | |
('list', | |
[(25, 7), (25, 22)], | |
('token', [(25, 8), (25, 9)], 'x'), | |
('list', | |
[(25, 10), (25, 21)], | |
('number', [(25, 11), (25, 12)], '1'), | |
('number', [(25, 13), (25, 14)], '2'), | |
('number', [(25, 15), (25, 16)], '3'), | |
('number', [(25, 17), (25, 18)], '4'), | |
('number', [(25, 19), (25, 20)], '5'))), | |
('parens', | |
[(26, 4), (26, 28)], | |
('token', [(26, 5), (26, 9)], 'setv'), | |
('token', [(26, 10), (26, 15)], 'count'), | |
('parens', | |
[(26, 16), (26, 27)], | |
('token', [(26, 17), (26, 18)], '+'), | |
('token', | |
[(26, 19), (26, 24)], | |
'count'), | |
('token', [(26, 25), (26, 26)], 'x')))), | |
('parens', | |
[(27, 2), (27, 23)], | |
('token', [(27, 3), (27, 9)], 'assert'), | |
('parens', | |
[(27, 10), (27, 22)], | |
('token', [(27, 11), (27, 12)], '='), | |
('token', [(27, 13), (27, 18)], 'count'), | |
('number', [(27, 19), (27, 21)], '15'))), | |
('parens', | |
[(28, 2), (28, 16)], | |
('token', [(28, 3), (28, 7)], 'setv'), | |
('token', [(28, 8), (28, 13)], 'count'), | |
('number', [(28, 14), (28, 15)], '0')), | |
('parens', | |
[(29, 2), (31, 31)], | |
('token', [(29, 3), (29, 6)], 'for'), | |
('list', | |
[(29, 7), (30, 22)], | |
('token', [(29, 8), (29, 9)], 'x'), | |
('list', | |
[(29, 10), (29, 21)], | |
('number', [(29, 11), (29, 12)], '1'), | |
('number', [(29, 13), (29, 14)], '2'), | |
('number', [(29, 15), (29, 16)], '3'), | |
('number', [(29, 17), (29, 18)], '4'), | |
('number', [(29, 19), (29, 20)], '5')), | |
('token', [(30, 8), (30, 9)], 'y'), | |
('list', | |
[(30, 10), (30, 21)], | |
('number', [(30, 11), (30, 12)], '1'), | |
('number', [(30, 13), (30, 14)], '2'), | |
('number', [(30, 15), (30, 16)], '3'), | |
('number', [(30, 17), (30, 18)], '4'), | |
('number', [(30, 19), (30, 20)], '5'))), | |
('parens', | |
[(31, 4), (31, 30)], | |
('token', [(31, 5), (31, 9)], 'setv'), | |
('token', [(31, 10), (31, 15)], 'count'), | |
('parens', | |
[(31, 16), (31, 29)], | |
('token', [(31, 17), (31, 18)], '+'), | |
('token', | |
[(31, 19), (31, 24)], | |
'count'), | |
('token', [(31, 25), (31, 26)], 'x'), | |
('token', [(31, 27), (31, 28)], 'y')))), | |
('parens', | |
[(32, 2), (32, 24)], | |
('token', [(32, 3), (32, 9)], 'assert'), | |
('parens', | |
[(32, 10), (32, 23)], | |
('token', [(32, 11), (32, 12)], '='), | |
('token', [(32, 13), (32, 18)], 'count'), | |
('number', [(32, 19), (32, 22)], '150')))), | |
('parens', | |
[(35, 0), (43, 24)], | |
('token', [(35, 1), (35, 5)], 'defn'), | |
('token', | |
[(35, 6), (35, 21)], | |
'test-while-loop'), | |
('list', [(35, 22), (35, 24)]), | |
('string', | |
[(36, 2), (36, 29)], | |
'NATIVE: test while loops?'), | |
('parens', | |
[(37, 2), (37, 16)], | |
('token', [(37, 3), (37, 7)], 'setv'), | |
('token', [(37, 8), (37, 13)], 'count'), | |
('number', [(37, 14), (37, 15)], '5')), | |
('parens', | |
[(38, 2), (38, 15)], | |
('token', [(38, 3), (38, 7)], 'setv'), | |
('token', [(38, 8), (38, 12)], 'fact'), | |
('number', [(38, 13), (38, 14)], '1')), | |
('parens', | |
[(39, 2), (41, 29)], | |
('token', [(39, 3), (39, 8)], 'while'), | |
('parens', | |
[(39, 9), (39, 20)], | |
('token', [(39, 10), (39, 11)], '>'), | |
('token', [(39, 12), (39, 17)], 'count'), | |
('number', [(39, 18), (39, 19)], '0')), | |
('parens', | |
[(40, 4), (40, 30)], | |
('token', [(40, 5), (40, 9)], 'setv'), | |
('token', [(40, 10), (40, 14)], 'fact'), | |
('parens', | |
[(40, 15), (40, 29)], | |
('token', [(40, 16), (40, 17)], '*'), | |
('token', [(40, 18), (40, 22)], 'fact'), | |
('token', | |
[(40, 23), (40, 28)], | |
'count'))), | |
('parens', | |
[(41, 4), (41, 28)], | |
('token', [(41, 5), (41, 9)], 'setv'), | |
('token', [(41, 10), (41, 15)], 'count'), | |
('parens', | |
[(41, 16), (41, 27)], | |
('token', [(41, 17), (41, 18)], '-'), | |
('token', | |
[(41, 19), (41, 24)], | |
'count'), | |
('number', [(41, 25), (41, 26)], '1')))), | |
('parens', | |
[(42, 2), (42, 22)], | |
('token', [(42, 3), (42, 9)], 'assert'), | |
('parens', | |
[(42, 10), (42, 21)], | |
('token', [(42, 11), (42, 12)], '='), | |
('token', [(42, 13), (42, 18)], 'count'), | |
('number', [(42, 19), (42, 20)], '0'))), | |
('parens', | |
[(43, 2), (43, 23)], | |
('token', [(43, 3), (43, 9)], 'assert'), | |
('parens', | |
[(43, 10), (43, 22)], | |
('token', [(43, 11), (43, 12)], '='), | |
('token', [(43, 13), (43, 17)], 'fact'), | |
('number', [(43, 18), (43, 21)], '120')))), | |
('parens', | |
[(46, 0), (50, 31)], | |
('token', [(46, 1), (46, 5)], 'defn'), | |
('token', [(46, 6), (46, 14)], 'test-not'), | |
('list', [(46, 15), (46, 17)]), | |
('string', | |
[(47, 2), (47, 20)], | |
'NATIVE: test not'), | |
('parens', | |
[(48, 2), (48, 24)], | |
('token', [(48, 3), (48, 9)], 'assert'), | |
('parens', | |
[(48, 10), (48, 23)], | |
('token', [(48, 11), (48, 14)], 'not'), | |
('parens', | |
[(48, 15), (48, 22)], | |
('token', [(48, 16), (48, 17)], '='), | |
('number', [(48, 18), (48, 19)], '1'), | |
('number', [(48, 20), (48, 21)], '2')))), | |
('parens', | |
[(49, 2), (49, 31)], | |
('token', [(49, 3), (49, 9)], 'assert'), | |
('parens', | |
[(49, 10), (49, 30)], | |
('token', [(49, 11), (49, 12)], '='), | |
('token', [(49, 13), (49, 17)], 'true'), | |
('parens', | |
[(49, 18), (49, 29)], | |
('token', [(49, 19), (49, 22)], 'not'), | |
('token', | |
[(49, 23), (49, 28)], | |
'false')))), | |
('parens', | |
[(50, 2), (50, 29)], | |
('token', [(50, 3), (50, 9)], 'assert'), | |
('parens', | |
[(50, 10), (50, 28)], | |
('token', [(50, 11), (50, 12)], '='), | |
('token', [(50, 13), (50, 18)], 'false'), | |
('parens', | |
[(50, 19), (50, 27)], | |
('token', [(50, 20), (50, 23)], 'not'), | |
('number', [(50, 24), (50, 26)], '42'))))), | |
('parens', | |
[(53, 0), (56, 24)], | |
('token', [(53, 1), (53, 5)], 'defn'), | |
('token', [(53, 6), (53, 14)], 'test-inv'), | |
('list', [(53, 15), (53, 17)]), | |
('string', | |
[(54, 2), (54, 20)], | |
'NATIVE: test inv'), | |
('parens', | |
[(55, 2), (55, 23)], | |
('token', [(55, 3), (55, 9)], 'assert'), | |
('parens', | |
[(55, 10), (55, 22)], | |
('token', [(55, 11), (55, 12)], '='), | |
('parens', | |
[(55, 13), (55, 18)], | |
('token', [(55, 14), (55, 15)], '~'), | |
('number', [(55, 16), (55, 17)], '1')), | |
('token', [(55, 19), (55, 21)], '-2'))), | |
('parens', | |
[(56, 2), (56, 23)], | |
('token', [(56, 3), (56, 9)], 'assert'), | |
('parens', | |
[(56, 10), (56, 22)], | |
('token', [(56, 11), (56, 12)], '='), | |
('parens', | |
[(56, 13), (56, 19)], | |
('token', [(56, 14), (56, 15)], '~'), | |
('token', [(56, 16), (56, 18)], '-2')), | |
('number', [(56, 20), (56, 21)], '1')))), | |
('parens', | |
[(59, 0), (62, 42)], | |
('token', [(59, 1), (59, 5)], 'defn'), | |
('token', [(59, 6), (59, 13)], 'test-in'), | |
('list', [(59, 14), (59, 16)]), | |
('string', | |
[(60, 2), (60, 19)], | |
'NATIVE: test in'), | |
('parens', | |
[(61, 2), (61, 37)], | |
('token', [(61, 3), (61, 9)], 'assert'), | |
('parens', | |
[(61, 10), (61, 36)], | |
('token', [(61, 11), (61, 13)], 'in'), | |
('string', [(61, 14), (61, 17)], 'a'), | |
('list', | |
[(61, 18), (61, 35)], | |
('string', [(61, 19), (61, 22)], 'a'), | |
('string', [(61, 23), (61, 26)], 'b'), | |
('string', [(61, 27), (61, 30)], 'c'), | |
('string', [(61, 31), (61, 34)], 'd')))), | |
('parens', | |
[(62, 2), (62, 41)], | |
('token', [(62, 3), (62, 9)], 'assert'), | |
('parens', | |
[(62, 10), (62, 40)], | |
('token', [(62, 11), (62, 17)], 'not-in'), | |
('string', [(62, 18), (62, 21)], 'f'), | |
('list', | |
[(62, 22), (62, 39)], | |
('string', [(62, 23), (62, 26)], 'a'), | |
('string', [(62, 27), (62, 30)], 'b'), | |
('string', [(62, 31), (62, 34)], 'c'), | |
('string', [(62, 35), (62, 38)], 'd'))))), | |
('parens', | |
[(65, 0), (67, 20)], | |
('token', [(65, 1), (65, 5)], 'defn'), | |
('token', [(65, 6), (65, 16)], 'test-noteq'), | |
('list', [(65, 17), (65, 19)]), | |
('string', | |
[(66, 2), (66, 18)], | |
'NATIVE: not eq'), | |
('parens', | |
[(67, 2), (67, 19)], | |
('token', [(67, 3), (67, 9)], 'assert'), | |
('parens', | |
[(67, 10), (67, 18)], | |
('token', [(67, 11), (67, 13)], '!='), | |
('number', [(67, 14), (67, 15)], '2'), | |
('number', [(67, 16), (67, 17)], '3')))), | |
('parens', | |
[(70, 0), (75, 25)], | |
('token', [(70, 1), (70, 5)], 'defn'), | |
('token', [(70, 6), (70, 17)], 'test-numops'), | |
('list', [(70, 18), (70, 20)]), | |
('string', | |
[(71, 2), (71, 23)], | |
'NATIVE: test numpos'), | |
('parens', | |
[(72, 2), (72, 24)], | |
('token', [(72, 3), (72, 9)], 'assert'), | |
('parens', | |
[(72, 10), (72, 23)], | |
('token', [(72, 11), (72, 12)], '>'), | |
('number', [(72, 13), (72, 14)], '5'), | |
('number', [(72, 15), (72, 16)], '4'), | |
('number', [(72, 17), (72, 18)], '3'), | |
('number', [(72, 19), (72, 20)], '2'), | |
('number', [(72, 21), (72, 22)], '1'))), | |
('parens', | |
[(73, 2), (73, 24)], | |
('token', [(73, 3), (73, 9)], 'assert'), | |
('parens', | |
[(73, 10), (73, 23)], | |
('token', [(73, 11), (73, 12)], '<'), | |
('number', [(73, 13), (73, 14)], '1'), | |
('number', [(73, 15), (73, 16)], '2'), | |
('number', [(73, 17), (73, 18)], '3'), | |
('number', [(73, 19), (73, 20)], '4'), | |
('number', [(73, 21), (73, 22)], '5'))), | |
('parens', | |
[(74, 2), (74, 24)], | |
('token', [(74, 3), (74, 9)], 'assert'), | |
('parens', | |
[(74, 10), (74, 23)], | |
('token', [(74, 11), (74, 13)], '<='), | |
('number', [(74, 14), (74, 15)], '5'), | |
('number', [(74, 16), (74, 17)], '5'), | |
('number', [(74, 18), (74, 19)], '5'), | |
('number', [(74, 20), (74, 21)], '5'))), | |
('parens', | |
[(75, 2), (75, 24)], | |
('token', [(75, 3), (75, 9)], 'assert'), | |
('parens', | |
[(75, 10), (75, 23)], | |
('token', [(75, 11), (75, 13)], '>='), | |
('number', [(75, 14), (75, 15)], '5'), | |
('number', [(75, 16), (75, 17)], '5'), | |
('number', [(75, 18), (75, 19)], '5'), | |
('number', [(75, 20), (75, 21)], '5')))), | |
('parens', | |
[(78, 0), (82, 26)], | |
('token', [(78, 1), (78, 5)], 'defn'), | |
('token', [(78, 6), (78, 13)], 'test-is'), | |
('list', [(78, 14), (78, 16)]), | |
('string', | |
[(79, 2), (79, 38)], | |
'NATIVE: test is can deal with None'), | |
('parens', | |
[(80, 2), (80, 15)], | |
('token', [(80, 3), (80, 7)], 'setv'), | |
('token', [(80, 8), (80, 9)], 'a'), | |
('token', [(80, 10), (80, 14)], 'null')), | |
('parens', | |
[(81, 2), (81, 22)], | |
('token', [(81, 3), (81, 9)], 'assert'), | |
('parens', | |
[(81, 10), (81, 21)], | |
('token', [(81, 11), (81, 13)], 'is'), | |
('token', [(81, 14), (81, 15)], 'a'), | |
('token', [(81, 16), (81, 20)], 'null'))), | |
('parens', | |
[(82, 2), (82, 25)], | |
('token', [(82, 3), (82, 9)], 'assert'), | |
('parens', | |
[(82, 10), (82, 24)], | |
('token', [(82, 11), (82, 17)], 'is-not'), | |
('token', [(82, 18), (82, 19)], 'a'), | |
('string', [(82, 20), (82, 23)], 'b')))), | |
('parens', | |
[(85, 0), (89, 22)], | |
('token', [(85, 1), (85, 5)], 'defn'), | |
('token', | |
[(85, 6), (85, 20)], | |
'test-branching'), | |
('list', [(85, 21), (85, 23)]), | |
('string', | |
[(86, 2), (86, 29)], | |
'NATIVE: test if branching'), | |
('parens', | |
[(87, 2), (89, 21)], | |
('token', [(87, 3), (87, 5)], 'if'), | |
('token', [(87, 6), (87, 10)], 'true'), | |
('parens', | |
[(88, 4), (88, 20)], | |
('token', [(88, 5), (88, 11)], 'assert'), | |
('parens', | |
[(88, 12), (88, 19)], | |
('token', [(88, 13), (88, 14)], '='), | |
('number', [(88, 15), (88, 16)], '1'), | |
('number', [(88, 17), (88, 18)], '1'))), | |
('parens', | |
[(89, 4), (89, 20)], | |
('token', [(89, 5), (89, 11)], 'assert'), | |
('parens', | |
[(89, 12), (89, 19)], | |
('token', [(89, 13), (89, 14)], '='), | |
('number', [(89, 15), (89, 16)], '2'), | |
('number', [(89, 17), (89, 18)], '1'))))), | |
('parens', | |
[(92, 0), (99, 25)], | |
('token', [(92, 1), (92, 5)], 'defn'), | |
('token', | |
[(92, 6), (92, 28)], | |
'test-branching-with-do'), | |
('list', [(92, 29), (92, 31)]), | |
('string', | |
[(93, 2), (93, 41)], | |
'NATIVE: test if branching (multiline)'), | |
('parens', | |
[(94, 2), (99, 24)], | |
('token', [(94, 3), (94, 5)], 'if'), | |
('token', [(94, 6), (94, 11)], 'false'), | |
('parens', | |
[(95, 4), (95, 20)], | |
('token', [(95, 5), (95, 11)], 'assert'), | |
('parens', | |
[(95, 12), (95, 19)], | |
('token', [(95, 13), (95, 14)], '='), | |
('number', [(95, 15), (95, 16)], '2'), | |
('number', [(95, 17), (95, 18)], '1'))), | |
('parens', | |
[(96, 4), (99, 23)], | |
('token', [(96, 5), (96, 7)], 'do'), | |
('parens', | |
[(97, 6), (97, 22)], | |
('token', | |
[(97, 7), (97, 13)], | |
'assert'), | |
('parens', | |
[(97, 14), (97, 21)], | |
('token', [(97, 15), (97, 16)], '='), | |
('number', [(97, 17), (97, 18)], '1'), | |
('number', [(97, 19), (97, 20)], '1'))), | |
('parens', | |
[(98, 6), (98, 22)], | |
('token', | |
[(98, 7), (98, 13)], | |
'assert'), | |
('parens', | |
[(98, 14), (98, 21)], | |
('token', [(98, 15), (98, 16)], '='), | |
('number', [(98, 17), (98, 18)], '1'), | |
('number', [(98, 19), (98, 20)], '1'))), | |
('parens', | |
[(99, 6), (99, 22)], | |
('token', | |
[(99, 7), (99, 13)], | |
'assert'), | |
('parens', | |
[(99, 14), (99, 21)], | |
('token', [(99, 15), (99, 16)], '='), | |
('number', [(99, 17), (99, 18)], '1'), | |
('number', [(99, 19), (99, 20)], '1')))))), | |
('parens', | |
[(101, 0), (110, 25)], | |
('token', [(101, 1), (101, 5)], 'defn'), | |
('token', | |
[(101, 6), (101, 39)], | |
'test-branching-expr-count-with-do'), | |
('list', [(101, 40), (101, 42)]), | |
('string', | |
[(102, 2), (102, 78)], | |
'NATIVE: make sure we execute the right number of expressions in the branch'), | |
('parens', | |
[(103, 2), (103, 18)], | |
('token', [(103, 3), (103, 7)], 'setv'), | |
('token', [(103, 8), (103, 15)], 'counter'), | |
('number', [(103, 16), (103, 17)], '0')), | |
('parens', | |
[(104, 2), (109, 36)], | |
('token', [(104, 3), (104, 5)], 'if'), | |
('token', [(104, 6), (104, 11)], 'false'), | |
('parens', | |
[(105, 4), (105, 20)], | |
('token', | |
[(105, 5), (105, 11)], | |
'assert'), | |
('parens', | |
[(105, 12), (105, 19)], | |
('token', [(105, 13), (105, 14)], '='), | |
('number', [(105, 15), (105, 16)], '2'), | |
('number', [(105, 17), (105, 18)], '1'))), | |
('parens', | |
[(106, 4), (109, 35)], | |
('token', [(106, 5), (106, 7)], 'do'), | |
('parens', | |
[(107, 6), (107, 34)], | |
('token', | |
[(107, 7), (107, 11)], | |
'setv'), | |
('token', | |
[(107, 12), (107, 19)], | |
'counter'), | |
('parens', | |
[(107, 20), (107, 33)], | |
('token', | |
[(107, 21), (107, 22)], | |
'+'), | |
('token', | |
[(107, 23), (107, 30)], | |
'counter'), | |
('number', | |
[(107, 31), (107, 32)], | |
'1'))), | |
('parens', | |
[(108, 6), (108, 34)], | |
('token', | |
[(108, 7), (108, 11)], | |
'setv'), | |
('token', | |
[(108, 12), (108, 19)], | |
'counter'), | |
('parens', | |
[(108, 20), (108, 33)], | |
('token', | |
[(108, 21), (108, 22)], | |
'+'), | |
('token', | |
[(108, 23), (108, 30)], | |
'counter'), | |
('number', | |
[(108, 31), (108, 32)], | |
'1'))), | |
('parens', | |
[(109, 6), (109, 34)], | |
('token', | |
[(109, 7), (109, 11)], | |
'setv'), | |
('token', | |
[(109, 12), (109, 19)], | |
'counter'), | |
('parens', | |
[(109, 20), (109, 33)], | |
('token', | |
[(109, 21), (109, 22)], | |
'+'), | |
('token', | |
[(109, 23), (109, 30)], | |
'counter'), | |
('number', | |
[(109, 31), (109, 32)], | |
'1'))))), | |
('parens', | |
[(110, 2), (110, 24)], | |
('token', [(110, 3), (110, 9)], 'assert'), | |
('parens', | |
[(110, 10), (110, 23)], | |
('token', [(110, 11), (110, 12)], '='), | |
('token', | |
[(110, 13), (110, 20)], | |
'counter'), | |
('number', [(110, 21), (110, 22)], '3')))), | |
('parens', | |
[(113, 0), (117, 46)], | |
('token', [(113, 1), (113, 5)], 'defn'), | |
('token', [(113, 6), (113, 15)], 'test-cond'), | |
('list', [(113, 16), (113, 18)]), | |
('string', | |
[(114, 2), (114, 37)], | |
'NATIVE: test if cond sorta works.'), | |
('parens', | |
[(115, 2), (117, 45)], | |
('token', [(115, 3), (115, 7)], 'cond'), | |
('parens', | |
[(116, 4), (116, 38)], | |
('parens', | |
[(116, 5), (116, 12)], | |
('token', [(116, 6), (116, 7)], '='), | |
('number', [(116, 8), (116, 9)], '1'), | |
('number', [(116, 10), (116, 11)], '2')), | |
('parens', | |
[(116, 13), (116, 37)], | |
('token', | |
[(116, 14), (116, 20)], | |
'assert'), | |
('parens', | |
[(116, 21), (116, 36)], | |
('token', | |
[(116, 22), (116, 24)], | |
'is'), | |
('token', | |
[(116, 25), (116, 29)], | |
'true'), | |
('token', | |
[(116, 30), (116, 35)], | |
'false')))), | |
('parens', | |
[(117, 4), (117, 44)], | |
('parens', | |
[(117, 5), (117, 19)], | |
('token', [(117, 6), (117, 8)], 'is'), | |
('token', | |
[(117, 9), (117, 13)], | |
'null'), | |
('token', | |
[(117, 14), (117, 18)], | |
'null')), | |
('parens', | |
[(117, 20), (117, 43)], | |
('token', | |
[(117, 21), (117, 27)], | |
'assert'), | |
('parens', | |
[(117, 28), (117, 42)], | |
('token', | |
[(117, 29), (117, 31)], | |
'is'), | |
('token', | |
[(117, 32), (117, 36)], | |
'true'), | |
('token', | |
[(117, 37), (117, 41)], | |
'true')))))), | |
('parens', | |
[(120, 0), (123, 37)], | |
('token', [(120, 1), (120, 5)], 'defn'), | |
('token', | |
[(120, 6), (120, 16)], | |
'test-index'), | |
('list', [(120, 17), (120, 19)]), | |
('string', | |
[(121, 2), (121, 39)], | |
'NATIVE: Test that dict access works'), | |
('parens', | |
[(122, 2), (122, 42)], | |
('token', [(122, 3), (122, 9)], 'assert'), | |
('parens', | |
[(122, 10), (122, 35)], | |
('token', [(122, 11), (122, 14)], 'get'), | |
('dict', | |
[(122, 15), (122, 28)], | |
('string', | |
[(122, 16), (122, 21)], | |
'one'), | |
('string', | |
[(122, 22), (122, 27)], | |
'two')), | |
('string', [(122, 29), (122, 34)], 'one')), | |
('string', [(122, 36), (122, 41)], 'two')), | |
('parens', | |
[(123, 2), (123, 36)], | |
('token', [(123, 3), (123, 9)], 'assert'), | |
('parens', | |
[(123, 10), (123, 35)], | |
('token', [(123, 11), (123, 12)], '='), | |
('parens', | |
[(123, 13), (123, 32)], | |
('token', | |
[(123, 14), (123, 17)], | |
'get'), | |
('list', | |
[(123, 18), (123, 29)], | |
('number', | |
[(123, 19), (123, 20)], | |
'1'), | |
('number', | |
[(123, 21), (123, 22)], | |
'2'), | |
('number', | |
[(123, 23), (123, 24)], | |
'3'), | |
('number', | |
[(123, 25), (123, 26)], | |
'4'), | |
('number', | |
[(123, 27), (123, 28)], | |
'5')), | |
('number', [(123, 30), (123, 31)], '1')), | |
('number', [(123, 33), (123, 34)], '2')))), | |
('parens', | |
[(126, 0), (129, 28)], | |
('token', [(126, 1), (126, 5)], 'defn'), | |
('token', | |
[(126, 6), (126, 17)], | |
'test-lambda'), | |
('list', [(126, 18), (126, 20)]), | |
('string', | |
[(127, 2), (127, 32)], | |
'NATIVE: test lambda operator'), | |
('parens', | |
[(128, 2), (128, 36)], | |
('token', [(128, 3), (128, 7)], 'setv'), | |
('token', [(128, 8), (128, 14)], 'square'), | |
('parens', | |
[(128, 15), (128, 35)], | |
('token', | |
[(128, 16), (128, 22)], | |
'lambda'), | |
('list', | |
[(128, 23), (128, 26)], | |
('token', [(128, 24), (128, 25)], 'x')), | |
('parens', | |
[(128, 27), (128, 34)], | |
('token', [(128, 28), (128, 29)], '*'), | |
('token', [(128, 30), (128, 31)], 'x'), | |
('token', [(128, 32), (128, 33)], 'x')))), | |
('parens', | |
[(129, 2), (129, 27)], | |
('token', [(129, 3), (129, 9)], 'assert'), | |
('parens', | |
[(129, 10), (129, 26)], | |
('token', [(129, 11), (129, 12)], '='), | |
('number', [(129, 13), (129, 14)], '4'), | |
('parens', | |
[(129, 15), (129, 25)], | |
('token', | |
[(129, 16), (129, 22)], | |
'square'), | |
('number', [(129, 23), (129, 24)], '2'))))), | |
('parens', | |
[(132, 0), (136, 35)], | |
('token', [(132, 1), (132, 5)], 'defn'), | |
('token', | |
[(132, 6), (132, 24)], | |
'test-imported-bits'), | |
('list', [(132, 25), (132, 27)]), | |
('string', | |
[(133, 2), (133, 33)], | |
'NATIVE: test the imports work'), | |
('parens', | |
[(134, 2), (134, 33)], | |
('token', [(134, 3), (134, 9)], 'assert'), | |
('parens', | |
[(134, 10), (134, 32)], | |
('token', [(134, 11), (134, 13)], 'is'), | |
('parens', | |
[(134, 14), (134, 26)], | |
('token', | |
[(134, 15), (134, 21)], | |
'exists'), | |
('string', [(134, 22), (134, 25)], '.')), | |
('token', [(134, 27), (134, 31)], 'true'))), | |
('parens', | |
[(135, 2), (135, 32)], | |
('token', [(135, 3), (135, 9)], 'assert'), | |
('parens', | |
[(135, 10), (135, 31)], | |
('token', [(135, 11), (135, 13)], 'is'), | |
('parens', | |
[(135, 14), (135, 25)], | |
('token', | |
[(135, 15), (135, 20)], | |
'isdir'), | |
('string', [(135, 21), (135, 24)], '.')), | |
('token', [(135, 26), (135, 30)], 'true'))), | |
('parens', | |
[(136, 2), (136, 34)], | |
('token', [(136, 3), (136, 9)], 'assert'), | |
('parens', | |
[(136, 10), (136, 33)], | |
('token', [(136, 11), (136, 13)], 'is'), | |
('parens', | |
[(136, 14), (136, 26)], | |
('token', | |
[(136, 15), (136, 21)], | |
'isfile'), | |
('string', [(136, 22), (136, 25)], '.')), | |
('token', | |
[(136, 27), (136, 32)], | |
'false')))), | |
('parens', | |
[(139, 0), (140, 22)], | |
('token', [(139, 1), (139, 5)], 'defn'), | |
('token', [(139, 6), (139, 12)], 'foodec'), | |
('list', | |
[(139, 13), (139, 19)], | |
('token', [(139, 14), (139, 18)], 'func')), | |
('parens', | |
[(140, 2), (140, 21)], | |
('token', [(140, 3), (140, 9)], 'lambda'), | |
('list', [(140, 10), (140, 12)]), | |
('parens', | |
[(140, 13), (140, 20)], | |
('token', [(140, 14), (140, 15)], '+'), | |
('number', [(140, 16), (140, 17)], '1'), | |
('number', [(140, 18), (140, 19)], '1')))), | |
('parens', | |
[(143, 0), (145, 13)], | |
('token', | |
[(143, 1), (143, 14)], | |
'decorate-with'), | |
('token', [(143, 15), (143, 21)], 'foodec'), | |
('parens', | |
[(144, 2), (145, 12)], | |
('token', [(144, 3), (144, 7)], 'defn'), | |
('token', | |
[(144, 8), (144, 17)], | |
'tfunction'), | |
('list', [(144, 18), (144, 20)]), | |
('parens', | |
[(145, 4), (145, 11)], | |
('token', [(145, 5), (145, 6)], '*'), | |
('number', [(145, 7), (145, 8)], '2'), | |
('number', [(145, 9), (145, 10)], '2')))), | |
('parens', | |
[(148, 0), (150, 29)], | |
('token', [(148, 1), (148, 5)], 'defn'), | |
('token', | |
[(148, 6), (148, 21)], | |
'test-decorators'), | |
('list', [(148, 22), (148, 24)]), | |
('string', | |
[(149, 2), (149, 28)], | |
'NATIVE: test decorators.'), | |
('parens', | |
[(150, 2), (150, 28)], | |
('token', [(150, 3), (150, 9)], 'assert'), | |
('parens', | |
[(150, 10), (150, 27)], | |
('token', [(150, 11), (150, 12)], '='), | |
('parens', | |
[(150, 13), (150, 24)], | |
('token', | |
[(150, 14), (150, 23)], | |
'tfunction')), | |
('number', [(150, 25), (150, 26)], '2')))), | |
('parens', | |
[(153, 0), (155, 62)], | |
('token', [(153, 1), (153, 5)], 'defn'), | |
('token', | |
[(153, 6), (153, 17)], | |
'test-kwargs'), | |
('list', [(153, 18), (153, 20)]), | |
('string', | |
[(154, 2), (154, 31)], | |
'NATIVE: test kwargs things.'), | |
('parens', | |
[(155, 2), (155, 61)], | |
('token', [(155, 3), (155, 9)], 'assert'), | |
('parens', | |
[(155, 10), (155, 60)], | |
('token', [(155, 11), (155, 12)], '='), | |
('parens', | |
[(155, 13), (155, 45)], | |
('token', | |
[(155, 14), (155, 21)], | |
'kwapply'), | |
('parens', | |
[(155, 22), (155, 30)], | |
('token', | |
[(155, 23), (155, 29)], | |
'kwtest')), | |
('dict', | |
[(155, 31), (155, 44)], | |
('string', | |
[(155, 32), (155, 37)], | |
'one'), | |
('string', | |
[(155, 38), (155, 43)], | |
'two'))), | |
('dict', | |
[(155, 46), (155, 59)], | |
('string', | |
[(155, 47), (155, 52)], | |
'one'), | |
('string', | |
[(155, 53), (155, 58)], | |
'two'))))), | |
('parens', | |
[(158, 0), (160, 51)], | |
('token', [(158, 1), (158, 5)], 'defn'), | |
('token', | |
[(158, 6), (158, 17)], | |
'test-dotted'), | |
('list', [(158, 18), (158, 20)]), | |
('string', | |
[(159, 2), (159, 34)], | |
'NATIVE: test dotted invocation'), | |
('parens', | |
[(160, 2), (160, 50)], | |
('token', [(160, 3), (160, 9)], 'assert'), | |
('parens', | |
[(160, 10), (160, 49)], | |
('token', [(160, 11), (160, 12)], '='), | |
('parens', | |
[(160, 13), (160, 38)], | |
('token', | |
[(160, 14), (160, 19)], | |
'.join'), | |
('string', [(160, 20), (160, 23)], ' '), | |
('list', | |
[(160, 24), (160, 37)], | |
('string', | |
[(160, 25), (160, 30)], | |
'one'), | |
('string', | |
[(160, 31), (160, 36)], | |
'two'))), | |
('string', | |
[(160, 39), (160, 48)], | |
'one two')))), | |
('parens', | |
[(163, 0), (168, 47)], | |
('token', [(163, 1), (163, 5)], 'defn'), | |
('token', | |
[(163, 6), (163, 21)], | |
'test-exceptions'), | |
('list', [(163, 22), (163, 24)]), | |
('string', | |
[(164, 2), (164, 27)], | |
'NATIVE: test Exceptions'), | |
('parens', | |
[(165, 2), (168, 46)], | |
('token', [(165, 3), (165, 6)], 'try'), | |
('parens', | |
[(166, 4), (166, 22)], | |
('token', [(166, 5), (166, 10)], 'throw'), | |
('parens', | |
[(166, 11), (166, 21)], | |
('token', | |
[(166, 12), (166, 20)], | |
'KeyError'))), | |
('parens', | |
[(167, 2), (167, 37)], | |
('token', [(167, 3), (167, 8)], 'catch'), | |
('token', | |
[(167, 9), (167, 16)], | |
'IOError'), | |
('token', [(167, 18), (167, 19)], 'e'), | |
('parens', | |
[(167, 20), (167, 36)], | |
('token', | |
[(167, 21), (167, 27)], | |
'assert'), | |
('parens', | |
[(167, 28), (167, 35)], | |
('token', | |
[(167, 29), (167, 30)], | |
'='), | |
('number', | |
[(167, 31), (167, 32)], | |
'2'), | |
('number', | |
[(167, 33), (167, 34)], | |
'1')))), | |
('parens', | |
[(168, 2), (168, 45)], | |
('token', [(168, 3), (168, 8)], 'catch'), | |
('token', | |
[(168, 9), (168, 17)], | |
'KeyError'), | |
('token', [(168, 18), (168, 19)], 'e'), | |
('parens', | |
[(168, 20), (168, 27)], | |
('token', [(168, 21), (168, 22)], '+'), | |
('number', [(168, 23), (168, 24)], '1'), | |
('number', [(168, 25), (168, 26)], '1')), | |
('parens', | |
[(168, 28), (168, 44)], | |
('token', | |
[(168, 29), (168, 35)], | |
'assert'), | |
('parens', | |
[(168, 36), (168, 43)], | |
('token', | |
[(168, 37), (168, 38)], | |
'='), | |
('number', | |
[(168, 39), (168, 40)], | |
'1'), | |
('number', | |
[(168, 41), (168, 42)], | |
'1')))))), | |
('parens', | |
[(170, 0), (175, 26)], | |
('token', [(170, 1), (170, 5)], 'defn'), | |
('token', | |
[(170, 6), (170, 19)], | |
'test-earmuffs'), | |
('list', [(170, 20), (170, 22)]), | |
('string', | |
[(171, 2), (171, 25)], | |
'NATIVE: Test earmuffs'), | |
('parens', | |
[(172, 2), (172, 18)], | |
('token', [(172, 3), (172, 7)], 'setv'), | |
('starred_token', | |
[(172, 8), (172, 13)], | |
[(172, 9), (172, 12)]), | |
('string', [(172, 14), (172, 17)], '2')), | |
('parens', | |
[(173, 2), (173, 16)], | |
('token', [(173, 3), (173, 7)], 'setv'), | |
('token', [(173, 8), (173, 11)], 'foo'), | |
('string', [(173, 12), (173, 15)], '3')), | |
('parens', | |
[(174, 2), (174, 24)], | |
('token', [(174, 3), (174, 9)], 'assert'), | |
('parens', | |
[(174, 10), (174, 23)], | |
('token', [(174, 11), (174, 12)], '='), | |
('starred_token', | |
[(174, 13), (174, 18)], | |
[(174, 14), (174, 17)]), | |
('token', [(174, 19), (174, 22)], 'FOO'))), | |
('parens', | |
[(175, 2), (175, 25)], | |
('token', [(175, 3), (175, 9)], 'assert'), | |
('parens', | |
[(175, 10), (175, 24)], | |
('token', [(175, 11), (175, 13)], '!='), | |
('starred_token', | |
[(175, 14), (175, 19)], | |
[(175, 15), (175, 18)]), | |
('token', [(175, 20), (175, 23)], 'foo')))), | |
('parens', | |
[(178, 0), (181, 33)], | |
('token', [(178, 1), (178, 5)], 'defn'), | |
('token', | |
[(178, 6), (178, 20)], | |
'test-threading'), | |
('list', [(178, 21), (178, 23)]), | |
('string', | |
[(179, 2), (179, 32)], | |
'NATIVE: test threading macro'), | |
('parens', | |
[(180, 2), (181, 32)], | |
('token', [(180, 3), (180, 9)], 'assert'), | |
('parens', | |
[(180, 10), (181, 31)], | |
('token', [(180, 11), (180, 12)], '='), | |
('parens', | |
[(180, 13), (180, 64)], | |
('token', [(180, 14), (180, 16)], '->'), | |
('parens', | |
[(180, 17), (180, 35)], | |
('token', | |
[(180, 18), (180, 24)], | |
'.upper'), | |
('string', | |
[(180, 25), (180, 34)], | |
'a b c d')), | |
('parens', | |
[(180, 36), (180, 54)], | |
('token', | |
[(180, 37), (180, 45)], | |
'.replace'), | |
('string', | |
[(180, 46), (180, 49)], | |
'A'), | |
('string', | |
[(180, 50), (180, 53)], | |
'X')), | |
('parens', | |
[(180, 55), (180, 63)], | |
('token', | |
[(180, 56), (180, 62)], | |
'.split'))), | |
('list', | |
[(181, 13), (181, 30)], | |
('string', [(181, 14), (181, 17)], 'X'), | |
('string', [(181, 18), (181, 21)], 'B'), | |
('string', [(181, 22), (181, 25)], 'C'), | |
('string', [(181, 26), (181, 29)], 'D'))))), | |
('parens', | |
[(184, 0), (187, 33)], | |
('token', [(184, 1), (184, 5)], 'defn'), | |
('token', | |
[(184, 6), (184, 24)], | |
'test-threading-two'), | |
('list', [(184, 25), (184, 27)]), | |
('string', | |
[(185, 2), (185, 32)], | |
'NATIVE: test threading macro'), | |
('parens', | |
[(186, 2), (187, 32)], | |
('token', [(186, 3), (186, 9)], 'assert'), | |
('parens', | |
[(186, 10), (187, 31)], | |
('token', [(186, 11), (186, 12)], '='), | |
('parens', | |
[(186, 13), (186, 60)], | |
('token', [(186, 14), (186, 16)], '->'), | |
('string', | |
[(186, 17), (186, 26)], | |
'a b c d'), | |
('token', | |
[(186, 27), (186, 33)], | |
'.upper'), | |
('parens', | |
[(186, 34), (186, 52)], | |
('token', | |
[(186, 35), (186, 43)], | |
'.replace'), | |
('string', | |
[(186, 44), (186, 47)], | |
'A'), | |
('string', | |
[(186, 48), (186, 51)], | |
'X')), | |
('token', | |
[(186, 53), (186, 59)], | |
'.split')), | |
('list', | |
[(187, 13), (187, 30)], | |
('string', [(187, 14), (187, 17)], 'X'), | |
('string', [(187, 18), (187, 21)], 'B'), | |
('string', [(187, 22), (187, 25)], 'C'), | |
('string', [(187, 26), (187, 29)], 'D'))))), | |
('parens', | |
[(190, 0), (194, 40)], | |
('token', [(190, 1), (190, 5)], 'defn'), | |
('token', | |
[(190, 6), (190, 16)], | |
'test-assoc'), | |
('list', [(190, 17), (190, 19)]), | |
('string', | |
[(191, 2), (191, 22)], | |
'NATIVE: test assoc'), | |
('parens', | |
[(192, 2), (192, 27)], | |
('token', [(192, 3), (192, 7)], 'setv'), | |
('token', [(192, 8), (192, 12)], 'vals'), | |
('dict', | |
[(192, 13), (192, 26)], | |
('string', [(192, 14), (192, 19)], 'one'), | |
('string', [(192, 20), (192, 25)], 'two'))), | |
('parens', | |
[(193, 2), (193, 28)], | |
('token', [(193, 3), (193, 8)], 'assoc'), | |
('token', [(193, 9), (193, 13)], 'vals'), | |
('string', [(193, 14), (193, 19)], 'two'), | |
('string', [(193, 20), (193, 27)], 'three')), | |
('parens', | |
[(194, 2), (194, 39)], | |
('token', [(194, 3), (194, 9)], 'assert'), | |
('parens', | |
[(194, 10), (194, 38)], | |
('token', [(194, 11), (194, 12)], '='), | |
('parens', | |
[(194, 13), (194, 29)], | |
('token', | |
[(194, 14), (194, 17)], | |
'get'), | |
('token', | |
[(194, 18), (194, 22)], | |
'vals'), | |
('string', | |
[(194, 23), (194, 28)], | |
'two')), | |
('string', | |
[(194, 30), (194, 37)], | |
'three')))), | |
('parens', | |
[(197, 0), (200, 19)], | |
('token', [(197, 1), (197, 5)], 'defn'), | |
('token', [(197, 6), (197, 15)], 'test-pass'), | |
('list', [(197, 16), (197, 18)]), | |
('string', | |
[(198, 2), (198, 30)], | |
'NATIVE: Test pass worksish'), | |
('parens', | |
[(199, 2), (199, 25)], | |
('token', [(199, 3), (199, 5)], 'if'), | |
('token', [(199, 6), (199, 10)], 'true'), | |
('parens', | |
[(199, 11), (199, 17)], | |
('token', [(199, 12), (199, 16)], 'pass')), | |
('parens', | |
[(199, 18), (199, 24)], | |
('token', [(199, 19), (199, 23)], 'pass'))), | |
('parens', | |
[(200, 2), (200, 18)], | |
('token', [(200, 3), (200, 9)], 'assert'), | |
('parens', | |
[(200, 10), (200, 17)], | |
('token', [(200, 11), (200, 12)], '='), | |
('number', [(200, 13), (200, 14)], '1'), | |
('number', [(200, 15), (200, 16)], '1')))), | |
('parens', | |
[(203, 0), (208, 22)], | |
('token', [(203, 1), (203, 5)], 'defn'), | |
('token', | |
[(203, 6), (203, 16)], | |
'test-yield'), | |
('list', [(203, 17), (203, 19)]), | |
('string', | |
[(204, 2), (204, 25)], | |
'NATIVE: test yielding'), | |
('parens', | |
[(205, 2), (205, 45)], | |
('token', [(205, 3), (205, 7)], 'defn'), | |
('token', [(205, 8), (205, 11)], 'gen'), | |
('list', [(205, 12), (205, 14)]), | |
('parens', | |
[(205, 15), (205, 44)], | |
('token', [(205, 16), (205, 19)], 'for'), | |
('list', | |
[(205, 20), (205, 33)], | |
('token', [(205, 21), (205, 22)], 'x'), | |
('list', | |
[(205, 23), (205, 32)], | |
('number', | |
[(205, 24), (205, 25)], | |
'1'), | |
('number', | |
[(205, 26), (205, 27)], | |
'2'), | |
('number', | |
[(205, 28), (205, 29)], | |
'3'), | |
('number', | |
[(205, 30), (205, 31)], | |
'4'))), | |
('parens', | |
[(205, 34), (205, 43)], | |
('token', | |
[(205, 35), (205, 40)], | |
'yield'), | |
('token', [(205, 41), (205, 42)], 'x')))), | |
('parens', | |
[(206, 2), (206, 14)], | |
('token', [(206, 3), (206, 7)], 'setv'), | |
('token', [(206, 8), (206, 11)], 'ret'), | |
('number', [(206, 12), (206, 13)], '0')), | |
('parens', | |
[(207, 2), (207, 38)], | |
('token', [(207, 3), (207, 6)], 'for'), | |
('list', | |
[(207, 7), (207, 16)], | |
('token', [(207, 8), (207, 9)], 'y'), | |
('parens', | |
[(207, 10), (207, 15)], | |
('token', | |
[(207, 11), (207, 14)], | |
'gen'))), | |
('parens', | |
[(207, 17), (207, 37)], | |
('token', [(207, 18), (207, 22)], 'setv'), | |
('token', [(207, 23), (207, 26)], 'ret'), | |
('parens', | |
[(207, 27), (207, 36)], | |
('token', [(207, 28), (207, 29)], '+'), | |
('token', | |
[(207, 30), (207, 33)], | |
'ret'), | |
('token', [(207, 34), (207, 35)], 'y')))), | |
('parens', | |
[(208, 2), (208, 21)], | |
('token', [(208, 3), (208, 9)], 'assert'), | |
('parens', | |
[(208, 10), (208, 20)], | |
('token', [(208, 11), (208, 12)], '='), | |
('token', [(208, 13), (208, 16)], 'ret'), | |
('number', [(208, 17), (208, 19)], '10')))), | |
('parens', | |
[(211, 0), (214, 35)], | |
('token', [(211, 1), (211, 5)], 'defn'), | |
('token', | |
[(211, 6), (211, 16)], | |
'test-first'), | |
('list', [(211, 17), (211, 19)]), | |
('string', | |
[(212, 2), (212, 30)], | |
'NATIVE: test firsty things'), | |
('parens', | |
[(213, 2), (213, 36)], | |
('token', [(213, 3), (213, 9)], 'assert'), | |
('parens', | |
[(213, 10), (213, 35)], | |
('token', [(213, 11), (213, 12)], '='), | |
('parens', | |
[(213, 13), (213, 32)], | |
('token', | |
[(213, 14), (213, 19)], | |
'first'), | |
('list', | |
[(213, 20), (213, 31)], | |
('number', | |
[(213, 21), (213, 22)], | |
'1'), | |
('number', | |
[(213, 23), (213, 24)], | |
'2'), | |
('number', | |
[(213, 25), (213, 26)], | |
'3'), | |
('number', | |
[(213, 27), (213, 28)], | |
'4'), | |
('number', | |
[(213, 29), (213, 30)], | |
'5'))), | |
('number', [(213, 33), (213, 34)], '1'))), | |
('parens', | |
[(214, 2), (214, 34)], | |
('token', [(214, 3), (214, 9)], 'assert'), | |
('parens', | |
[(214, 10), (214, 33)], | |
('token', [(214, 11), (214, 12)], '='), | |
('parens', | |
[(214, 13), (214, 30)], | |
('token', | |
[(214, 14), (214, 17)], | |
'car'), | |
('list', | |
[(214, 18), (214, 29)], | |
('number', | |
[(214, 19), (214, 20)], | |
'1'), | |
('number', | |
[(214, 21), (214, 22)], | |
'2'), | |
('number', | |
[(214, 23), (214, 24)], | |
'3'), | |
('number', | |
[(214, 25), (214, 26)], | |
'4'), | |
('number', | |
[(214, 27), (214, 28)], | |
'5'))), | |
('number', [(214, 31), (214, 32)], '1')))), | |
('parens', | |
[(217, 0), (221, 47)], | |
('token', [(217, 1), (217, 5)], 'defn'), | |
('token', | |
[(217, 6), (217, 16)], | |
'test-slice'), | |
('list', [(217, 17), (217, 19)]), | |
('string', | |
[(218, 2), (218, 22)], | |
'NATIVE: test slice'), | |
('parens', | |
[(219, 2), (219, 46)], | |
('token', [(219, 3), (219, 9)], 'assert'), | |
('parens', | |
[(219, 10), (219, 45)], | |
('token', [(219, 11), (219, 12)], '='), | |
('parens', | |
[(219, 13), (219, 34)], | |
('token', | |
[(219, 14), (219, 19)], | |
'slice'), | |
('list', | |
[(219, 20), (219, 31)], | |
('number', | |
[(219, 21), (219, 22)], | |
'1'), | |
('number', | |
[(219, 23), (219, 24)], | |
'2'), | |
('number', | |
[(219, 25), (219, 26)], | |
'3'), | |
('number', | |
[(219, 27), (219, 28)], | |
'4'), | |
('number', | |
[(219, 29), (219, 30)], | |
'5')), | |
('number', [(219, 32), (219, 33)], '1')), | |
('list', | |
[(219, 35), (219, 44)], | |
('number', [(219, 36), (219, 37)], '2'), | |
('number', [(219, 38), (219, 39)], '3'), | |
('number', [(219, 40), (219, 41)], '4'), | |
('number', [(219, 42), (219, 43)], '5')))), | |
('parens', | |
[(220, 2), (220, 44)], | |
('token', [(220, 3), (220, 9)], 'assert'), | |
('parens', | |
[(220, 10), (220, 43)], | |
('token', [(220, 11), (220, 12)], '='), | |
('parens', | |
[(220, 13), (220, 36)], | |
('token', | |
[(220, 14), (220, 19)], | |
'slice'), | |
('list', | |
[(220, 20), (220, 31)], | |
('number', | |
[(220, 21), (220, 22)], | |
'1'), | |
('number', | |
[(220, 23), (220, 24)], | |
'2'), | |
('number', | |
[(220, 25), (220, 26)], | |
'3'), | |
('number', | |
[(220, 27), (220, 28)], | |
'4'), | |
('number', | |
[(220, 29), (220, 30)], | |
'5')), | |
('number', [(220, 32), (220, 33)], '1'), | |
('number', [(220, 34), (220, 35)], '3')), | |
('list', | |
[(220, 37), (220, 42)], | |
('number', [(220, 38), (220, 39)], '2'), | |
('number', [(220, 40), (220, 41)], '3')))), | |
('parens', | |
[(221, 2), (221, 46)], | |
('token', [(221, 3), (221, 9)], 'assert'), | |
('parens', | |
[(221, 10), (221, 45)], | |
('token', [(221, 11), (221, 12)], '='), | |
('parens', | |
[(221, 13), (221, 32)], | |
('token', | |
[(221, 14), (221, 19)], | |
'slice'), | |
('list', | |
[(221, 20), (221, 31)], | |
('number', | |
[(221, 21), (221, 22)], | |
'1'), | |
('number', | |
[(221, 23), (221, 24)], | |
'2'), | |
('number', | |
[(221, 25), (221, 26)], | |
'3'), | |
('number', | |
[(221, 27), (221, 28)], | |
'4'), | |
('number', | |
[(221, 29), (221, 30)], | |
'5'))), | |
('list', | |
[(221, 33), (221, 44)], | |
('number', [(221, 34), (221, 35)], '1'), | |
('number', [(221, 36), (221, 37)], '2'), | |
('number', [(221, 38), (221, 39)], '3'), | |
('number', [(221, 40), (221, 41)], '4'), | |
('number', [(221, 42), (221, 43)], '5'))))), | |
('parens', | |
[(224, 0), (226, 44)], | |
('token', [(224, 1), (224, 5)], 'defn'), | |
('token', [(224, 6), (224, 15)], 'test-rest'), | |
('list', [(224, 16), (224, 18)]), | |
('string', | |
[(225, 2), (225, 21)], | |
'NATIVE: test rest'), | |
('parens', | |
[(226, 2), (226, 43)], | |
('token', [(226, 3), (226, 9)], 'assert'), | |
('parens', | |
[(226, 10), (226, 42)], | |
('token', [(226, 11), (226, 12)], '='), | |
('parens', | |
[(226, 13), (226, 31)], | |
('token', | |
[(226, 14), (226, 18)], | |
'rest'), | |
('list', | |
[(226, 19), (226, 30)], | |
('number', | |
[(226, 20), (226, 21)], | |
'1'), | |
('number', | |
[(226, 22), (226, 23)], | |
'2'), | |
('number', | |
[(226, 24), (226, 25)], | |
'3'), | |
('number', | |
[(226, 26), (226, 27)], | |
'4'), | |
('number', | |
[(226, 28), (226, 29)], | |
'5'))), | |
('list', | |
[(226, 32), (226, 41)], | |
('number', [(226, 33), (226, 34)], '2'), | |
('number', [(226, 35), (226, 36)], '3'), | |
('number', [(226, 37), (226, 38)], '4'), | |
('number', [(226, 39), (226, 40)], '5'))))), | |
('parens', | |
[(229, 0), (231, 37)], | |
('token', [(229, 1), (229, 5)], 'defn'), | |
('token', | |
[(229, 6), (229, 19)], | |
'test-importas'), | |
('list', [(229, 20), (229, 22)]), | |
('string', | |
[(230, 2), (230, 26)], | |
'NATIVE: test import as'), | |
('parens', | |
[(231, 2), (231, 36)], | |
('token', [(231, 3), (231, 9)], 'assert'), | |
('parens', | |
[(231, 10), (231, 35)], | |
('token', [(231, 11), (231, 13)], '!='), | |
('parens', | |
[(231, 14), (231, 32)], | |
('token', | |
[(231, 15), (231, 18)], | |
'len'), | |
('token', | |
[(231, 19), (231, 31)], | |
'systest.path')), | |
('number', [(231, 33), (231, 34)], '0')))), | |
('parens', | |
[(234, 0), (237, 19)], | |
('token', [(234, 1), (234, 5)], 'defn'), | |
('token', | |
[(234, 6), (234, 18)], | |
'test-context'), | |
('list', [(234, 19), (234, 21)]), | |
('string', | |
[(235, 2), (235, 21)], | |
'NATIVE: test with'), | |
('parens', | |
[(236, 2), (237, 18)], | |
('token', [(236, 3), (236, 10)], 'with-as'), | |
('parens', | |
[(236, 11), (236, 33)], | |
('token', [(236, 12), (236, 16)], 'open'), | |
('string', | |
[(236, 17), (236, 28)], | |
'README.md'), | |
('string', [(236, 29), (236, 32)], 'r')), | |
('token', [(236, 34), (236, 36)], 'fd'), | |
('parens', | |
[(237, 11), (237, 17)], | |
('token', [(237, 12), (237, 16)], 'pass')))), | |
('parens', | |
[(240, 0), (247, 21)], | |
('token', [(240, 1), (240, 5)], 'defn'), | |
('token', | |
[(240, 6), (240, 21)], | |
'test-for-doodle'), | |
('list', [(240, 22), (240, 24)]), | |
('string', | |
[(241, 2), (241, 23)], | |
'NATIVE: test for-do'), | |
('parens', | |
[(242, 2), (242, 69)], | |
('token', [(242, 3), (242, 5)], 'do'), | |
('parens', | |
[(242, 6), (242, 68)], | |
('token', [(242, 7), (242, 9)], 'do'), | |
('parens', | |
[(242, 10), (242, 67)], | |
('token', [(242, 11), (242, 13)], 'do'), | |
('parens', | |
[(242, 14), (242, 66)], | |
('token', | |
[(242, 15), (242, 17)], | |
'do'), | |
('parens', | |
[(242, 18), (242, 65)], | |
('token', | |
[(242, 19), (242, 21)], | |
'do'), | |
('parens', | |
[(242, 22), (242, 64)], | |
('token', | |
[(242, 23), (242, 25)], | |
'do'), | |
('parens', | |
[(242, 26), (242, 63)], | |
('token', | |
[(242, 27), (242, 29)], | |
'do'), | |
('parens', | |
[(242, 30), (242, 62)], | |
('token', | |
[(242, 31), (242, 33)], | |
'do'), | |
('parens', | |
[(242, 34), (242, 61)], | |
('token', | |
[(242, 35), (242, 37)], | |
'do'), | |
('parens', | |
[(242, 38), (242, 60)], | |
('token', | |
[(242, 39), (242, 43)], | |
'setf'), | |
('parens', | |
[(242, 44), (242, 51)], | |
('token', | |
[(242, 45), | |
(242, 46)], | |
','), | |
('token', | |
[(242, 47), | |
(242, 48)], | |
'x'), | |
('token', | |
[(242, 49), | |
(242, 50)], | |
'y')), | |
('parens', | |
[(242, 52), (242, 59)], | |
('token', | |
[(242, 53), | |
(242, 54)], | |
','), | |
('number', | |
[(242, 55), | |
(242, 56)], | |
'0'), | |
('number', | |
[(242, 57), | |
(242, 58)], | |
'0')))))))))))), | |
('parens', | |
[(243, 2), (246, 31)], | |
('token', [(243, 3), (243, 10)], 'foreach'), | |
('list', | |
[(243, 11), (243, 20)], | |
('token', [(243, 12), (243, 13)], '-'), | |
('list', | |
[(243, 14), (243, 19)], | |
('number', [(243, 15), (243, 16)], '1'), | |
('number', [(243, 17), (243, 18)], '2'))), | |
('parens', | |
[(244, 11), (246, 30)], | |
('token', [(244, 12), (244, 14)], 'do'), | |
('parens', | |
[(245, 13), (245, 29)], | |
('token', | |
[(245, 14), (245, 18)], | |
'setf'), | |
('token', [(245, 19), (245, 20)], 'x'), | |
('parens', | |
[(245, 21), (245, 28)], | |
('token', | |
[(245, 22), (245, 23)], | |
'+'), | |
('token', | |
[(245, 24), (245, 25)], | |
'x'), | |
('number', | |
[(245, 26), (245, 27)], | |
'1'))), | |
('parens', | |
[(246, 13), (246, 29)], | |
('token', | |
[(246, 14), (246, 18)], | |
'setf'), | |
('token', [(246, 19), (246, 20)], 'y'), | |
('parens', | |
[(246, 21), (246, 28)], | |
('token', | |
[(246, 22), (246, 23)], | |
'+'), | |
('token', | |
[(246, 24), (246, 25)], | |
'y'), | |
('number', | |
[(246, 26), (246, 27)], | |
'1'))))), | |
('parens', | |
[(247, 2), (247, 20)], | |
('token', [(247, 3), (247, 9)], 'assert'), | |
('parens', | |
[(247, 10), (247, 19)], | |
('token', [(247, 11), (247, 12)], '='), | |
('token', [(247, 13), (247, 14)], 'y'), | |
('token', [(247, 15), (247, 16)], 'x'), | |
('number', [(247, 17), (247, 18)], '2')))), | |
('parens', | |
[(250, 0), (257, 49)], | |
('token', [(250, 1), (250, 5)], 'defn'), | |
('token', | |
[(250, 6), (250, 25)], | |
'test-comprehensions'), | |
('list', [(250, 26), (250, 28)]), | |
('string', | |
[(251, 2), (251, 36)], | |
'NATIVE: test list comprehensions'), | |
('parens', | |
[(252, 2), (252, 54)], | |
('token', [(252, 3), (252, 9)], 'assert'), | |
('parens', | |
[(252, 10), (252, 53)], | |
('token', [(252, 11), (252, 12)], '='), | |
('parens', | |
[(252, 13), (252, 46)], | |
('token', | |
[(252, 14), (252, 23)], | |
'list-comp'), | |
('parens', | |
[(252, 24), (252, 31)], | |
('token', | |
[(252, 25), (252, 26)], | |
'*'), | |
('token', | |
[(252, 27), (252, 28)], | |
'x'), | |
('number', | |
[(252, 29), (252, 30)], | |
'2')), | |
('parens', | |
[(252, 32), (252, 45)], | |
('token', | |
[(252, 33), (252, 34)], | |
'x'), | |
('parens', | |
[(252, 35), (252, 44)], | |
('token', | |
[(252, 36), (252, 41)], | |
'range'), | |
('number', | |
[(252, 42), (252, 43)], | |
'2')))), | |
('list', | |
[(252, 47), (252, 52)], | |
('number', [(252, 48), (252, 49)], '0'), | |
('number', [(252, 50), (252, 51)], '2')))), | |
('parens', | |
[(253, 2), (253, 62)], | |
('token', [(253, 3), (253, 9)], 'assert'), | |
('parens', | |
[(253, 10), (253, 61)], | |
('token', [(253, 11), (253, 12)], '='), | |
('parens', | |
[(253, 13), (253, 54)], | |
('token', | |
[(253, 14), (253, 23)], | |
'list-comp'), | |
('parens', | |
[(253, 24), (253, 31)], | |
('token', | |
[(253, 25), (253, 26)], | |
'*'), | |
('token', | |
[(253, 27), (253, 28)], | |
'x'), | |
('number', | |
[(253, 29), (253, 30)], | |
'2')), | |
('parens', | |
[(253, 32), (253, 45)], | |
('token', | |
[(253, 33), (253, 34)], | |
'x'), | |
('parens', | |
[(253, 35), (253, 44)], | |
('token', | |
[(253, 36), (253, 41)], | |
'range'), | |
('number', | |
[(253, 42), (253, 43)], | |
'4'))), | |
('parens', | |
[(253, 46), (253, 53)], | |
('token', | |
[(253, 47), (253, 48)], | |
'%'), | |
('token', | |
[(253, 49), (253, 50)], | |
'x'), | |
('number', | |
[(253, 51), (253, 52)], | |
'2'))), | |
('list', | |
[(253, 55), (253, 60)], | |
('number', [(253, 56), (253, 57)], '2'), | |
('number', [(253, 58), (253, 59)], '6')))), | |
('parens', | |
[(254, 2), (255, 20)], | |
('token', [(254, 3), (254, 9)], 'assert'), | |
('parens', | |
[(254, 10), (255, 19)], | |
('token', [(254, 11), (254, 12)], '='), | |
('parens', | |
[(254, 13), (254, 74)], | |
('token', | |
[(254, 14), (254, 20)], | |
'sorted'), | |
('parens', | |
[(254, 21), (254, 73)], | |
('token', | |
[(254, 22), (254, 31)], | |
'list-comp'), | |
('parens', | |
[(254, 32), (254, 39)], | |
('token', | |
[(254, 33), (254, 34)], | |
'*'), | |
('token', | |
[(254, 35), (254, 36)], | |
'y'), | |
('number', | |
[(254, 37), (254, 38)], | |
'2')), | |
('parens', | |
[(254, 40), (254, 72)], | |
('parens', | |
[(254, 41), (254, 48)], | |
('token', | |
[(254, 42), (254, 43)], | |
','), | |
('token', | |
[(254, 44), (254, 45)], | |
'x'), | |
('token', | |
[(254, 46), (254, 47)], | |
'y')), | |
('parens', | |
[(254, 49), (254, 71)], | |
('token', | |
[(254, 50), (254, 56)], | |
'.items'), | |
('dict', | |
[(254, 57), (254, 70)], | |
('string', | |
[(254, 58), (254, 61)], | |
'1'), | |
('number', | |
[(254, 62), (254, 63)], | |
'1'), | |
('string', | |
[(254, 64), (254, 67)], | |
'2'), | |
('number', | |
[(254, 68), (254, 69)], | |
'2')))))), | |
('list', | |
[(255, 13), (255, 18)], | |
('number', [(255, 14), (255, 15)], '2'), | |
('number', [(255, 16), (255, 17)], '4')))), | |
('parens', | |
[(256, 2), (257, 48)], | |
('token', [(256, 3), (256, 9)], 'assert'), | |
('parens', | |
[(256, 10), (257, 47)], | |
('token', [(256, 11), (256, 12)], '='), | |
('parens', | |
[(256, 13), (256, 58)], | |
('token', | |
[(256, 14), (256, 23)], | |
'list-comp'), | |
('parens', | |
[(256, 24), (256, 31)], | |
('token', | |
[(256, 25), (256, 26)], | |
','), | |
('token', | |
[(256, 27), (256, 28)], | |
'x'), | |
('token', | |
[(256, 29), (256, 30)], | |
'y')), | |
('parens', | |
[(256, 32), (256, 57)], | |
('token', | |
[(256, 33), (256, 34)], | |
'x'), | |
('parens', | |
[(256, 35), (256, 44)], | |
('token', | |
[(256, 36), (256, 41)], | |
'range'), | |
('number', | |
[(256, 42), (256, 43)], | |
'2')), | |
('token', | |
[(256, 45), (256, 46)], | |
'y'), | |
('parens', | |
[(256, 47), (256, 56)], | |
('token', | |
[(256, 48), (256, 53)], | |
'range'), | |
('number', | |
[(256, 54), (256, 55)], | |
'2')))), | |
('list', | |
[(257, 13), (257, 46)], | |
('parens', | |
[(257, 14), (257, 21)], | |
('token', | |
[(257, 15), (257, 16)], | |
','), | |
('number', | |
[(257, 17), (257, 18)], | |
'0'), | |
('number', | |
[(257, 19), (257, 20)], | |
'0')), | |
('parens', | |
[(257, 22), (257, 29)], | |
('token', | |
[(257, 23), (257, 24)], | |
','), | |
('number', | |
[(257, 25), (257, 26)], | |
'0'), | |
('number', | |
[(257, 27), (257, 28)], | |
'1')), | |
('parens', | |
[(257, 30), (257, 37)], | |
('token', | |
[(257, 31), (257, 32)], | |
','), | |
('number', | |
[(257, 33), (257, 34)], | |
'1'), | |
('number', | |
[(257, 35), (257, 36)], | |
'0')), | |
('parens', | |
[(257, 38), (257, 45)], | |
('token', | |
[(257, 39), (257, 40)], | |
','), | |
('number', | |
[(257, 41), (257, 42)], | |
'1'), | |
('number', | |
[(257, 43), (257, 44)], | |
'1')))))), | |
('parens', | |
[(260, 0), (268, 39)], | |
('token', [(260, 1), (260, 5)], 'defn'), | |
('token', | |
[(260, 6), (260, 21)], | |
'test-defn-order'), | |
('list', [(260, 22), (260, 24)]), | |
('string', | |
[(261, 2), (261, 38)], | |
'NATIVE: test defn evaluation order'), | |
('parens', | |
[(262, 2), (262, 15)], | |
('token', [(262, 3), (262, 7)], 'setv'), | |
('token', [(262, 8), (262, 11)], 'acc'), | |
('list', [(262, 12), (262, 14)])), | |
('parens', | |
[(263, 2), (266, 24)], | |
('token', [(263, 3), (263, 7)], 'defn'), | |
('token', [(263, 8), (263, 14)], 'my-fun'), | |
('list', [(263, 15), (263, 17)]), | |
('parens', | |
[(264, 4), (264, 23)], | |
('token', | |
[(264, 5), (264, 12)], | |
'.append'), | |
('token', [(264, 13), (264, 16)], 'acc'), | |
('string', [(264, 17), (264, 22)], 'Foo')), | |
('parens', | |
[(265, 4), (265, 23)], | |
('token', | |
[(265, 5), (265, 12)], | |
'.append'), | |
('token', [(265, 13), (265, 16)], 'acc'), | |
('string', [(265, 17), (265, 22)], 'Bar')), | |
('parens', | |
[(266, 4), (266, 23)], | |
('token', | |
[(266, 5), (266, 12)], | |
'.append'), | |
('token', [(266, 13), (266, 16)], 'acc'), | |
('string', [(266, 17), (266, 22)], 'Baz'))), | |
('parens', | |
[(267, 2), (267, 10)], | |
('token', [(267, 3), (267, 9)], 'my-fun')), | |
('parens', | |
[(268, 2), (268, 38)], | |
('token', [(268, 3), (268, 9)], 'assert'), | |
('parens', | |
[(268, 10), (268, 37)], | |
('token', [(268, 11), (268, 12)], '='), | |
('token', [(268, 13), (268, 16)], 'acc'), | |
('list', | |
[(268, 17), (268, 36)], | |
('string', | |
[(268, 18), (268, 23)], | |
'Foo'), | |
('string', | |
[(268, 24), (268, 29)], | |
'Bar'), | |
('string', | |
[(268, 30), (268, 35)], | |
'Baz'))))), | |
('parens', | |
[(271, 0), (275, 30)], | |
('token', [(271, 1), (271, 5)], 'defn'), | |
('token', | |
[(271, 6), (271, 22)], | |
'test-defn-return'), | |
('list', [(271, 23), (271, 25)]), | |
('string', | |
[(272, 2), (272, 28)], | |
'NATIVE: test defn return'), | |
('parens', | |
[(273, 2), (274, 12)], | |
('token', [(273, 3), (273, 7)], 'defn'), | |
('token', [(273, 8), (273, 14)], 'my-fun'), | |
('list', | |
[(273, 15), (273, 18)], | |
('token', [(273, 16), (273, 17)], 'x')), | |
('parens', | |
[(274, 4), (274, 11)], | |
('token', [(274, 5), (274, 6)], '+'), | |
('token', [(274, 7), (274, 8)], 'x'), | |
('number', [(274, 9), (274, 10)], '1'))), | |
('parens', | |
[(275, 2), (275, 29)], | |
('token', [(275, 3), (275, 9)], 'assert'), | |
('parens', | |
[(275, 10), (275, 28)], | |
('token', [(275, 11), (275, 12)], '='), | |
('number', [(275, 13), (275, 15)], '43'), | |
('parens', | |
[(275, 16), (275, 27)], | |
('token', | |
[(275, 17), (275, 23)], | |
'my-fun'), | |
('number', | |
[(275, 24), (275, 26)], | |
'42'))))), | |
('parens', | |
[(278, 0), (287, 39)], | |
('token', [(278, 1), (278, 5)], 'defn'), | |
('token', | |
[(278, 6), (278, 18)], | |
'test-defn-do'), | |
('list', [(278, 19), (278, 21)]), | |
('string', | |
[(279, 2), (279, 46)], | |
'NATIVE: test defn evaluation order with do'), | |
('parens', | |
[(280, 2), (280, 15)], | |
('token', [(280, 3), (280, 7)], 'setv'), | |
('token', [(280, 8), (280, 11)], 'acc'), | |
('list', [(280, 12), (280, 14)])), | |
('parens', | |
[(281, 2), (285, 27)], | |
('token', [(281, 3), (281, 7)], 'defn'), | |
('token', [(281, 8), (281, 14)], 'my-fun'), | |
('list', [(281, 15), (281, 17)]), | |
('parens', | |
[(282, 4), (285, 26)], | |
('token', [(282, 5), (282, 7)], 'do'), | |
('parens', | |
[(283, 6), (283, 25)], | |
('token', | |
[(283, 7), (283, 14)], | |
'.append'), | |
('token', | |
[(283, 15), (283, 18)], | |
'acc'), | |
('string', | |
[(283, 19), (283, 24)], | |
'Foo')), | |
('parens', | |
[(284, 6), (284, 25)], | |
('token', | |
[(284, 7), (284, 14)], | |
'.append'), | |
('token', | |
[(284, 15), (284, 18)], | |
'acc'), | |
('string', | |
[(284, 19), (284, 24)], | |
'Bar')), | |
('parens', | |
[(285, 6), (285, 25)], | |
('token', | |
[(285, 7), (285, 14)], | |
'.append'), | |
('token', | |
[(285, 15), (285, 18)], | |
'acc'), | |
('string', | |
[(285, 19), (285, 24)], | |
'Baz')))), | |
('parens', | |
[(286, 2), (286, 10)], | |
('token', [(286, 3), (286, 9)], 'my-fun')), | |
('parens', | |
[(287, 2), (287, 38)], | |
('token', [(287, 3), (287, 9)], 'assert'), | |
('parens', | |
[(287, 10), (287, 37)], | |
('token', [(287, 11), (287, 12)], '='), | |
('token', [(287, 13), (287, 16)], 'acc'), | |
('list', | |
[(287, 17), (287, 36)], | |
('string', | |
[(287, 18), (287, 23)], | |
'Foo'), | |
('string', | |
[(287, 24), (287, 29)], | |
'Bar'), | |
('string', | |
[(287, 30), (287, 35)], | |
'Baz'))))), | |
('parens', | |
[(290, 0), (296, 30)], | |
('token', [(290, 1), (290, 5)], 'defn'), | |
('token', | |
[(290, 6), (290, 25)], | |
'test-defn-do-return'), | |
('list', [(290, 26), (290, 28)]), | |
('string', | |
[(291, 2), (291, 36)], | |
'NATIVE: test defn return with do'), | |
('parens', | |
[(292, 2), (295, 15)], | |
('token', [(292, 3), (292, 7)], 'defn'), | |
('token', [(292, 8), (292, 14)], 'my-fun'), | |
('list', | |
[(292, 15), (292, 18)], | |
('token', [(292, 16), (292, 17)], 'x')), | |
('parens', | |
[(293, 4), (295, 14)], | |
('token', [(293, 5), (293, 7)], 'do'), | |
('parens', | |
[(294, 6), (294, 14)], | |
('token', [(294, 7), (294, 8)], '+'), | |
('token', [(294, 9), (294, 10)], 'x'), | |
('number', | |
[(294, 11), (294, 13)], | |
'42')), | |
('parens', | |
[(295, 6), (295, 13)], | |
('token', [(295, 7), (295, 8)], '+'), | |
('token', [(295, 9), (295, 10)], 'x'), | |
('number', [(295, 11), (295, 12)], '1')))), | |
('parens', | |
[(296, 2), (296, 29)], | |
('token', [(296, 3), (296, 9)], 'assert'), | |
('parens', | |
[(296, 10), (296, 28)], | |
('token', [(296, 11), (296, 12)], '='), | |
('number', [(296, 13), (296, 15)], '43'), | |
('parens', | |
[(296, 16), (296, 27)], | |
('token', | |
[(296, 17), (296, 23)], | |
'my-fun'), | |
('number', | |
[(296, 24), (296, 26)], | |
'42'))))), | |
('parens', | |
[(299, 0), (301, 35)], | |
('token', [(299, 1), (299, 5)], 'defn'), | |
('token', | |
[(299, 6), (299, 18)], | |
'test-mangles'), | |
('list', [(299, 19), (299, 21)]), | |
('string', | |
[(300, 2), (300, 24)], | |
'NATIVE: test mangles'), | |
('parens', | |
[(301, 2), (301, 34)], | |
('token', [(301, 3), (301, 9)], 'assert'), | |
('parens', | |
[(301, 10), (301, 33)], | |
('token', [(301, 11), (301, 12)], '='), | |
('number', [(301, 13), (301, 14)], '2'), | |
('parens', | |
[(301, 15), (301, 32)], | |
('parens', | |
[(301, 16), (301, 31)], | |
('token', | |
[(301, 17), (301, 19)], | |
'fn'), | |
('list', [(301, 20), (301, 22)]), | |
('parens', | |
[(301, 23), (301, 30)], | |
('token', | |
[(301, 24), (301, 25)], | |
'+'), | |
('number', | |
[(301, 26), (301, 27)], | |
'1'), | |
('number', | |
[(301, 28), (301, 29)], | |
'1'))))))), | |
('parens', | |
[(304, 0), (307, 27)], | |
('token', [(304, 1), (304, 5)], 'defn'), | |
('token', | |
[(304, 6), (304, 20)], | |
'test-fn-return'), | |
('list', [(304, 21), (304, 23)]), | |
('string', | |
[(305, 2), (305, 32)], | |
'NATIVE: test function return'), | |
('parens', | |
[(306, 2), (306, 42)], | |
('token', [(306, 3), (306, 7)], 'setv'), | |
('token', [(306, 8), (306, 15)], 'fn-test'), | |
('parens', | |
[(306, 16), (306, 41)], | |
('parens', | |
[(306, 17), (306, 40)], | |
('token', [(306, 18), (306, 20)], 'fn'), | |
('list', [(306, 21), (306, 23)]), | |
('parens', | |
[(306, 24), (306, 39)], | |
('token', | |
[(306, 25), (306, 27)], | |
'fn'), | |
('list', [(306, 28), (306, 30)]), | |
('parens', | |
[(306, 31), (306, 38)], | |
('token', | |
[(306, 32), (306, 33)], | |
'+'), | |
('number', | |
[(306, 34), (306, 35)], | |
'1'), | |
('number', | |
[(306, 36), (306, 37)], | |
'1')))))), | |
('parens', | |
[(307, 2), (307, 26)], | |
('token', [(307, 3), (307, 9)], 'assert'), | |
('parens', | |
[(307, 10), (307, 25)], | |
('token', [(307, 11), (307, 12)], '='), | |
('parens', | |
[(307, 13), (307, 22)], | |
('token', | |
[(307, 14), (307, 21)], | |
'fn-test')), | |
('number', [(307, 23), (307, 24)], '2')))), | |
('parens', | |
[(310, 0), (312, 53)], | |
('token', [(310, 1), (310, 5)], 'defn'), | |
('token', [(310, 6), (310, 14)], 'test-let'), | |
('list', [(310, 15), (310, 17)]), | |
('string', | |
[(311, 2), (311, 35)], | |
'NATIVE: test let works rightish'), | |
('parens', | |
[(312, 2), (312, 52)], | |
('token', [(312, 3), (312, 9)], 'assert'), | |
('parens', | |
[(312, 10), (312, 51)], | |
('token', [(312, 11), (312, 12)], '='), | |
('parens', | |
[(312, 13), (312, 48)], | |
('token', | |
[(312, 14), (312, 17)], | |
'let'), | |
('list', | |
[(312, 18), (312, 37)], | |
('list', | |
[(312, 19), (312, 24)], | |
('token', | |
[(312, 20), (312, 21)], | |
'x'), | |
('number', | |
[(312, 22), (312, 23)], | |
'1')), | |
('list', | |
[(312, 25), (312, 30)], | |
('token', | |
[(312, 26), (312, 27)], | |
'y'), | |
('number', | |
[(312, 28), (312, 29)], | |
'2')), | |
('list', | |
[(312, 31), (312, 36)], | |
('token', | |
[(312, 32), (312, 33)], | |
'z'), | |
('number', | |
[(312, 34), (312, 35)], | |
'3'))), | |
('parens', | |
[(312, 38), (312, 47)], | |
('token', | |
[(312, 39), (312, 40)], | |
'+'), | |
('token', | |
[(312, 41), (312, 42)], | |
'x'), | |
('token', | |
[(312, 43), (312, 44)], | |
'y'), | |
('token', | |
[(312, 45), (312, 46)], | |
'z'))), | |
('number', [(312, 49), (312, 50)], '6')))), | |
('parens', | |
[(315, 0), (317, 40)], | |
('token', [(315, 1), (315, 5)], 'defn'), | |
('token', | |
[(315, 6), (315, 21)], | |
'test-if-mangler'), | |
('list', [(315, 22), (315, 24)]), | |
('string', | |
[(316, 2), (316, 35)], | |
'NATIVE: test that we return ifs'), | |
('parens', | |
[(317, 2), (317, 39)], | |
('token', [(317, 3), (317, 9)], 'assert'), | |
('parens', | |
[(317, 10), (317, 38)], | |
('token', [(317, 11), (317, 12)], '='), | |
('token', [(317, 13), (317, 17)], 'true'), | |
('parens', | |
[(317, 18), (317, 37)], | |
('token', [(317, 19), (317, 21)], 'if'), | |
('token', | |
[(317, 22), (317, 26)], | |
'true'), | |
('token', | |
[(317, 27), (317, 31)], | |
'true'), | |
('token', | |
[(317, 32), (317, 36)], | |
'true'))))), | |
('parens', | |
[(320, 0), (331, 21)], | |
('token', [(320, 1), (320, 5)], 'defn'), | |
('token', | |
[(320, 6), (320, 20)], | |
'test-let-scope'), | |
('list', [(320, 21), (320, 23)]), | |
('string', | |
[(321, 2), (321, 35)], | |
'NATIVE: test let works rightish'), | |
('parens', | |
[(322, 2), (322, 14)], | |
('token', [(322, 3), (322, 7)], 'setv'), | |
('token', [(322, 8), (322, 9)], 'y'), | |
('number', [(322, 10), (322, 13)], '123')), | |
('parens', | |
[(323, 2), (327, 16)], | |
('token', [(323, 3), (323, 9)], 'assert'), | |
('parens', | |
[(323, 10), (327, 15)], | |
('token', [(323, 11), (323, 12)], '='), | |
('parens', | |
[(323, 13), (326, 25)], | |
('token', | |
[(323, 14), (323, 17)], | |
'let'), | |
('list', | |
[(323, 18), (325, 25)], | |
('list', | |
[(323, 19), (323, 24)], | |
('token', | |
[(323, 20), (323, 21)], | |
'x'), | |
('number', | |
[(323, 22), (323, 23)], | |
'1')), | |
('list', | |
[(324, 19), (324, 24)], | |
('token', | |
[(324, 20), (324, 21)], | |
'y'), | |
('number', | |
[(324, 22), (324, 23)], | |
'2')), | |
('list', | |
[(325, 19), (325, 24)], | |
('token', | |
[(325, 20), (325, 21)], | |
'z'), | |
('number', | |
[(325, 22), (325, 23)], | |
'3'))), | |
('parens', | |
[(326, 15), (326, 24)], | |
('token', | |
[(326, 16), (326, 17)], | |
'+'), | |
('token', | |
[(326, 18), (326, 19)], | |
'x'), | |
('token', | |
[(326, 20), (326, 21)], | |
'y'), | |
('token', | |
[(326, 22), (326, 23)], | |
'z'))), | |
('number', [(327, 13), (327, 14)], '6'))), | |
('parens', | |
[(328, 2), (330, 35)], | |
('token', [(328, 3), (328, 6)], 'try'), | |
('parens', | |
[(329, 4), (329, 21)], | |
('token', | |
[(329, 5), (329, 11)], | |
'assert'), | |
('parens', | |
[(329, 12), (329, 20)], | |
('token', [(329, 13), (329, 14)], '='), | |
('token', [(329, 15), (329, 16)], 'x'), | |
('number', | |
[(329, 17), (329, 19)], | |
'42'))), | |
('parens', | |
[(330, 4), (330, 34)], | |
('token', [(330, 5), (330, 10)], 'catch'), | |
('token', | |
[(330, 11), (330, 20)], | |
'NameError'), | |
('token', [(330, 21), (330, 22)], 'e'), | |
('parens', | |
[(330, 23), (330, 33)], | |
('token', | |
[(330, 24), (330, 30)], | |
'assert'), | |
('token', [(330, 31), (330, 32)], 'e')))), | |
('parens', | |
[(331, 2), (331, 20)], | |
('token', [(331, 3), (331, 9)], 'assert'), | |
('parens', | |
[(331, 10), (331, 19)], | |
('token', [(331, 11), (331, 12)], '='), | |
('token', [(331, 13), (331, 14)], 'y'), | |
('number', [(331, 15), (331, 18)], '123'))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
import parsley | |
import pprint | |
grammar = r""" | |
# Hy Grammar | |
# Whitespace and comments | |
hspace = ' ' | '\t' | comment | |
vspace = '\r\n' | '\r' | '\n' | |
comment = ';' (~vspace anything)* | |
ws = (hspace | vspace | comment)+ | |
# The root node is composed of zero or more parenthesized expressions separated by whitespace | |
root = (ws? (parens:first (ws parens)*:rest) ws? end -> ('root', self.get_boundaries(), first, ) + tuple(rest)) | ws? -> ('root', self.get_boundaries(), ) | |
parens = '(' list_contents:contents ws? ')' -> ('parens', self.get_boundaries(), ) + contents | |
# A listey thing contains a (possibly empty) suite of whitespace-separated terms | |
list_contents = (ws? (term:first (ws term)*:rest) -> (first, ) + tuple(rest)) | -> () | |
# A term can be several kinds of things | |
# please keep the "token" at the end, it eats lots of stuff. | |
term = string | quoted | unquoted | list | dict | parens | number | token | |
# A quoted term | |
quoted = '\'' term:term -> ('quoted', self.get_boundaries(), term) | |
# An unquoted term | |
unquoted = ',' term:term -> ('unquoted', self.get_boundaries(), term) | |
# A list | |
list = '[' list_contents:contents ws? ']' -> ('list', self.get_boundaries(), ) + contents | |
# A dict | |
dict = '{' list_contents:contents ws? '}' -> ('dict', self.get_boundaries(), ) + contents | |
# A string | |
string = '\"' <(escapedChar | ~'"' anything)*>:st '\"' -> ('string', self.get_boundaries(), st) | |
escapedChar = '\\' ( | |
('"' -> '"') | | |
('/' -> '/') | | |
('b' -> '\b') | | |
('f' -> '\f') | | |
('n' -> '\n') | | |
('r' -> '\r') | | |
('t' -> '\t') | | |
('\\' -> '\\') | |
) | |
# A number | |
number = <digit+>:number -> ('number', self.get_boundaries(), number) | |
# Or a token | |
token = starred_token | litteral_token | ('*' -> ('token', self.get_boundaries(), '*')) | |
litteral_token = <(letterOrDigit | :x ?(x in "+-:=?<>,.!%~"))+>:t -> ('token', self.get_boundaries(), t) | |
starred_token = '*' litteral_token:t '*' -> ('starred_token', self.get_boundaries(), t[1]) | |
""" | |
from ometa.runtime import OMetaBase | |
class HyGrammarBase(OMetaBase): | |
def __init__(self, *args, **kwargs): | |
super(HyGrammarBase, self).__init__(*args, **kwargs) | |
linecounts = [] | |
counter = 0 | |
for line in str(self.input.data).split('\n'): | |
counter += len(line) + 1 | |
linecounts.append(counter) | |
self.__linecounts = linecounts | |
self.curpos = [] | |
@property | |
def pos(self): | |
pos = self.input.position | |
prevcount = 0 | |
for lineNo, count in enumerate(self.__linecounts): | |
if pos < count: | |
break | |
prevcount = count | |
return (lineNo + 1, pos - prevcount) | |
def get_boundaries(self, trace=False): | |
if trace: | |
import pdb; pdb.set_trace() | |
return self.curpos[-1:] + [self.pos] | |
def _apply(self, rule, ruleName, args): | |
try: | |
self.curpos.append(self.pos) | |
ret = super(HyGrammarBase, self)._apply(rule, ruleName, args) | |
finally: | |
self.curpos.pop() | |
return ret | |
g = parsley.makeGrammar(grammar, {}, extends=HyGrammarBase) | |
pprint.pprint(g(file('/home/nicolasd/code/hy/hy/tests/native_tests/language.hy').read()).root(), width=50) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment