summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-06-28 17:51:30 -0400
committerAdrian Thurston <thurston@complang.org>2015-06-28 17:51:30 -0400
commit16e9e149c06e7407afe57fac0072bb4c35e8cb80 (patch)
treeeb5512b344a6b3a5cee3fdbd76ad6d03b127b96f
parentefa48c2c34d3f7b4cfd91ea5c06897531270c69d (diff)
downloadcolm-16e9e149c06e7407afe57fac0072bb4c35e8cb80.tar.gz
don't trim trees when sending to parser, identical to stream send
Need to have stream and parser send function identically since we want them interchangable.
-rw-r--r--src/synthesis.cc2
-rw-r--r--test/print1.lm3
-rw-r--r--test/send1.lm22
3 files changed, 19 insertions, 8 deletions
diff --git a/src/synthesis.cc b/src/synthesis.cc
index 558ea6b6..36f781b5 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -1621,7 +1621,7 @@ void LangTerm::evaluateSendParser( Compiler *pd, CodeVect &code, bool strings )
ut->langEl != pd->strLangEl && ut != pd->uniqueTypeStream )
{
/* Convert it to a string. */
- code.append( IN_TREE_TO_STR_TRIM );
+ code.append( IN_TREE_TO_STR );
}
break;
}
diff --git a/test/print1.lm b/test/print1.lm
index c5f25f79..c43fae84 100644
--- a/test/print1.lm
+++ b/test/print1.lm
@@ -31,5 +31,6 @@ send_tree StartParser2
print [StartParser1->tree]
print [StartParser2->tree "\n"]
######### EXP #########
-a b c d
+a b
+ c d
NIL
diff --git a/test/send1.lm b/test/send1.lm
index 800df9f2..c1091d65 100644
--- a/test/send1.lm
+++ b/test/send1.lm
@@ -4,32 +4,42 @@ lex
token id /[a-zA-Z_]+/
end
-def item
+def item1
[id]
-| [`( item* `)]
+| [`( item1* `)]
def item2
[id]
| [`( item2* `)]
def start
- [item*]
+ [item1*]
StartParser1: parser<start> = new parser<start>()
StartParser2: parser<start> = new parser<start>()
+StartParser3: parser<start> = new parser<start>()
+parse Item1: item1 "b
parse Item2: item2 "b
# Success.
send StartParser1
"a [Item2] c d\n" eos
-# Failure.
+# Success.
send_tree StartParser2
+ "a [Item1] c d\n" eos
+
+# Failure.
+send_tree StartParser3
"a [Item2] c d\n" eos
print( StartParser1->tree )
-print( StartParser2->tree, "\n" )
+print( StartParser2->tree )
+print( StartParser3->tree, "\n" )
######### EXP #########
-a b c d
+a b
+ c d
+a b
+ c d
NIL