egglang 0.1.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.
File without changes
@@ -0,0 +1,34 @@
1
+ class UnknownCmdError(Exception):
2
+ def __init__(self, msg, cmd):
3
+ self.msg = msg
4
+ self.cmd = cmd
5
+
6
+ def __str__(self):
7
+ return f"""
8
+ EGG v2.0 CRACKED BOOM!!!
9
+ [UnknownCmdError] ( ・_・)ノΞ●~*
10
+
11
+
12
+ COMMAND : {self.cmd}
13
+ ERROR : {self.msg}
14
+
15
+
16
+ Double-check that your command is okey, there must be something invalid
17
+ """
18
+ class FileNotFoundError(Exception):
19
+ def __init__(self, msg, cmd):
20
+ self.msg = msg
21
+ self.cmd = cmd
22
+
23
+ def __str__(self):
24
+ return f"""
25
+ EGG v2.0 CRACKED BOOM!!!
26
+ [FileNotFoundError] ( ・_・)ノΞ●~*
27
+
28
+
29
+ PATH : {self.cmd}
30
+ ERROR : {self.msg}
31
+
32
+
33
+ Check that your file exists
34
+ """
@@ -0,0 +1,18 @@
1
+ class ReturnNodeError(Exception):
2
+ def __init__(self,value, line=0):
3
+ self.value = value
4
+ self.line = line
5
+
6
+ def __str__(self):
7
+ return f"""
8
+ EGG v2.0 CRACKED BOOM!!!
9
+ [RuntimeError] ( ・_・)ノΞ●~*
10
+
11
+
12
+ File: Will come on EGG v3.0
13
+ AT LINE: {self.line}
14
+ ERROR: Keyworkd return can only be used inside a function
15
+
16
+
17
+ Double-check that line there must be something invalid
18
+ """
@@ -0,0 +1,35 @@
1
+
2
+ class StopNodeError(Exception):
3
+ def __init__(self, line=0):
4
+ self.line = line
5
+
6
+ def __str__(self):
7
+ return f"""
8
+ EGG v2.0 CRACKED BOOM!!!
9
+ [RuntimeError] ( ・_・)ノΞ●~*
10
+
11
+
12
+ File: Will come on EGG v3.0
13
+ AT LINE: {self.line}
14
+ ERROR: Keyword stop can only be used inside a loop
15
+
16
+
17
+ Double-check that line there must be something invalid
18
+ """
19
+ class SkipNodeError(Exception):
20
+ def __init__(self, line=0):
21
+ self.line = line
22
+
23
+ def __str__(self):
24
+ return f"""
25
+ EGG v2.0 CRACKED BOOM!!!
26
+ [RuntimeError] ( ・_・)ノΞ●~*
27
+
28
+
29
+ File: Will come on EGG v3.0
30
+ AT LINE: {self.line}
31
+ ERROR: Keyword skip can only be used inside a loop
32
+
33
+
34
+ Double-check that line there must be something invalid
35
+ """
@@ -0,0 +1,117 @@
1
+ class RuntimeError(Exception):
2
+ def __init__(self, info, line=0):
3
+ self.msg = info
4
+ self.line = line
5
+
6
+ def __str__(self):
7
+ return f"""
8
+ EGG v2.0 CRACKED BOOM!!!
9
+ [RuntimeError] ( ・_・)ノΞ●~*
10
+
11
+
12
+ File: Will come on EGG v3.0
13
+ AT LINE: {self.line}
14
+ ERROR: {self.msg}
15
+
16
+
17
+ Double-check that line there must be something invalid
18
+ """
19
+ class UnsupportedTypeError(Exception):
20
+ def __init__(self, info, line=0):
21
+ self.msg = info
22
+ self.line = line
23
+
24
+ def __str__(self):
25
+ return f"""
26
+ EGG v2.0 CRACKED BOOM!!!
27
+ [UnsupportedTypeError] ( ・_・)ノΞ●~* BOOM!!!
28
+
29
+
30
+ File: Will come on EGG v3.0
31
+ AT LINE: {self.line}
32
+ ERROR: {self.msg}
33
+
34
+
35
+ Double-check that line there must be something unsupported data type oparetion
36
+ """
37
+
38
+
39
+ class NotFoundError(Exception):
40
+ def __init__(self, cz, line=0):
41
+ self.msg = cz
42
+ self.line = line
43
+
44
+ def __str__(self):
45
+ return f"""
46
+ EGG v2.0 CRACKED BOOM!!!
47
+ [NotFoundError] ( ・_・)ノΞ●~*
48
+
49
+
50
+ File: Will come on EGG v3.0
51
+ AT LINE: {self.line}
52
+ ERROR: {self.msg}
53
+
54
+
55
+ Most likely happens when you use a variable or function that isn’t defined. Please double-check that everything is okay.
56
+ """
57
+
58
+
59
+ class AlreadyExistsError(Exception):
60
+ def __init__(self, var, line=0):
61
+ self.msg = var
62
+ self.line = line
63
+
64
+ def __str__(self):
65
+ return f"""
66
+ EGG v2.0 CRACKED BOOM!!!
67
+ [AlreadyExistsError] ( ・_・)ノΞ●~* BOOM!!!
68
+
69
+
70
+ File: Will come on EGG v3.0
71
+ AT LINE: {self.line}
72
+ ERROR: {self.msg}
73
+
74
+
75
+ The variable or function already exists. Please check your code and remove duplicates.
76
+ """
77
+
78
+
79
+ class TypeNotAllowed(Exception):
80
+ def __init__(self, msg, line=0):
81
+ self.msg = msg
82
+ self.line = line
83
+
84
+ def __str__(self):
85
+ return f"""
86
+ EGG v2.0 CRACKED BOOM!!!
87
+ [TypeNotAllowed] ( ・_・)ノΞ●~*
88
+
89
+
90
+ File: Will come on EGG v3.0
91
+ AT LINE: {self.line}
92
+ ERROR: {self.msg}
93
+
94
+
95
+ The type you used is not allowed here. Please check your values and try again.
96
+ """
97
+
98
+
99
+ class ArgsNotAllowed(Exception):
100
+ def __init__(self, msg, line=0):
101
+ self.msg = msg
102
+ self.line = line
103
+
104
+ def __str__(self):
105
+ return f"""
106
+ EGG v2.0 CRACKED BOOM!!!
107
+ [ArgsNotAllowed] ( ・_・)ノΞ●~*
108
+
109
+
110
+ File: Will come on EGG v3.0
111
+ AT LINE: {self.line}
112
+ ERROR: {self.msg}
113
+
114
+
115
+ EGG CRACKED!!!
116
+ The arguments provided are not allowed. Please check the function usage.
117
+ """
@@ -0,0 +1,18 @@
1
+ class SyntexError(Exception):
2
+ def __init__(self, msg, line=0):
3
+ self.msg = msg
4
+ self.line = line
5
+
6
+ def __str__(self):
7
+ return f"""
8
+ EGG v2.0 CRACKED BOOM!!!
9
+ [SyntexError] ( ・_・)ノΞ●~*
10
+
11
+
12
+ File: Will come on EGG v3.0
13
+ AT LINE: {self.line}
14
+ ERROR: {self.msg}
15
+
16
+
17
+ Double-check that line there must be invalid syntex
18
+ """
File without changes
@@ -0,0 +1,73 @@
1
+ from collections import deque
2
+ from ..Errors.runtime import TypeNotAllowed, RuntimeError, NotFoundError, ArgsNotAllowed
3
+ class Fun:
4
+ def show(self, val):
5
+ for i in val:
6
+ print(i)
7
+ def fineShow(self, val):
8
+ fine_str = ""
9
+ for i in val:
10
+ fine_str = fine_str+str(i)
11
+ print(fine_str)
12
+ def type(self, val):
13
+ if len(val) > 1:
14
+ raise ArgsNotAllowed()
15
+ return self.get_types(val[0])
16
+ def get_types(self, val):
17
+ if isinstance(val, list): # [] er bodole list
18
+ return "ARRAY"
19
+ elif isinstance(val, int):
20
+ return "INTEGER"
21
+ elif isinstance(val, dict):
22
+ return "HASHMAP"
23
+ elif isinstance(val, float):
24
+ return "FLOATING"
25
+ elif isinstance(val, str):
26
+ return "STRING"
27
+ else:
28
+ return None
29
+ def keys(self, val):
30
+ if len(val) != 1 or not isinstance(val[0], dict):
31
+ raise TypeNotAllowed()
32
+ return val[0].keys()
33
+ def values(self, val):
34
+ if len(val) != 1:
35
+ raise TypeNotAllowed()
36
+ return val[0].values()
37
+ def check(self, val):
38
+ if len(val)>1:
39
+ raise Exception()
40
+ def string(self, val):
41
+ if len(val) != 1:
42
+ raise TypeNotAllowed()
43
+ return str(val[0])
44
+ def number(self, val):
45
+ if len(val != 1):
46
+ raise TypeNotAllowed()
47
+ try:
48
+ return int(val[0])
49
+ except ValueError:
50
+ return float(val[0])
51
+ except ValueError:
52
+ raise TypeNotAllowed()
53
+ def ask(self, val):
54
+ if val[0]:
55
+ self.check(val)
56
+ a = input(val[0])
57
+ return a
58
+ return input()
59
+
60
+
61
+
62
+
63
+
64
+ #List methods
65
+ def push(self, val):
66
+ if len(val) != 2 or not isinstance(val[1], list):
67
+ raise TypeNotAllowed()
68
+ val[1].append(val[0])
69
+ def pop(self, val):
70
+ if len(val) != 2 or not isinstance(val[1], list):
71
+ raise TypeNotAllowed()
72
+ return val[0].pop()
73
+ #Dict methods
@@ -0,0 +1,86 @@
1
+ from ..Errors.runtime import RuntimeError, NotFoundError, AlreadyExistsError
2
+
3
+
4
+ class Env:
5
+ def __init__(self, parent=None):
6
+ self.vars = {}
7
+ self.funs = {}
8
+ self.parent = parent
9
+
10
+
11
+
12
+ def getDicEl(self, name):
13
+ if name in self.vars.keys():
14
+ return self.vars[name]
15
+ elif self.parent:
16
+ return self.parent.getDicEl(name)
17
+ else:
18
+ raise NotFoundError(f"Hash not found >> {name}")
19
+
20
+ def delitem(self, name):
21
+ if name in self.vars.keys():
22
+ del self.vars[name]
23
+ elif self.parent:
24
+ return self.parent.delitem(name)
25
+ else:
26
+ raise NotFoundError(f"Cannot delete the variable which does not exist >> {name}")
27
+
28
+ def defFun(self, name, works, params):
29
+ if name in self.funs.keys():
30
+ raise AlreadyExistsError(f"Function already exists yet >> {name}")
31
+ fun = {
32
+ "works": works,
33
+ "params": []
34
+ }
35
+ for i in params:
36
+ fun['params'].append(i.identifier)
37
+ self.funs[name] = fun
38
+
39
+ def getFun(self, name):
40
+ if name in self.funs.keys():
41
+ return self.funs[name]
42
+ elif self.parent:
43
+ return self.parent.getFun(name)
44
+ else:
45
+ raise NotFoundError(f"Function is not defined >> {name}(...)")
46
+ self.funs[name] = fun
47
+
48
+ def exists(self, name):
49
+ if name in self.vars:
50
+ return True
51
+ elif self.parent:
52
+ return self.parent.exists(name)
53
+ return False
54
+
55
+ def define(self, name, value):
56
+ if name in self.vars:
57
+ print(name, value)
58
+ raise RuntimeError(f"Variable already exists >> {name} assign instead of redeclar ")
59
+ self.vars[name] = value
60
+
61
+ def assign(self, name, value):
62
+ if name in self.vars:
63
+ self.vars[name] = value
64
+ elif self.parent:
65
+ self.parent.assign(name, value)
66
+ else:
67
+ raise NotFoundError(f"Variable not found to assign >> {name}")
68
+
69
+ def delete(self, name):
70
+ if name in self.vars:
71
+ del self.vars[name]
72
+ elif self.parent:
73
+ self.parent.delete(name)
74
+ else:
75
+ raise NotFoundError(f"Variable not found to delete >> {name}")
76
+
77
+ def get(self, name):
78
+ if name in self.vars:
79
+ return self.vars[name]
80
+ elif self.parent:
81
+ return self.parent.get(name)
82
+ else:
83
+ raise NotFoundError(f"Variable not found to access >> {name}")
84
+
85
+ def __str__(self):
86
+ return str(self.vars)