summaryrefslogtreecommitdiff
path: root/src/sys/np/core/np_lex.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-02 20:06:06 -0400
committerIan Moffett <ian@osmora.org>2025-10-02 20:06:06 -0400
commitc904bc2b78045bd81cfc3603422c385cbf7adc75 (patch)
treec5a0dd4b35a8ee69512b18c12f774b3699a24d0a /src/sys/np/core/np_lex.c
parentee1e4b1e7cce34ff049c5ee48c8bbeef6c6e5596 (diff)
kern: np: Add support for return statements
This commit introduces lexical, parsing and code generation support for the return statements. As of now, one is only able to return unsigned integers but this will be expanded upon in the future Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/np/core/np_lex.c')
-rw-r--r--src/sys/np/core/np_lex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sys/np/core/np_lex.c b/src/sys/np/core/np_lex.c
index 389f1e2..222feba 100644
--- a/src/sys/np/core/np_lex.c
+++ b/src/sys/np/core/np_lex.c
@@ -144,6 +144,11 @@ static int
lex_cmptok(char *tokstr, struct lex_token *res)
{
switch (*tokstr) {
+ case 'r':
+ if (strcmp(tokstr, TOKEN_RETURN) == 0) {
+ res->token = TT_RETURN;
+ }
+ return 0;
case 'b':
if (strcmp(tokstr, TOKEN_BEGIN) == 0) {
res->token = TT_BEGIN;