More useful semantics for proper-quoted string literals.
This commit is contained in:
parent
dd5b1fa3bf
commit
a2ed74b1f9
3 changed files with 5 additions and 4 deletions
|
@ -864,11 +864,11 @@ that contains arbitrary text terminated by a sentinel.
|
|||
### Multi-terminal sugar ###
|
||||
|
||||
The syntax `“abc”` (with the proper, oriented, opening and closing quotation
|
||||
marks) is syntactic sugar for `"a" & "b" & "c"`.
|
||||
marks) is syntactic sugar for `"a" & "b" & "c" & return 'abc'`.
|
||||
|
||||
| main = “appar”.
|
||||
+ apparently
|
||||
= r
|
||||
= appar
|
||||
|
||||
| main = “appar”.
|
||||
+ apple
|
||||
|
|
|
@ -71,7 +71,8 @@ tamsin_parser {
|
|||
return call(prodref('$', return), list(atom(T), nil))
|
||||
| pq_string → T &
|
||||
$:unquote(T, '“', '”') → T &
|
||||
expect_chars(T) → E & return E
|
||||
expect_chars(T) → E &
|
||||
return and(E, call(prodref('$', return), list(atom(T), nil)))
|
||||
| prodref → P &
|
||||
L ← nil &
|
||||
["(" &
|
||||
|
|
|
@ -179,7 +179,7 @@ class Parser(EventProducer):
|
|||
node = expect
|
||||
else:
|
||||
node = And(node, expect)
|
||||
return node
|
||||
return And(node, Call(Prodref('$', 'return'), [AtomNode(s)]))
|
||||
elif self.consume(u'«') or self.consume('<<'):
|
||||
t = self.texpr()
|
||||
if self.consume(u'»') or self.consume('>>'):
|
||||
|
|
Loading…
Add table
Reference in a new issue