Compare commits
8 Commits
2474e0c773
...
dabd3fd86f
Author | SHA1 | Date | |
---|---|---|---|
dabd3fd86f | |||
ccf8f52b6e | |||
35c471f8d4 | |||
44fab4c678 | |||
bcc1569b39 | |||
5746ef1c5a | |||
2cab530eed | |||
7ac4eac37f |
@ -1,6 +1,6 @@
|
||||
#include "error.h"
|
||||
#include "lexer.h"
|
||||
#include "parser.h"
|
||||
#include "parser/parser.h"
|
||||
#include "tokenlist.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
11
src/parser.h
11
src/parser.h
@ -1,11 +0,0 @@
|
||||
#ifndef INCLUDE_SRC_PARSER_H_
|
||||
#define INCLUDE_SRC_PARSER_H_
|
||||
|
||||
#include "ast.h"
|
||||
#include "error.h"
|
||||
#include "parser_util.h"
|
||||
#include "tokenlist.h"
|
||||
|
||||
parse_result_t parse(tokenlist_entry_t *current);
|
||||
|
||||
#endif // INCLUDE_SRC_PARSER_H_
|
@ -1,4 +1,4 @@
|
||||
#include "parser_combinators.h"
|
||||
#include "combinators.h"
|
||||
|
||||
// Parse a list of the given parser delimited by the given token id. Does not
|
||||
// store the delimiters in the parent node
|
@ -1,4 +1,7 @@
|
||||
#include "parser_util.h"
|
||||
#ifndef INCLUDE_PARSER_COMBINATORS_H_
|
||||
#define INCLUDE_PARSER_COMBINATORS_H_
|
||||
|
||||
#include "util.h"
|
||||
|
||||
typedef parse_result_t (*parser_t)(tokenlist_entry_t *);
|
||||
|
||||
@ -18,3 +21,5 @@ parse_result_t parse_list(tokenlist_entry_t *current, node_id_t id,
|
||||
// wraps the parsed nodes in a new parent node.
|
||||
parse_result_t parse_consecutive(tokenlist_entry_t *current, node_id_t id,
|
||||
parser_t parsers[]);
|
||||
|
||||
#endif // INCLUDE_PARSER_COMBINATORS_H_
|
@ -1,10 +1,10 @@
|
||||
#include "parser.h"
|
||||
#include "ast.h"
|
||||
#include "lexer.h"
|
||||
#include "parser_combinators.h"
|
||||
#include "parser_primitives.h"
|
||||
#include "parser_util.h"
|
||||
#include "tokenlist.h"
|
||||
#include "../ast.h"
|
||||
#include "../lexer.h"
|
||||
#include "../tokenlist.h"
|
||||
#include "combinators.h"
|
||||
#include "primitives.h"
|
||||
#include "util.h"
|
||||
|
||||
parse_result_t parse_number(tokenlist_entry_t *current) {
|
||||
parser_t parsers[] = {parse_octal, parse_decimal, parse_hexadecimal,
|
9
src/parser/parser.h
Normal file
9
src/parser/parser.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef INCLUDE_PARSER_PARSER_H_
|
||||
#define INCLUDE_PARSER_PARSER_H_
|
||||
|
||||
#include "../tokenlist.h"
|
||||
#include "util.h"
|
||||
|
||||
parse_result_t parse(tokenlist_entry_t *current);
|
||||
|
||||
#endif // INCLUDE_PARSER_PARSER_H_
|
@ -1,5 +1,5 @@
|
||||
#include "parser_primitives.h"
|
||||
#include "ast.h"
|
||||
#include "primitives.h"
|
||||
#include "../ast.h"
|
||||
#include <string.h>
|
||||
|
||||
parse_result_t parse_identifier(tokenlist_entry_t *current) {
|
@ -1,7 +1,7 @@
|
||||
#ifndef INCLUDE_SRC_PARSER_PRIMITIVES_H_
|
||||
#define INCLUDE_SRC_PARSER_PRIMITIVES_H_
|
||||
#ifndef INCLUDE_PARSER_PRIMITIVES_H_
|
||||
#define INCLUDE_PARSER_PRIMITIVES_H_
|
||||
|
||||
#include "parser_util.h"
|
||||
#include "util.h"
|
||||
|
||||
parse_result_t parse_identifier(tokenlist_entry_t *current);
|
||||
parse_result_t parse_decimal(tokenlist_entry_t *current);
|
||||
@ -26,4 +26,4 @@ parse_result_t parse_dot(tokenlist_entry_t *current);
|
||||
parse_result_t parse_register(tokenlist_entry_t *current);
|
||||
parse_result_t parse_section(tokenlist_entry_t *current);
|
||||
|
||||
#endif // INCLUDE_SRC_PARSER_PRIMITIVES_H_
|
||||
#endif // INCLUDE_PARSER_PRIMITIVES_H_
|
@ -1,5 +1,5 @@
|
||||
#include "parser_util.h"
|
||||
#include "tokenlist.h"
|
||||
#include "util.h"
|
||||
#include "../tokenlist.h"
|
||||
|
||||
error_t *err_parse_no_match =
|
||||
&(error_t){.message = "parsing failed to find the correct token sequence"};
|
@ -1,9 +1,9 @@
|
||||
#ifndef INCLUDE_SRC_PARSER_UTIL_H_
|
||||
#define INCLUDE_SRC_PARSER_UTIL_H_
|
||||
#ifndef INCLUDE_PARSER_UTIL_H_
|
||||
#define INCLUDE_PARSER_UTIL_H_
|
||||
|
||||
#include "ast.h"
|
||||
#include "error.h"
|
||||
#include "tokenlist.h"
|
||||
#include "../ast.h"
|
||||
#include "../error.h"
|
||||
#include "../tokenlist.h"
|
||||
|
||||
typedef struct parse_result {
|
||||
error_t *err;
|
||||
@ -24,4 +24,4 @@ tokenlist_entry_t *skip_insignificant(tokenlist_entry_t *);
|
||||
|
||||
extern error_t *err_parse_no_match;
|
||||
|
||||
#endif // INCLUDE_SRC_PARSER_UTIL_H_
|
||||
#endif // INCLUDE_PARSER_UTIL_H_
|
Loading…
x
Reference in New Issue
Block a user