From c0275c4d7f9aa35563e99b2abb237a67bd41f1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Wed, 18 Jul 2018 21:06:52 +0200 Subject: [PATCH] fix #985 --- Parsers/PascalABCParserNewSaushkin/SemanticRules.cs | 4 ++-- TestSuite/formatstring2.pas | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs b/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs index a1851d98b..d90ea635f 100644 --- a/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs +++ b/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs @@ -413,8 +413,8 @@ namespace GPPGParserScanner method_call mc = new method_call(); mc.dereferencing_value = new dot_node(new ident("string", str.source_context), new ident("Format", str.source_context), str.source_context); mc.parameters = new expression_list(); - //string[] arr = Regex.Split(str.Value, @"\{[\w\d._]+\}"); - //Match match = Regex.Match(str.Value, @"\{[\w\d._]+\}"); + if (!str.Value.Contains("{")) + return str; string val = str.Value.Replace("{{","![&").Replace("}}}","}&]!").Replace("}}", "&]!"); string[] arr = Regex.Split(val, @"\{[^\}]+\}"); Match match = Regex.Match(val, @"\{[^\}]+\}"); diff --git a/TestSuite/formatstring2.pas b/TestSuite/formatstring2.pas index 07ad2bf74..6d743bcd9 100644 --- a/TestSuite/formatstring2.pas +++ b/TestSuite/formatstring2.pas @@ -8,4 +8,5 @@ assert(s = '2,3,4'); s := $'{a+1},{b+1},{c+1}'; assert(s = '3,4,5'); + assert($'abc'=$'abc'); end. \ No newline at end of file