From f4b04a1b8cd882e25fee592c819650c9b7e8566b Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 18 Aug 2024 14:44:15 -0400 Subject: Improved syntax for dollar-string literals --- test/lang.tm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/lang.tm') diff --git a/test/lang.tm b/test/lang.tm index 01551e27..dfe1c663 100644 --- a/test/lang.tm +++ b/test/lang.tm @@ -1,5 +1,5 @@ lang HTML: - HEADER := $HTML$"" + HEADER := $HTML"" func escape(t:Text)->HTML: t = t:replace("&", "&") t = t:replace("<", "<") @@ -9,25 +9,25 @@ lang HTML: return HTML.from_unsafe_text(t) func escape_int(i:Int)->HTML: - return HTML.from_unsafe_text("{i}") + return HTML.from_unsafe_text("$i") func paragraph(content:HTML)->HTML: - return $HTML$"

$content

" + return $HTML"

$content

" func main(): >> HTML.HEADER = $HTML"" >> user := "I <3 hax" - >> html := $HTML$"Hello $user!" + >> html := $HTML"Hello $user!" = $HTML"Hello I <3 hax!" - >> html ++ $HTML$"
" + >> html ++ $HTML"
" = $HTML"Hello I <3 hax!
" - >> $HTML{}"{1 + 2}" + >> $HTML"$(1 + 2)" = $HTML"3" - >> $HTML{}"{3_i8}" + >> $HTML"$(3_i8)" = $HTML"3" >> html:paragraph() -- cgit v1.2.3