diff options
author | Adrian Thurston <thurston@colm.net> | 2019-12-29 13:35:05 +0200 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2019-12-29 14:30:40 +0200 |
commit | a0c5737f8452816c9a2ca2c91f4a3d889334ac97 (patch) | |
tree | dcb36b50a80925271bfda96d419d310c7318311d /test | |
parent | eec9b98d955cd3641216537f1d948559ed040d45 (diff) | |
download | colm-a0c5737f8452816c9a2ca2c91f4a3d889334ac97.tar.gz |
colm: fixes for backtracking in constructors and patterns
Backtracking in across literal blocks had a minor fault in constructors and was
fully missing from patterns. Both fixed with this commit. refs #86
Diffstat (limited to 'test')
-rw-r--r-- | test/colm.d/btpat1.lm | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/colm.d/btpat1.lm b/test/colm.d/btpat1.lm new file mode 100644 index 00000000..0c87832c --- /dev/null +++ b/test/colm.d/btpat1.lm @@ -0,0 +1,44 @@ +lex + token DEF / 'def' / + token id / ( 'a' .. 'z' ) + / + token SQOPEN /'['/ + token SQCLOSE /']'/ + token COLON /':'/ + token FOIL /'!'/ + ignore / ( '\n' | ' ' )+ / +end + +def opt_prod_el_name + [id COLON] +| [] + +def prod_el + [opt_prod_el_name id] + +def prod + [SQOPEN prod_el SQCLOSE] + +def E [] + +def item + [DEF] | [id] | [SQOPEN] | [SQCLOSE] | [COLON] + +def cfl_def + [E item* FOIL] +| [DEF id prod] + +parse Id: id + [stdin] + +cons Def: cfl_def + "def x \[[Id]\]" + +match Def + "def x \[[id]\] + +print [xml(Def) "\n"] + +##### IN ##### +y +##### EXP #### +<cfl_def><DEF>def</DEF><id>x</id><prod><SQOPEN>[</SQOPEN><prod_el><opt_prod_el_name></opt_prod_el_name><id>y</id></prod_el><SQCLOSE>]</SQCLOSE></prod></cfl_def> |