Skip to content

Commit 80f18e8

Browse files
authored
Fix conditional statements (#32)
* Fix conditional statements * Update tokenizer.ts
1 parent ef683df commit 80f18e8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class Parser {
141141
const startToken = this.peek();
142142
const statements: Stmt[] = [];
143143
while (!this.isAtEnd()) {
144-
if (this.match(TokenType.NEWLINE)) {
144+
if (this.match(TokenType.NEWLINE) || this.match(TokenType.DEDENT)) {
145145
continue;
146146
}
147147
statements.push(this.stmt());

src/tokenizer.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,19 @@ export class Tokenizer {
265265
while (this.isDigit(this.peek())) {
266266
this.advance();
267267
}
268+
269+
if (this.peek() !== '.' && this.peek() !== 'e') {
270+
this.addToken(TokenType.BIGINT);
271+
return;
272+
}
273+
268274
if (this.peek() === '.') {
269275
this.advance();
270276
while (this.isDigit(this.peek())) {
271277
this.advance();
272278
}
273279
}
280+
274281
if (this.peek() === 'e') {
275282
this.advance();
276283
if (this.peek() === '-') {

0 commit comments

Comments
 (0)