support [\n ...] and {\n ...}

This commit is contained in:
pikastech 2022-08-13 00:08:21 +08:00
parent 7d01af7b90
commit a1b3347e5b
4 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,8 @@
d = {'a':1, 'b':2, 'c':'test'}
d = {
'a': 1,
'b': 2,
'c': 'test'
}
print(d)
for item in d:
print(item)
@ -7,5 +11,8 @@ for k in keys:
print(k)
print(keys)
dd = {'list':[1,2,3], 'len':3}
dd = {
'list': [1, 2, 3],
'len': 3
}
print(dd)

View File

@ -1,4 +1,8 @@
f = open('test/out/file3.txt', 'w')
seq = ['This is the first line.\n', 'This is the second line.\n', 'This is the third line.\n']
seq = [
'This is the first line.\n',
'This is the second line.\n',
'This is the third line.\n'
]
f.writelines(seq)
f.close()

View File

@ -11,7 +11,7 @@
"program": "${workspaceFolder}/build/test/pikascript_test",
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
"args": [
"--gtest_filter=pikaMain.synac_err_1"
// "--gtest_filter=pikaMain.synac_err_1"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",

View File

@ -846,6 +846,12 @@ void Cursor_iterStart(struct Cursor* ps) {
if (strEqu(ps->token1.pyload, "]")) {
ps->branket_deepth--;
}
if (strEqu(ps->token1.pyload, "{")) {
ps->branket_deepth++;
}
if (strEqu(ps->token1.pyload, "}")) {
ps->branket_deepth--;
}
}
void LexToken_init(struct LexToken* lt) {