fix: token T and NIL

This commit is contained in:
Eatswap 2022-12-12 12:58:03 +08:00
parent 72a5daf94a
commit 568113ad84
Signed by: Eatswap
GPG Key ID: BE661106A1F3FA0B
2 changed files with 16 additions and 0 deletions

View File

@ -57,6 +57,8 @@ dotimes [dD][oO][tT][iI][mM][eE][sS]
dolist [dD][oO][lL][iI][sS][tT]
do [dD][oO]
aref [aA][rR][eE][fF]
t [tT]
nil [nN][iI][lL]
makearray [mM][aA][kK][eE][-][aA][rR][rR][aA][yY]
defconstant [dD][eE][fF][cC][oO][nN][sS][tT][aA][nN][tT]
@ -315,6 +317,16 @@ defconstant [dD][eE][fF][cC][oO][nN][sS][tT][aA][nN][tT]
return token::TOKEN_AREF;
};
{t} {
std::printf("Scanned t\n");
return token::TOKEN_T;
};
{nil} {
std::printf("Scanned nil\n");
return token::TOKEN_NIL;
};
{makearray} {
std::printf("Scanned makearray\n");
return token::TOKEN_MAKE_ARRAY;

View File

@ -84,6 +84,8 @@ namespace DragonLisp {
DOLIST "dolist"
DO "do"
AREF "aref"
T "t"
NIL "nil"
MAKE_ARRAY "make-array"
DEFCONSTANT "defconstant"
;
@ -136,6 +138,8 @@ R-Value
| FLOAT { std::printf("Parsed R-Value -> FLOAT\n"); }
| STRING { std::printf("Parsed R-Value -> STRING\n"); }
| array-ref { std::printf("Parsed R-Value -> array-ref\n"); }
| NIL { std::printf("Parsed R-Value -> NIL\n"); }
| T { std::printf("Parsed R-Value -> T\n"); }
;
R-Value-list