diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-09-25 17:31:24 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-09-25 17:45:23 +0300 |
commit | 455e12faaf5efd997ff74ad04c0fcc62608477a5 (patch) | |
tree | 46d24aba487fb2ea76078ef4da60357ff0a340e4 /lib/forlangrm.y | |
parent | 2f5d961c798802f1e467de1cd310f661e0a45fa7 (diff) | |
download | eclat-455e12faaf5efd997ff74ad04c0fcc62608477a5.tar.gz eclat-455e12faaf5efd997ff74ad04c0fcc62608477a5.tar.bz2 |
Use forlan to format the output.
* lib/forlan.h (forlan_lex_begin): Remove
(forlan_lex_from_buffer)
(forlan_lex_from_file): New protos.
(forlan_parse): Remove.
(forlan_parse_bufferm,forlan_parse_file): New protos.
* lib/forlangrm.y (forlan_parse): Remove.
(forlan_parse_bufferm,forlan_parse_file): New functions.
* lib/forlanlex.l (YY_INPUT): Optionally, read input from file.
(forlan_lex_begin): Remove
(forlan_lex_from_buffer)
(forlan_lex_from_file): New functions.
* src/cmdline.opt: New options: --format, --sort
* src/config.c: New statement: format.
* src/eclat.c: Use output format scripts, if provided.
* src/eclat.conf: Define output format for DescribeTags.
* src/eclat.h: Include forlan.h
(define_format): New proto.
* tests/tforlan.c: New option: -s
Diffstat (limited to 'lib/forlangrm.y')
-rw-r--r-- | lib/forlangrm.y | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/forlangrm.y b/lib/forlangrm.y index e8e3436..6261c5e 100644 --- a/lib/forlangrm.y +++ b/lib/forlangrm.y @@ -385,12 +385,32 @@ forlan_parser() } forlan_eval_env_t -forlan_parse(const char *input, size_t length, struct grecs_locus_point *pt) +forlan_parse_buffer(const char *input, size_t length, + struct grecs_locus_point *pt) { int rc; forlan_eval_env_t env = NULL; - forlan_lex_begin(input, length, pt); + forlan_lex_from_buffer(input, length, pt); + rc = forlan_parser(); + forlan_lex_end(); + grecs_symtab_free(forlan_symtab); + forlan_symtab = NULL; + + if (rc == 0) + env = forlan_create_environment(forlan_parse_tree, + forlan_variable_count); + + return env; +} + +forlan_eval_env_t +forlan_parse_file(FILE *fp, struct grecs_locus_point *pt) +{ + int rc; + forlan_eval_env_t env = NULL; + + forlan_lex_from_file(fp, pt); rc = forlan_parser(); forlan_lex_end(); grecs_symtab_free(forlan_symtab); |