rpc-language 2.5__py3-none-any.whl → 3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rpc.py +46 -15
- {rpc_language-2.5.dist-info → rpc_language-3.0.dist-info}/METADATA +1 -1
- rpc_language-3.0.dist-info/RECORD +6 -0
- rpc_language-2.5.dist-info/RECORD +0 -6
- {rpc_language-2.5.dist-info → rpc_language-3.0.dist-info}/WHEEL +0 -0
- {rpc_language-2.5.dist-info → rpc_language-3.0.dist-info}/entry_points.txt +0 -0
- {rpc_language-2.5.dist-info → rpc_language-3.0.dist-info}/top_level.txt +0 -0
rpc.py
CHANGED
|
@@ -3,26 +3,60 @@ import shutil
|
|
|
3
3
|
import time
|
|
4
4
|
import sys
|
|
5
5
|
import os
|
|
6
|
+
import re
|
|
6
7
|
|
|
7
8
|
class RPC:
|
|
8
9
|
class NeedSemicolon(Exception):
|
|
9
10
|
def __init__(self, message):
|
|
10
11
|
super().__init__(message)
|
|
12
|
+
class MismatchedQuotationMarks(Exception):
|
|
13
|
+
def __init__(self, message):
|
|
14
|
+
super().__init__(message)
|
|
11
15
|
|
|
12
16
|
def parse(line):
|
|
13
17
|
indent = len(line) - len(line.lstrip())
|
|
14
18
|
line = line.lstrip()
|
|
15
19
|
add = False
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
mark1a = 0
|
|
22
|
+
mark1b = 0
|
|
23
|
+
text = line.split("//")[0]
|
|
24
|
+
for i in line:
|
|
25
|
+
if i == "'":
|
|
26
|
+
mark1a += 1
|
|
27
|
+
if i == '"':
|
|
28
|
+
mark1b += 1
|
|
29
|
+
|
|
30
|
+
mark2a = 0
|
|
31
|
+
mark2b = 0
|
|
32
|
+
for i in text:
|
|
33
|
+
if i == "'":
|
|
34
|
+
mark2a += 1
|
|
35
|
+
if i == '"':
|
|
36
|
+
mark2b += 1
|
|
37
|
+
|
|
38
|
+
if mark1a % 2 == 0:
|
|
39
|
+
if mark1b % 2 == 0:
|
|
40
|
+
pass
|
|
41
|
+
else:
|
|
42
|
+
raise RPC.MismatchedQuotationMarks("不匹配的引号")
|
|
43
|
+
else:
|
|
44
|
+
raise RPC.MismatchedQuotationMarks("不匹配的引号")
|
|
45
|
+
|
|
46
|
+
if "//" in line:
|
|
47
|
+
if mark2a % 2 == 0 or mark2a == 0:
|
|
48
|
+
if mark2b % 2 == 0 or mark2b == 0:
|
|
49
|
+
line = line.split("//")[0].rstrip()
|
|
50
|
+
|
|
51
|
+
if line.endswith(";"): line = line[:-1]
|
|
52
|
+
elif line == "": pass
|
|
53
|
+
elif line.endswith("{"): pass
|
|
54
|
+
elif line.endswith("}"): pass
|
|
55
|
+
elif line.endswith(">"): pass
|
|
56
|
+
elif line.endswith("++"): pass
|
|
57
|
+
elif line.endswith("--"): pass
|
|
58
|
+
elif line.endswith("?"): pass
|
|
59
|
+
else: raise RPC.NeedSemicolon("缺少分号")
|
|
26
60
|
|
|
27
61
|
if line.startswith("loop"):
|
|
28
62
|
if line.endswith("loop"):
|
|
@@ -36,15 +70,12 @@ def parse(line):
|
|
|
36
70
|
ok = False
|
|
37
71
|
|
|
38
72
|
if ok is True:
|
|
39
|
-
|
|
40
|
-
line = f"for _ in range({line[5:-1].rstrip()})" + line[-1]
|
|
41
|
-
else:
|
|
42
|
-
line = f"for _ in range({line[5:-1].rstrip()}):" + line[-1]
|
|
73
|
+
line = f"for _ in range({line[5:-1].rstrip()}):"
|
|
43
74
|
else:
|
|
44
75
|
if line.endswith("{"):
|
|
45
|
-
line = "while True" + line[4
|
|
76
|
+
line = "while True:" + line[4:-1].rstrip()
|
|
46
77
|
else:
|
|
47
|
-
line = "while True:" + line[4:]
|
|
78
|
+
line = "while True:" + line[4:].rstrip()
|
|
48
79
|
|
|
49
80
|
if line.startswith("fn "):
|
|
50
81
|
line = 'def ' + line[3:]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
rpc.py,sha256=rsLzoFP7yuzicclXDwzYjb-W-bVhMATKXIFJOH_jFgY,8713
|
|
2
|
+
rpc_language-3.0.dist-info/METADATA,sha256=aNQWEjgYyhYBsZi91ig5Sg9nBpv6oC-PedFwvVk6q0s,109
|
|
3
|
+
rpc_language-3.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
4
|
+
rpc_language-3.0.dist-info/entry_points.txt,sha256=ITnGyY2TUli-BiULm9Eigm3dXrW6uNrhZJY0E9oHJI8,33
|
|
5
|
+
rpc_language-3.0.dist-info/top_level.txt,sha256=dMMjdzobtMMUmMoS3mvB-qSKU_TWlDMgqZreiX5rwP4,4
|
|
6
|
+
rpc_language-3.0.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
rpc.py,sha256=HGQ4UgEIWh_amNnPsJU3qCQeMyk1QCZ1T-0cclpu5wk,7990
|
|
2
|
-
rpc_language-2.5.dist-info/METADATA,sha256=nuCOMTxOaxU-lz4f80q2VIbUqIU4S6Q0dYvT_9keCWE,109
|
|
3
|
-
rpc_language-2.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
4
|
-
rpc_language-2.5.dist-info/entry_points.txt,sha256=ITnGyY2TUli-BiULm9Eigm3dXrW6uNrhZJY0E9oHJI8,33
|
|
5
|
-
rpc_language-2.5.dist-info/top_level.txt,sha256=dMMjdzobtMMUmMoS3mvB-qSKU_TWlDMgqZreiX5rwP4,4
|
|
6
|
-
rpc_language-2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|