summaryrefslogtreecommitdiff
path: root/src/parsetree.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2014-01-14 21:16:13 -0500
committerAdrian Thurston <thurston@complang.org>2014-01-14 21:16:13 -0500
commit02ce09a1e32a178707d6699bf2555ff8b164188c (patch)
tree2c3df4739a3cc1e413b7a218ad71ccf948e349d4 /src/parsetree.cc
parentcacdac00b74cb4e84eb6f1cc302cae5393564f6e (diff)
downloadcolm-02ce09a1e32a178707d6699bf2555ff8b164188c.tar.gz
don't interpret \ as escape in backtick literals
Diffstat (limited to 'src/parsetree.cc')
-rw-r--r--src/parsetree.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/parsetree.cc b/src/parsetree.cc
index cb522063..cfc0b52a 100644
--- a/src/parsetree.cc
+++ b/src/parsetree.cc
@@ -50,11 +50,12 @@ void prepareLitString( String &result, bool &caseInsensitive,
char *src = srcString.data + 1;
char *end = 0;
+ bool backtick = srcString[0] == '`';
- if ( srcString.data[0] != '`' ) {
+ if ( !backtick ) {
end = srcString.data + srcString.length() - 1;
- while ( *end != '\'' && *end != '\"' && *end != '`' && *end != '\n' ) {
+ while ( *end != '\'' && *end != '\"' && *end != '\n' ) {
if ( *end == 'i' )
caseInsensitive = true;
else {
@@ -74,7 +75,7 @@ void prepareLitString( String &result, bool &caseInsensitive,
char *dest = result.data;
int len = 0;
while ( src != end ) {
- if ( *src == '\\' ) {
+ if ( !backtick && *src == '\\' ) {
switch ( src[1] ) {
case '0': dest[len++] = '\0'; break;
case 'a': dest[len++] = '\a'; break;