diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-12-17 03:12:34 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-12-17 03:12:34 -0500 |
commit | c66148484cad66972348ffe850fd23bc9dca60f9 (patch) | |
tree | d4616778e980773a2ddb4e606f85193d51f4f71c /dimension/parse.h | |
parent | fb8fb378dcce0564085eb6222053a0db57eb480c (diff) | |
download | dimension-c66148484cad66972348ffe850fd23bc9dca60f9.tar.xz |
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.
Diffstat (limited to 'dimension/parse.h')
-rw-r--r-- | dimension/parse.h | 16 |
1 files changed, 15 insertions, 1 deletions
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 */ |