fix #787
This commit is contained in:
parent
9eeb965fd0
commit
11faec72f0
|
|
@ -414,8 +414,9 @@ namespace GPPGParserScanner
|
||||||
mc.parameters = new expression_list();
|
mc.parameters = new expression_list();
|
||||||
//string[] arr = Regex.Split(str.Value, @"\{[\w\d._]+\}");
|
//string[] arr = Regex.Split(str.Value, @"\{[\w\d._]+\}");
|
||||||
//Match match = Regex.Match(str.Value, @"\{[\w\d._]+\}");
|
//Match match = Regex.Match(str.Value, @"\{[\w\d._]+\}");
|
||||||
string[] arr = Regex.Split(str.Value, @"\{[^\}]+\}");
|
string val = str.Value.Replace("{{","![&").Replace("}}}","}&]!").Replace("}}", "&]!");
|
||||||
Match match = Regex.Match(str.Value, @"\{[^\}]+\}");
|
string[] arr = Regex.Split(val, @"\{[^\}]+\}");
|
||||||
|
Match match = Regex.Match(val, @"\{[^\}]+\}");
|
||||||
List<string> vars = new List<string>();
|
List<string> vars = new List<string>();
|
||||||
//Dictionary<string, int> var_offsets = new Dictionary<string, int>();
|
//Dictionary<string, int> var_offsets = new Dictionary<string, int>();
|
||||||
List<int> var_offsets = new List<int>();
|
List<int> var_offsets = new List<int>();
|
||||||
|
|
@ -435,7 +436,7 @@ namespace GPPGParserScanner
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < arr.Length; i++)
|
for (int i = 0; i < arr.Length; i++)
|
||||||
{
|
{
|
||||||
sb.Append(arr[i]);
|
sb.Append(arr[i].Replace("![&", "{{").Replace("&]!", "}}"));
|
||||||
if (i < arr.Length - 1)
|
if (i < arr.Length - 1)
|
||||||
sb.Append("{" + i + "}");
|
sb.Append("{" + i + "}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
TestSuite/formatstring3.pas
Normal file
11
TestSuite/formatstring3.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
begin
|
||||||
|
var a := 2;
|
||||||
|
var b := 3;
|
||||||
|
var c := 4;
|
||||||
|
var s := $'Hello {{{{{a}}}}}';
|
||||||
|
assert(s = 'Hello {{2}}');
|
||||||
|
s := $'{{{a}}},{b},{c}';
|
||||||
|
assert(s = '{2},3,4');
|
||||||
|
s := $'{a+1},{b+1},{c+1}';
|
||||||
|
assert(s = '3,4,5');
|
||||||
|
end.
|
||||||
Loading…
Reference in a new issue