Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit 1326ab4

Browse files
committed
Name changes and docstrings
1 parent 25564b6 commit 1326ab4

File tree

3 files changed

+51
-25
lines changed

3 files changed

+51
-25
lines changed

Main/_types.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
I Language types.
3-
Version: 0.1.1
3+
Version: 0.1.2
44
55
Copyright (c) 2023-present ElBe Development.
66
@@ -88,20 +88,6 @@ def __init__(self, value: str) -> None:
8888
super().__init__(value, _Any)
8989

9090

91-
class Array(BaseType):
92-
"""
93-
Array type.
94-
"""
95-
96-
def __init__(self, value: str) -> None:
97-
"""Initializes an array type.
98-
99-
:param value: Value of the object to check for array value.
100-
"""
101-
102-
super().__init__(value, builtins.list)
103-
104-
10591
@final
10692
class Bool(BaseType):
10793
"""
@@ -221,18 +207,32 @@ def __init__(self, value: str) -> None:
221207

222208

223209
@final
224-
class List(Array):
210+
class List(BaseType):
225211
"""
226-
Array type.
212+
List type.
227213
"""
228214

229215
def __init__(self, value: str) -> None:
230-
"""Initializes an array type.
216+
"""Initializes a list type.
231217
232-
:param value: Value of the object to check for array value.
218+
:param value: Value of the object to check for list value.
233219
"""
234220

235-
super().__init__(value)
221+
super().__init__(value, builtins.list)
222+
223+
224+
class Null(BaseType):
225+
"""
226+
None type.
227+
"""
228+
229+
def __init__(self, value: str) -> None:
230+
"""Initializes a none type.
231+
232+
:param value: Value of the object to check for none value.
233+
"""
234+
235+
super().__init__(value) # TODO (ElBe): Find null type
236236

237237

238238
class Str(BaseType):

Main/lexer.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
SEPARATORS: Final[List[str]] = [" ", "\t", "\n"]
4848
DOUBLE_MARKS: Final[Dict[str, str]] = {
4949
"==": "EQUAL",
50-
"===": "TYPE_EQUAL",
50+
"<=": "LESS_EQUALS",
51+
">=": "GREATER_EQUALS",
5152
"++": "COUNT_UP",
5253
"--": "COUNT_DOWN",
5354
}
@@ -88,7 +89,6 @@
8889
}
8990
BASE_TYPES: Final[List[str]] = [
9091
"any",
91-
"array",
9292
"bool",
9393
"complex",
9494
"dict",
@@ -100,8 +100,7 @@
100100
"list",
101101
"str",
102102
"string",
103-
"None",
104-
"Null",
103+
"null",
105104
]
106105

107106

Modules/Random.ilang

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import _core
3636
////////////////////
3737

3838
int randint(int minimum, int maximum) {
39+
3940
return _core.Random.randint(minimum, maximum)
4041
}
4142

@@ -44,8 +45,34 @@ int randint(int minimum, int maximum) {
4445
// CHOICES //
4546
/////////////
4647

48+
/*
49+
* Returns a random value from a given list.
50+
*
51+
* @params
52+
* iterable (list): List to return a random choice from.
53+
* choices (list): Choices to return form the iterable. If choices is bigger than the iterable, the remaining values will be skipped.
54+
*
55+
* @return
56+
* Any: Chosen object(s) from the iterable.
57+
*/
4758
function choices(list iterable, int choices = 1) {
4859
return _core.Random.choices(iterable, choices)
4960
}
5061

51-
// TODO (ElBe): Add shuffle
62+
63+
/////////////
64+
// SHUFFLE //
65+
/////////////
66+
67+
/*
68+
* Returns a shuffled version of the given list.
69+
*
70+
* @params
71+
* iterable (list): List to shuffle.
72+
*
73+
* @return
74+
* list: Shuffled list.
75+
*/
76+
list shuffle(list iterable) {
77+
return _code.Random.shuffle(iterable)
78+
}

0 commit comments

Comments
 (0)