Add array indexing

This commit is contained in:
Smaug123
2024-01-22 22:43:44 +00:00
parent 04edaf65ed
commit 8cee6accf9
5 changed files with 90 additions and 16 deletions

View File

@@ -28,6 +28,9 @@ module Lexer =
yield Token.standalone TokenType.ConstInt startI (i - startI)
| _, ' ' -> i <- i + 1
| _, '.' when i < s.Length - 1 && s.[i + 1] = '[' ->
yield Token.standalone TokenType.ArrayIndex i 2
i <- i + 2
| _, 'i' when i < s.Length - 1 && s.[i + 1] = 'f' ->
yield Token.standalone TokenType.If i 2
i <- i + 2