Skip to content

Commit 5bc5f1b

Browse files
committed
support for tabs, support for comments
1 parent a62f42b commit 5bc5f1b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

fib.crabox

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
inc r1
1+
; PROGRAM TO CALCULATE THE FIBONACCI SEQUENCE
2+
inc r1 ; 1
23
store r1
3-
inc ap
4+
inc ap ; 1
45
store r1
6+
; FIBONACCI FROM THE 3RD NUMBER ON
57
inc ap
68
dec ap
79
dec ap

source/lexer.d

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ struct Lexer
2828
case '\n':
2929
tokens ~= Token(TokenType.eol, "\n");
3030
break;
31-
case ' ':
31+
case ';':
32+
current++;
33+
while (current < source.length && source[current] != '\n')
34+
{
35+
current++;
36+
}
37+
current--;
38+
break;
39+
case ' ', '\t':
3240
break;
3341
case 'a': .. case 'z':
3442
string value = "";

0 commit comments

Comments
 (0)