This commit is contained in:
Бондарев Иван 2018-04-29 14:34:03 +02:00
parent 9eeb965fd0
commit 11faec72f0
2 changed files with 15 additions and 3 deletions

View file

@ -414,8 +414,9 @@ namespace GPPGParserScanner
mc.parameters = new expression_list();
//string[] arr = Regex.Split(str.Value, @"\{[\w\d._]+\}");
//Match match = Regex.Match(str.Value, @"\{[\w\d._]+\}");
string[] arr = Regex.Split(str.Value, @"\{[^\}]+\}");
Match match = Regex.Match(str.Value, @"\{[^\}]+\}");
string val = str.Value.Replace("{{","![&").Replace("}}}","}&]!").Replace("}}", "&]!");
string[] arr = Regex.Split(val, @"\{[^\}]+\}");
Match match = Regex.Match(val, @"\{[^\}]+\}");
List<string> vars = new List<string>();
//Dictionary<string, int> var_offsets = new Dictionary<string, int>();
List<int> var_offsets = new List<int>();
@ -435,7 +436,7 @@ namespace GPPGParserScanner
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.Length; i++)
{
sb.Append(arr[i]);
sb.Append(arr[i].Replace("![&", "{{").Replace("&]!", "}}"));
if (i < arr.Length - 1)
sb.Append("{" + i + "}");
}

View 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.