diff options
author | c | 2024-03-18 21:27:42 -0400 |
---|---|---|
committer | c | 2024-03-18 21:27:42 -0400 |
commit | 53d5c419bdfaa58c2cf7c30e51e4515f66fa85a1 (patch) | |
tree | a3c7ac2a0eb999a7a2770268df356c780e278161 /src/include | |
parent | aaf2ae7693e2b48358f7d3007aca9f0cb5f4950f (diff) |
Fixed bugs.
Keywords with numbers in them were being read as lints, forgot to add
numbers to allowed chars somehow.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/doer.h | 10 | ||||
-rw-r--r-- | src/include/syntax.h | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/include/doer.h b/src/include/doer.h index 314edc3..641abed 100644 --- a/src/include/doer.h +++ b/src/include/doer.h @@ -56,13 +56,16 @@ char* doer_eval_str(doer_t* doer); // `die`: dies. Does not accept any arguments, returns int (if a tree falls in // the forest, but it burns down before anyone can hear it, did it ever make a // sound at all?) TODO: Make this actually clean up afterwards. -void blin_die(doer_t* tree); +void blin_die(doer_t* doer); // `print`: print a string. -void blin_print(doer_t* tree); +void blin_print(doer_t* doer); static tree_type_t blin_print_args[] = { TREE_TYPE_LSTR }; // `printl`: print a string, and add a newline. -void blin_printl(doer_t* tree); +void blin_printl(doer_t* doer); static tree_type_t blin_printl_args[] = { TREE_TYPE_LSTR }; +// `to_str`: convert any (primitive) type to a string. +void blin_to_str(doer_t* doer); +static tree_type_t blin_to_str_args[] = { TREE_TYPE_CALL }; void doer_do_block(doer_t* tree); void doer_do_expr(doer_t* tree); @@ -78,6 +81,7 @@ static blinf_t blinfs[] = { { blin_die, TREE_TYPE_LINT, NULL, "die" }, { blin_print, TREE_TYPE_LSTR, blin_print_args, "print" }, { blin_printl, TREE_TYPE_LSTR, blin_printl_args, "printl" }, + { blin_to_str, TREE_TYPE_LSTR, blin_to_str_args, "to_str" }, }; #endif diff --git a/src/include/syntax.h b/src/include/syntax.h index 2938178..2645ca4 100644 --- a/src/include/syntax.h +++ b/src/include/syntax.h @@ -22,6 +22,6 @@ #define SYNTAX_ESC '\\' /* Characters that can appear in keywords. */ -#define SYNTAX_KWD_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_~|&+-/*<>=%^$@?" +#define SYNTAX_KWD_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_~|&+-/*<>=%^$@?0123456789" #endif |