Skip to content

Commit

Permalink
Further speed up for compilation of string interpolation (StrategoXT/…
Browse files Browse the repository at this point in the history
…896)
  • Loading branch information
vvergu committed Nov 6, 2013
1 parent b0a4668 commit b869015
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 8 additions & 1 deletion strategoxt/stratego-libraries/lib/spec/term/string.str
Expand Up @@ -1337,6 +1337,13 @@ strategies
; prim("SSL_stacktrace_get_all_frame_names",|); ?[ _ | y]
; !y
; report-failure(|"Internal error: escaped term in string quotation is not a string", x)
}
}

/**
* @internal
* Used by desugaring of string interpolation $[... [x] ...]
*/
internal-string-interpolation(|t, padded_s) = <internal-ensure-as-string; string-replace(|"\n", padded_s)> t



Expand Up @@ -141,9 +141,7 @@ strategies
* Adjust padding of quoted string escapes.
*/
string-escape-padd(|n) :
StringEscape1(s, t) -> <desugar> Term |[
<!t; internal-ensure-as-string(|); string-replace(|"\n", ~str:s_padded {^[]})>
]|
StringEscape1(s, t) -> <desugar> Term |[ <internal-string-interpolation(|t, ~str:s_padded)> ]|
with
s_padded := <string-as-chars(!['\n' | <remove-padding-single-line(|n)>])> s

Expand Down
4 changes: 4 additions & 0 deletions strategoxt/test.sh
@@ -0,0 +1,4 @@
#! /bin/sh

./build.sh
ANT_OPTS="-Xss8m -Xmx1024m" ant -lib dist/share/strategoxt/strategoxt.jar test

0 comments on commit b869015

Please sign in to comment.