Skip to content

Commit 809488c

Browse files
committed
new builtin function escape
1 parent cdd0246 commit 809488c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

winxedst0.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// winxedst0.cpp
2-
// Revision 4-jun-2011
2+
// Revision 6-jul-2011
33

44
// Winxed compiler stage 0.
55

@@ -462,6 +462,9 @@ const PredefFunction *PredefFunction::predefs[]= {
462462
new PredefFunctionFixargs("indexof",
463463
"index {res}, {arg0}, {arg1}, {arg2}",
464464
REGint, REGstring, REGstring, REGint),
465+
new PredefFunctionFixargs("escape",
466+
"escape {res}, {arg0}",
467+
REGstring, REGstring),
465468
new PredefFunctionFixargs("upcase",
466469
"upcase {res}, {arg0}",
467470
REGstring, REGstring),

winxedst1.winxed

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ class TokenQuoted : TokenString
331331
break;
332332
}
333333
}
334-
${ escape str, strunesc };
334+
str = escape(strunesc);
335335
string encoding = need_encoding ? "utf8:" : "";
336336
return encoding + '"' + str + '"';
337337
}
@@ -1494,6 +1494,10 @@ trans_encoding %0, $S0, $I0
14941494
'join %0, %1, %2',
14951495
REGstring, REGstring, REGvar
14961496
),
1497+
new PredefFunction('escape',
1498+
'escape %0, %1',
1499+
REGstring, REGstring
1500+
),
14971501
new PredefFunction('upcase',
14981502
'upcase %0, %1',
14991503
REGstring, REGstring

0 commit comments

Comments
 (0)