diff options
author | Adrian Thurston <thurston@colm.net> | 2020-12-22 15:24:51 -0800 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2020-12-23 08:25:28 -0800 |
commit | b8827e38f676a9eb45a1120ecd0b0d7d7e454e57 (patch) | |
tree | cfc30685ca51a7b98b8c90fe9d49b9d8408310af /src/parsetree.h | |
parent | e2408c401b3f82742f7b7c03ff1ef5f461081e22 (diff) | |
download | colm-b8827e38f676a9eb45a1120ecd0b0d7d7e454e57.tar.gz |
added with_ignore(tree) iterator
This is identical to the basic tree iterator, except it visits ignore tokens.
This makes it possible to rewrite comments, albeit, primitively. Constructors
for tokens don't work right. Though we can set the data field.
The following code can be used to turn comments into newlines:
for I1: comment in with_ignore(Flux) {
I1.data = "\n"
}
Diffstat (limited to 'src/parsetree.h')
-rw-r--r-- | src/parsetree.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/parsetree.h b/src/parsetree.h index 1890bbae..14e92c24 100644 --- a/src/parsetree.h +++ b/src/parsetree.h @@ -1934,7 +1934,7 @@ struct IterDef { enum Type { Tree, Child, RevChild, Repeat, RevRepeat, User, ListEl, - RevListVal, MapEl }; + RevListVal, MapEl, WithIgnore }; IterDef( Type type, Function *func ); IterDef( Type type ); @@ -1948,7 +1948,7 @@ struct IterImpl { enum Type { Tree, Child, RevChild, Repeat, RevRepeat, User, ListEl, ListVal, - RevListVal, MapEl, MapVal }; + RevListVal, MapEl, MapVal, WithIgnore }; IterImpl( Type type, Function *func ); IterImpl( Type type ); |