From c904bc2b78045bd81cfc3603422c385cbf7adc75 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 2 Oct 2025 20:06:06 -0400 Subject: 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 --- src/sys/np/core/np_lex.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/sys/np/core/np_lex.c') 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; -- cgit v1.2.3