aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorc2024-01-28 20:15:35 -0500
committerc2024-01-28 20:15:35 -0500
commit422606d8b3cc6fba74f97af46f0378fc274d60ad (patch)
tree34314628de5e3132cffc661901bd1e4c9b2aa0de /src/include
parent87e0d4b3d23a7eb38f0e196eac333c318fef27ea (diff)
Fixed things.
- Fixed `parser_nxt_token()` assuming the existance of a parser's token. - Fixed block parsing.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/lexer.h2
-rw-r--r--src/include/parser.h17
-rw-r--r--src/include/pp.h2
-rw-r--r--src/include/tree.h2
4 files changed, 13 insertions, 10 deletions
diff --git a/src/include/lexer.h b/src/include/lexer.h
index 02275cb..5235f3b 100644
--- a/src/include/lexer.h
+++ b/src/include/lexer.h
@@ -23,7 +23,7 @@ typedef struct LEXER_STRUC {
/* Integer. */
LEXER_STATE_INT,
/* Keyword. */
- LEXER_STATE_KWD,
+ LEXER_STATE_KWD
} state;
/* The linked list of tokens generated. */
diff --git a/src/include/parser.h b/src/include/parser.h
index eae09d4..a442d60 100644
--- a/src/include/parser.h
+++ b/src/include/parser.h
@@ -14,7 +14,7 @@ typedef enum PARSER_STATE {
PARSER_STATE_DARG,
PARSER_STATE_CARG,
PARSER_STATE_DEF,
- PARSER_STATE_CALL,
+ PARSER_STATE_CALL
} parser_state_t;
typedef struct PARSER {
@@ -41,6 +41,15 @@ void parser_destroy(parser_t* parser);
/* Step the parser forward by 1 token. */
int parser_nxt_token(parser_t* parser);
+/* Get tree for first (implied) block. */
+tree_t* parser_parse_init(parser_t* parser);
+
+/* Get tree for a block. */
+tree_t* parser_parse_block(parser_t* parser);
+
+/* Get tree for an expression.*/
+tree_t* parser_parse_expr(parser_t* parser);
+
/*
Check whether the current token matches the given type.
- If it doesn't, return 0 and throw error.
@@ -56,12 +65,6 @@ tree_t* parser_parse_lint(parser_t* parser);
/* Return the tree for a string. */
tree_t* parser_parse_lstr(parser_t* parser);
-/* Return the tree for an expression.*/
-tree_t* parser_parse_expr(parser_t* parser);
-
-/* Return the tree for an block. */
-tree_t* parser_parse_block(parser_t* parser);
-
/* Return the tree for a definition's arguments. */
tree_t* parser_parse_darg(parser_t* parser);
diff --git a/src/include/pp.h b/src/include/pp.h
index 4186ef3..bbb901c 100644
--- a/src/include/pp.h
+++ b/src/include/pp.h
@@ -27,7 +27,7 @@ typedef struct PP_STRUC {
PP_STATE_REG, /* Regular. */
PP_STATE_STR, /* String. */
PP_STATE_COM, /* Comment. */
- PP_STATE_ESC, /* Escaped character in string. */
+ PP_STATE_ESC /* Escaped character in string. */
/* PP_STATE_MCO, */ /* Macro. */
} state;
} pp_t;
diff --git a/src/include/tree.h b/src/include/tree.h
index 31b8f3f..2a62f26 100644
--- a/src/include/tree.h
+++ b/src/include/tree.h
@@ -12,7 +12,7 @@ typedef enum TREE_TYPE {
TREE_TYPE_DARG,
TREE_TYPE_CARG,
TREE_TYPE_DEF,
- TREE_TYPE_CALL,
+ TREE_TYPE_CALL
} tree_type_t;
/* The Abstract Syntax Tree (AST) structure. */