summaryrefslogtreecommitdiff
path: root/src/parsetree.h
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2019-05-24 08:26:26 -0400
committerAdrian Thurston <thurston@colm.net>2019-05-24 08:26:26 -0400
commite52169ed10b0bf0011c2471e1fa7644971d0c7ac (patch)
treedba77918021292531fe13a677e011101a408b13d /src/parsetree.h
parent984e6fb6cf25eee7dafe59db2be6b31b3c7c4b26 (diff)
downloadcolm-e52169ed10b0bf0011c2471e1fa7644971d0c7ac.tar.gz
pushing the trim decision to run-time
The trim and no-trim operators are both now in the expression. In places where we want the print mechanism to decide if it trims or not, we lift the trim operator out of the expression and into the send expression, then pass it to the print and send instructions. This way the stream or input (parser) can control the trim (auto_trim feature) with the expression overriding the default.
Diffstat (limited to 'src/parsetree.h')
-rw-r--r--src/parsetree.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/parsetree.h b/src/parsetree.h
index 599c16b7..4bf657d7 100644
--- a/src/parsetree.h
+++ b/src/parsetree.h
@@ -1734,6 +1734,12 @@ struct PatternItemList
struct ConsItem
{
+ enum Trim {
+ TrimYes,
+ TrimNo,
+ TrimDefault
+ };
+
enum Type {
InputText,
ExprType,
@@ -1747,7 +1753,7 @@ struct ConsItem
langEl(0),
prodEl(0),
bindId(-1),
- trim(false)
+ trim(TrimDefault)
{
}
@@ -1760,7 +1766,7 @@ struct ConsItem
return r;
}
- static ConsItem *cons( const InputLoc &loc, Type type, LangExpr *expr, bool trim )
+ static ConsItem *cons( const InputLoc &loc, Type type, LangExpr *expr, Trim trim )
{
ConsItem *r = new ConsItem;
r->loc = loc;
@@ -1787,7 +1793,8 @@ struct ConsItem
LangEl *langEl;
ProdEl *prodEl;
long bindId;
- bool trim;
+ Trim trim;
+
ConsItem *prev, *next;
};