Compare commits
No commits in common. "a77da74da52e5436ac423a9e00eb4c8f7e927dd7" and "9e68c529bf02094994337f1dfb255a4de0361940" have entirely different histories.
a77da74da5
...
9e68c529bf
@ -1,10 +0,0 @@
|
|||||||
import sys
|
|
||||||
|
|
||||||
from ppp_lexer import Lexer
|
|
||||||
from ppp_tokens import EofToken
|
|
||||||
|
|
||||||
_program, file_path = sys.argv
|
|
||||||
|
|
||||||
lexer = Lexer.from_file(file_path)
|
|
||||||
|
|
||||||
while not lexer.check_token(EofToken()): print(lexer.next_token())
|
|
@ -1,5 +0,0 @@
|
|||||||
a: (int, int) = (0, 1);
|
|
||||||
for i in range(0, 100) {
|
|
||||||
a = (a[1], a[0] + a[1]);
|
|
||||||
print(int_to_str(a[0])+"\n");
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
print("Hello, World!\n");
|
|
@ -60,9 +60,9 @@ class Lexer:
|
|||||||
return self._token(loc, word, IdentifierToken(word))
|
return self._token(loc, word, IdentifierToken(word))
|
||||||
case '"':
|
case '"':
|
||||||
# TODO: Proper escaping
|
# TODO: Proper escaping
|
||||||
loc = self._loc()
|
|
||||||
self._advance()
|
self._advance()
|
||||||
start_location = self._location
|
start_location = self._location
|
||||||
|
loc = self._loc()
|
||||||
escaping = False
|
escaping = False
|
||||||
while self._location < len(self._source) and (self._source[self._location] != '"' or escaping):
|
while self._location < len(self._source) and (self._source[self._location] != '"' or escaping):
|
||||||
escaping = self._source[self._location] == '\\' if not escaping else False
|
escaping = self._source[self._location] == '\\' if not escaping else False
|
||||||
|
@ -106,6 +106,3 @@ class Token:
|
|||||||
loc: Location
|
loc: Location
|
||||||
value: str
|
value: str
|
||||||
contents: TokenContents
|
contents: TokenContents
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
|
||||||
return f"{self.loc}: {self.contents}"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user