This commit is contained in:
parent
c5cc20572a
commit
d5a2d9205d
|
|
@ -489,11 +489,21 @@ namespace GPPGParserScanner
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
string str2 = sb.ToString();
|
||||
if (str2.Trim().EndsWith("{"))
|
||||
{
|
||||
parsertools.errors.Add(new bad_format_string(parsertools.CurrentFileName, str.source_context, str));
|
||||
return str;
|
||||
int cnt = 0;
|
||||
string tmp = str2.Trim();
|
||||
for (var i = 0; i < tmp.Length; i++)
|
||||
if (tmp[i] == '{')
|
||||
cnt++;
|
||||
if (cnt % 2 == 1)
|
||||
{
|
||||
parsertools.errors.Add(new bad_format_string(parsertools.CurrentFileName, str.source_context, str));
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
mc.parameters.Add(new string_const(str2, str.source_context), str.source_context);
|
||||
for (int i = 0; i < vars.Count; i++)
|
||||
|
|
|
|||
3
TestSuite/errors/err0519_format_string.pas
Normal file
3
TestSuite/errors/err0519_format_string.pas
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
begin
|
||||
var s := $'{{{';
|
||||
end.
|
||||
6
TestSuite/formatstring9.pas
Normal file
6
TestSuite/formatstring9.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
begin
|
||||
var s := $'{{';
|
||||
assert(s = '{');
|
||||
s := $'{{{{';
|
||||
assert(s = '{{');
|
||||
end.
|
||||
Loading…
Reference in a new issue