Skip to content

Commit 8e06e7a

Browse files
committed
Some changes to explanation generating
1 parent 867847c commit 8e06e7a

File tree

2 files changed

+97
-101
lines changed

2 files changed

+97
-101
lines changed

explanations.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
lines = []
2-
with open('commands.md','rb') as f:
3-
for line in f:
4-
lines.append(line)
51
explanations = "var explanations = {\n"
62
for line in open("commands.md"):
73
if line.startswith("* _"):
84
operator = line.split("(`")[1].split("`)")[0].replace("\\", "\\\\").replace("` ` `", "`").replace("'", "\\'")
95
explanation = line.split(": ")[1]
10-
explanations += "'" + operator + "':'" + explanation.rstrip("\n\r") + "',\n"
6+
explanations += " '" + operator + "': '" + explanation.rstrip("\n\r") + "',\n"
117
with open("static/explanations.js", "wb") as f:
12-
f.write(bytes(explanations + "\n};", "UTF-8"))
8+
f.write(bytes(explanations + "};", "UTF-8"))
9+
print("Done making explanations, output in static/explanations.js")

static/explanations.js

+94-95
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,96 @@
11
var explanations = {
2-
'!':'',
3-
'"':'String parsing',
4-
'#':'String to number',
5-
'$':'Take object from lower stack up',
6-
'%':'Modulous',
7-
'&':'**something with maps?**',
8-
'\'':'Character literal',
9-
'':'Decrement',
10-
')':'Increment',
11-
'*':'Multiplication',
12-
'+':'Addition',
13-
',':'Range',
14-
'-':'Subtraction',
15-
'.':'Clone the top of the stack',
16-
'/':'Division',
17-
'0':'Push 0',
18-
'1':'Push 1',
19-
'2':'Push 2',
20-
'3':'Push 3',
21-
'4':'Push 4',
22-
'5':'Push 5',
23-
'6':'Push 6',
24-
'7':'Push 7',
25-
'8':'Push 8',
26-
'9':'Push 9',
27-
':':'Assign to variable',
28-
';':'Pop top value of stack',
29-
'<':'Less than',
30-
'=':'Equal to',
31-
'>':'Greater than',
32-
'?':'If????',
33-
'@':'Rotate top three items on stack',
34-
'A':'Push 10',
35-
'B':'Push 11',
36-
'C':'Push 12',
37-
'D':'Push 13',
38-
'E':'Push 14',
39-
'F':'Push 15',
40-
'G':'Push alphabet',
41-
'H':'Macro for `[Q`',
42-
'I':'Macro for `[i`',
43-
'J':'Magic var',
44-
'K':'Magic var',
45-
'L':'Lambda (Push next character as a standalone CodeBlock',
46-
'M':'Macro for `[i~`',
47-
'N':'Push blank CodeBlock',
48-
'O':'',
49-
'P':'',
50-
'Q':'Input var',
51-
'R':'',
52-
'S':'Blank String',
53-
'T':'String with space `" "`',
54-
'U':'Newline string `"\n"`',
55-
'V':'_Commonly used for variables_',
56-
'W':'Push 32',
57-
'X':'Push 33',
58-
'Y':'Push 34',
59-
'Z':'Push 35',
60-
'[':'Start array',
61-
'\\':'Swap two objects on stack',
62-
']':'End array',
63-
'^':'**Power?**',
64-
'_':'Negate',
65-
'`':'Reverse String',
66-
'a':'',
67-
'b':'',
68-
'c':'Compress int to string',
69-
'd':'For loop',
70-
'e':'Is even? / String length',
71-
'f':'',
72-
'g':'',
73-
'h':'',
74-
'i':'String input',
75-
'j':'Number input',
76-
'k':'',
77-
'l':'Push length of stack',
78-
'm':'Math functions',
79-
'n':'Used in for loops',
80-
'o':'Print object',
81-
'p':'Print object with new line',
82-
'q':'Push input as string/number',
83-
'r':'',
84-
's':'Split string into char array',
85-
't':'',
86-
'u':'',
87-
'v':'',
88-
'w':'While Loop',
89-
'x':'',
90-
'y':'',
91-
'z':'',
92-
'{':'Start CodeBlock',
93-
'|':'',
94-
'}':'End CodeBlock',
95-
'~':'Eval',
96-
2+
'!': '',
3+
'"': 'String parsing',
4+
'#': 'String to number',
5+
'$': 'Take object from lower stack up',
6+
'%': 'Modulous',
7+
'&': 'Get element from array',
8+
'\'': 'Character literal',
9+
'': 'Decrement',
10+
')': 'Increment',
11+
'*': 'Multiplication',
12+
'+': 'Addition',
13+
',': 'Range',
14+
'-': 'Subtraction',
15+
'.': 'Clone the top of the stack',
16+
'/': 'Division',
17+
'0': 'Push 0',
18+
'1': 'Push 1',
19+
'2': 'Push 2',
20+
'3': 'Push 3',
21+
'4': 'Push 4',
22+
'5': 'Push 5',
23+
'6': 'Push 6',
24+
'7': 'Push 7',
25+
'8': 'Push 8',
26+
'9': 'Push 9',
27+
':': 'Assign to variable',
28+
';': 'Pop top value of stack',
29+
'<': 'Less than',
30+
'=': 'Equal to',
31+
'>': 'Greater than',
32+
'?': 'If????',
33+
'@': 'Rotate top three items on stack',
34+
'A': 'Push 10',
35+
'B': 'Push 11',
36+
'C': 'Push 12',
37+
'D': 'Push 13',
38+
'E': 'Push 14',
39+
'F': 'Push 15',
40+
'G': 'Push alphabet',
41+
'H': 'Macro for `[Q`',
42+
'I': 'Macro for `[i`',
43+
'J': 'Magic var',
44+
'K': 'Magic var',
45+
'L': 'Lambda (Push next character as a standalone CodeBlock',
46+
'M': 'Macro for `[i~`',
47+
'N': 'Push blank CodeBlock',
48+
'O': '',
49+
'P': '',
50+
'Q': 'Input var',
51+
'R': '',
52+
'S': 'Blank String',
53+
'T': 'String with space `" "`',
54+
'U': 'Newline string `"\n"`',
55+
'V': '_Commonly used for variables_',
56+
'W': 'Push 32',
57+
'X': 'Push 33',
58+
'Y': 'Push 34',
59+
'Z': 'Push 35',
60+
'[': 'Start array',
61+
'\\': 'Swap two objects on stack',
62+
']': 'End array',
63+
'^': '**Power?**',
64+
'_': 'Negate',
65+
'`': 'Reverse String',
66+
'a': '',
67+
'b': '',
68+
'c': 'Compress int to string',
69+
'd': 'For loop',
70+
'e': 'Is even? / String length',
71+
'f': '',
72+
'g': '',
73+
'h': '',
74+
'i': 'String input',
75+
'j': 'Number input',
76+
'k': '',
77+
'l': 'Push length of stack',
78+
'm': 'Math functions',
79+
'n': 'Used in for loops',
80+
'o': 'Print object',
81+
'p': 'Print object with new line',
82+
'q': 'Push input as string/number',
83+
'r': '',
84+
's': 'Split string into char array',
85+
't': '',
86+
'u': '',
87+
'v': '',
88+
'w': 'While Loop',
89+
'x': '',
90+
'y': '',
91+
'z': '',
92+
'{': 'Start CodeBlock',
93+
'|': '',
94+
'}': 'End CodeBlock',
95+
'~': 'Eval',
9796
};

0 commit comments

Comments
 (0)