diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-10-06 22:20:16 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-10-06 22:20:16 -0700 |
commit | 5ab2b46a0f5d6c73b6e81a0efc47c29d29928966 (patch) | |
tree | 3d1c0c229308c7c6da8ee84938124275e3beb814 /lib.c | |
parent | 9776ad45285a46cacd5fc7288489d374f6480f37 (diff) | |
download | txr-5ab2b46a0f5d6c73b6e81a0efc47c29d29928966.tar.gz txr-5ab2b46a0f5d6c73b6e81a0efc47c29d29928966.tar.bz2 txr-5ab2b46a0f5d6c73b6e81a0efc47c29d29928966.zip |
Extending syntax to allow for @VAR and @(...) forms inside
nested lists. This is in anticipation of future features.
* lib.c (expr_s): New symbol variable.
(obj_init): expr_s initialized.
* lib.h (expr_s): Declared.
* match.c (dest_bind): Now takes linenum. Tests for the meta-syntax
denoted by the system symbols var_s and expr_s, and throws an
error.
(eval_form): Similar error checks added. Also, hack: do not add
file and line number to an exception which begins with a '('
character; just re-throw it. This suppresses duplicate line
number addition when this throw occurs across some nestings.
(match_files): Updated calls to dest_bind.
* parser.l (yybadtoken): Handle new token kind, METAVAR and METAPAR.
(grammar): Refactoring among patterns: TOK broken into
SYM and NUM, NTOK introduced, unused NUM_END removed.
Rule for @( producing METAPAR in nested state.
* parser.y (METAVAR, METAPAR): New tokens.
(meta_expr): New nonterminal.
(expr): meta_expr and META_VAR productions handled.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -52,7 +52,7 @@ val system_package, keyword_package, user_package; val null, t, cons_s, str_s, chr_s, num_s, sym_s, pkg_s, fun_s, vec_s; val stream_s, hash_s, hash_iter_s, lcons_s, lstr_s, cobj_s; -val var_s, regex_s, chset_s, set_s, cset_s, wild_s, oneplus_s; +val var_s, expr_s, regex_s, chset_s, set_s, cset_s, wild_s, oneplus_s; val nongreedy_s, compiled_regex_s; val zeroplus_s, optional_s, compl_s, compound_s, or_s, and_s, quasi_s; val skip_s, trailer_s, block_s, next_s, freeform_s, fail_s, accept_s; @@ -2165,6 +2165,7 @@ static void obj_init(void) lstr_s = intern(lit("lstr"), user_package); cobj_s = intern(lit("cobj"), user_package); var_s = intern(lit("var"), system_package); + expr_s = intern(lit("expr"), system_package); regex_s = intern(lit("regex"), system_package); nongreedy_s = intern(lit("nongreedy"), system_package); compiled_regex_s = intern(lit("compiled-regex"), system_package); |