diff options
author | Adrian Thurston <thurston@colm.net> | 2021-01-03 20:41:50 -0800 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2021-01-03 22:11:06 -0800 |
commit | 0887c4d577545e47820df4389b5be81fe2fee0c3 (patch) | |
tree | 4abe26a3c20ab24611be339d03b4ecff17d0f570 /test | |
parent | c086031208751d26f09d6177e6bb82923dc852fa (diff) | |
download | colm-0887c4d577545e47820df4389b5be81fe2fee0c3.tar.gz |
various refcount fixes
- added downref when undoing a tree push
- using correct opcode for undoing pushing stream
- added an upref when sending back ignored trees
Diffstat (limited to 'test')
-rw-r--r-- | test/colm.d/balance1.lm | 33 | ||||
-rw-r--r-- | test/colm.d/balance2.lm | 38 | ||||
-rw-r--r-- | test/colm.d/balance3.lm | 32 |
3 files changed, 103 insertions, 0 deletions
diff --git a/test/colm.d/balance1.lm b/test/colm.d/balance1.lm new file mode 100644 index 00000000..e5ec8e6b --- /dev/null +++ b/test/colm.d/balance1.lm @@ -0,0 +1,33 @@ +lex + token id /[a-z]+/ + ignore /[ \t\n]/ + + literal `; + + token PLUS /'+'/ { + input->pull( match_length ) + + parse S: stmt "there is more;" + input->push( S ) + input->push( "; " ) + } +end + +def stmt + [id* `;] + +def main + [stmt+] + +parse M: main [stdin] + +print + "parsed tree + [M] + "<- +##### IN ##### +a b + c d; +##### EXP ##### +parsed tree +a b ; there is more; c d; +<- diff --git a/test/colm.d/balance2.lm b/test/colm.d/balance2.lm new file mode 100644 index 00000000..962df3cb --- /dev/null +++ b/test/colm.d/balance2.lm @@ -0,0 +1,38 @@ +lex + token id /[a-z]+/ + ignore WS /[ \t\n]/ + + literal `; `! `@ + + token PLUS /'+'/ { + # input->pull( match_length ) + input->push_ignore( make_token( typeid<WS>, input->pull(match_length) ) ) + + parse S: stmt "there is more;" + input->push( S ) + input->push( "; " ) + } +end + +def E1 [] +def E2 [] + +def stmt + [id* `;] + +def main + [E1 stmt+ `!] +| [E2 stmt+ `@] + +parse M: main [stdin] + +print + "parsed tree + [M] + "<- +##### IN ##### +a b + c d; @ +##### EXP ##### +parsed tree +a b ; there is more;+ c d; @ +<- diff --git a/test/colm.d/balance3.lm b/test/colm.d/balance3.lm new file mode 100644 index 00000000..aae049b7 --- /dev/null +++ b/test/colm.d/balance3.lm @@ -0,0 +1,32 @@ +lex + token id /[a-z]+/ + ignore /[ \t\n]/ + + literal `; + + token PLUS /'+'/ { + input->pull( match_length ) + + parse M: main "there is more;" + input->push( M ) + input->push( "; " ) + } +end + +def stmt + [id* `;] + +def main + [stmt+] + +parse M: main [stdin] + +print + "parsed tree + [M] + "<- +##### IN ##### +a b + c d; @ +##### EXP ##### +parsed tree +NIL<- |