-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_language_service.py
77 lines (50 loc) · 1.08 KB
/
test_language_service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from Redy.Opt import *
from dis import dis
@feature(goto)
def loop1():
task1: label
task2: label
end: label
with task1:
print('task1')
x = input('where do you want to goto?[1, 2, end]')
if x == 'end':
print('jump to end')
end.jump()
elif x == '1':
print('jump to task1')
task1.jump()
elif x == '2':
print('jump to task2')
task2.jump()
raise ValueError
task2.mark()
print('task2| then turn to task1.')
task1.jump()
end.mark()
print('good bye')
macro = Macro()
@feature(macro)
def macro_example(x):
@macro.stmt
def just_return(v):
return v
just_return(1)
@macro.stmt
def print_some_and_return_1(s):
print(s)
return 1
@feature(macro)
def macro_example2():
print_some_and_return_1("abcdefg")
dis(macro_example)
print(macro_example(1))
macro_example2()
# dis(loop1)
# loop1()
macro.stmt('def m(): print("string macro")')
#
@feature(macro)
def test_string_macro():
m()
test_string_macro()