I changed the tokenizer to allow string literals to span more than one line:
src := "
Int f()
{
return 3
}"
andyMon 5 Jun 2006
So are newlines part of the string?
src := "\nInt f()\n{\n.." // is this equiv?
And how is leading whitespace treated?
"Int f()" or " Int f()"
brianMon 5 Jun 2006
Whitespace is significant
brianMon 5 Jun 2006
I have string interpolation working! You can embed arbitrary expressions inside a string literal using ${}. Use \$ to get an actual dollar sign. I also allow a shortcut to leave off the {} for dotted identifiers:
x := 15
"\$x" -> $x
"$x" -> 15
"$x.toHex" -> f
"$x+2" -> 15+2
"${x+2}" -> 17
The implementation is based on the tokenizer creating virtual tokens to make interpolation look like long hand:
brian Sun 4 Jun 2006
I changed the tokenizer to allow string literals to span more than one line:
andy Mon 5 Jun 2006
So are newlines part of the string?
And how is leading whitespace treated?
brian Mon 5 Jun 2006
Whitespace is significant
brian Mon 5 Jun 2006
I have string interpolation working! You can embed arbitrary expressions inside a string literal using ${}. Use \$ to get an actual dollar sign. I also allow a shortcut to leave off the {} for dotted identifiers:
The implementation is based on the tokenizer creating virtual tokens to make interpolation look like long hand: