summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2023-06-18 00:14:13 -0700
committerKai Stevenson <kai@kaistevenson.com>2023-06-18 00:14:13 -0700
commit8b541b2eab8169e39ce59964b367f9c20f7cf49b (patch)
treee822d41523faf1f9794fe27fb0c09d5c2c9cb544
parent484898d4efdab6d8cff3a887601d5a612034ce0f (diff)
added more alternatives for tokens in lexer
-rw-r--r--src/lexer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lexer.c b/src/lexer.c
index 906af85..3b221b6 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -102,15 +102,15 @@ token_t lex_first_token(char** content) {
return lex_first_int(content);
}
/* otherwise, check to see if a symbol has been matched */
- if (strcmp(s, "(") == 0) {
+ if (strcmp(s, "(") == 0 || strcmp(s, "[") == 0 || strcmp(s, "{") == 0) {
free(s);
return init_token(OPEN_PAREN, NULL);
}
- else if (strcmp(s, ")") == 0) {
+ else if (strcmp(s, ")") == 0 || strcmp(s, "]") == 0 || strcmp(s, "}") == 0) {
free(s);
return init_token(CLOSE_PAREN, NULL);
}
- else if (strcmp(s, "#") == 0) {
+ else if (strcmp(s, "#") == 0 || strcmp(s, "//") == 0) {
free(s);
return init_token(START_COMMENT, NULL);
}
@@ -118,11 +118,11 @@ token_t lex_first_token(char** content) {
free(s);
return init_token(INDENT, NULL);
}
- else if (strcmp(s, "?") == 0) {
+ else if (strcmp(s, "?") == 0 || strcmp(s, "x") == 0) {
free(s);
return init_token(CONTRADICTION, NULL);
}
- else if (strcmp(s, "|") == 0) {
+ else if (strcmp(s, "|") == 0 || strcmp(s, ":") == 0) {
free(s);
return init_token(JUSTIFICATION, NULL);
}
@@ -158,7 +158,7 @@ token_t lex_first_token(char** content) {
free(s);
return init_token(IMPLICATION, NULL);
}
- else if (strcmp(s, "<-") == 0) {
+ else if (strcmp(s, "<->") == 0) {
free(s);
return init_token(BI_IMPLICATION, NULL);
}