#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Tue, 25 Feb 2020 13:40:53 +0100
changeset 4644 117a8f63f3f8
parent 4643 e305b814a348
child 4645 593fe39d4cf1
#BUGFIX by cg class: Parser changed: #stringWithEmbeddedExpressions
Parser.st
--- a/Parser.st	Tue Feb 25 13:40:16 2020 +0100
+++ b/Parser.st	Tue Feb 25 13:40:53 2020 +0100
@@ -9221,31 +9221,44 @@
 !
 
 stringWithEmbeddedExpressions
-    |expressions collectedString pos1 pos2 receiver node lNr|
-
-    pos1 := tokenPosition.
+    |expressions collectedString pos1 pos2 fragPos receiver node lNr|
+
+    pos1 := fragPos := tokenPosition.
     lNr := tokenLineNr.
     expressions := OrderedCollection new.
     collectedString := ''.
     [tokenType == #StringFragment] whileTrue:[ 
         |expr|
 
+        self markStringFrom:fragPos to:source position-1.
+        parenthesisLevel := parenthesisLevel + 1.
+        self markParenthesisAt:source position.
+
         collectedString := collectedString,tokenValue.
         self nextToken.
         expr := self expression.
+        expr == #Error ifTrue:[
+            self parseError:'error in embedded expression'.
+        ].
         "/ there must be a closing brace
         tokenType == $} ifFalse:[
             self parseError:'"}" expected after embedded expression'.
         ]. 
+        self markParenthesisAt:tokenPosition.
+        parenthesisLevel := parenthesisLevel - 1.
+
         expressions add:expr.
         collectedString := collectedString,'%(',expressions size asString,')'.
+        fragPos := source position+1.
         self continueEscapedString.
     ].
     pos2 := tokenPosition.
     
     tokenType == #String ifFalse:[
         self parseError:'unterminated embedded expression string'.
-    ].    
+    ].
+    self markStringFrom:fragPos to:source position-1.
+
     collectedString := collectedString,tokenValue.
     self nextToken.