From c66148484cad66972348ffe850fd23bc9dca60f9 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 17 Dec 2009 03:12:34 -0500 Subject: Tokenize on-the-fly. No more manual tokenization and parsing, giving a simpler interface. Also, this brings us closer to a dmnsn_realize_string() interface. --- dimension/parse.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'dimension/parse.h') diff --git a/dimension/parse.h b/dimension/parse.h index d6c6b0e..3ea073f 100644 --- a/dimension/parse.h +++ b/dimension/parse.h @@ -79,7 +79,7 @@ struct dmnsn_astnode { }; /* The workhorse */ -dmnsn_array *dmnsn_parse(const dmnsn_array *tokens); +dmnsn_array *dmnsn_parse(FILE *file, const char *filename); /* Free an abstract syntax tree */ void dmnsn_delete_astree(dmnsn_array *astree); @@ -94,4 +94,18 @@ void dmnsn_print_astree_sexpr(FILE *file, const dmnsn_array *astree); /* Returns a readable name for a token type (ex. DMNSN_T_FLOAT -> float) */ const char *dmnsn_astnode_string(dmnsn_astnode_type astnode_type); +/* Parser internals */ + +typedef struct dmnsn_parse_location { + const char *first_filename, *last_filename; + int first_line, last_line; + int first_column, last_column; +} dmnsn_parse_location; + +typedef union dmnsn_parse_item { + char *value; + dmnsn_astnode astnode; +} dmnsn_parse_item; + + #endif /* PARSE_H */ -- cgit v1.2.3