From 64e6961fa880f513bd20b5ec6ff2cd93f12d5b49 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, 3 Oct 2018 14:56:27 +0200 Subject: [PATCH] fix --- ParserTools/ParserTools/DefaultLanguageInformation.cs | 10 ++++++++-- TreeConverter/TreeConversion/syntax_tree_visitor.cs | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ParserTools/ParserTools/DefaultLanguageInformation.cs b/ParserTools/ParserTools/DefaultLanguageInformation.cs index 67b069aac..f3c00c828 100644 --- a/ParserTools/ParserTools/DefaultLanguageInformation.cs +++ b/ParserTools/ParserTools/DefaultLanguageInformation.cs @@ -2721,8 +2721,14 @@ namespace PascalABCCompiler.Parsers } else if (ch == '.' || ch == '^' || ch == '&' || ch == '?') { - if (ch == '.' && i >= 1 && Text[i - 1] == '.') end = true; else sb.Insert(0, ch); - if (ch != '.') punkt_sym = true; + if (ch == '.' && i >= 1 && Text[i - 1] == '.') + end = true; + else if (ch == '?' && i + 1 < Text.Length && Text[i + 1] != '.') + end = true; + else + sb.Insert(0, ch); + if (ch != '.') + punkt_sym = true; } else if (ch == '}') { diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index d6839759c..5b4c3ad88 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -13880,7 +13880,7 @@ namespace PascalABCCompiler.TreeConverter { is_userdefined = ! (cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem") || cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem_implementation______")); } - return convert_strong_to_constant_node(exp, exp.type, is_const_section && is_userdefined); + return convert_strong_to_constant_node(exp, exp.type, is_const_section && is_userdefined, is_const_section); } public expression_node convert_strong_to_constant_or_function_call_for_varinit(expression_node exp) @@ -13999,7 +13999,7 @@ namespace PascalABCCompiler.TreeConverter is_userdefined = !(cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem") || cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem_implementation______")); } - return convert_strong_to_constant_node(exp, tn, is_const_section && is_userdefined); + return convert_strong_to_constant_node(exp, tn, is_const_section && is_userdefined, is_const_section); } private void check_set_for_constant(common_namespace_function_call cnfc) @@ -14025,7 +14025,7 @@ namespace PascalABCCompiler.TreeConverter if (!(en is constant_node /*|| en is statements_expression_node*/)) AddError(en.location, "CONSTANT_EXPRESSION_EXPECTED"); } - private constant_node convert_strong_to_constant_node(expression_node expr, type_node tn, bool is_const_section_and_userfuncall = false) + private constant_node convert_strong_to_constant_node(expression_node expr, type_node tn, bool is_const_section_and_userfuncall = false, bool is_const_section = false) { location loc = expr.location; constant_node constant = null; @@ -14040,7 +14040,7 @@ namespace PascalABCCompiler.TreeConverter { compiled_static_method_call csmc = expr as compiled_static_method_call; - if (csmc.type != null && csmc.type != SystemLibrary.SystemLibrary.void_type && (csmc.function_node.IsSpecialName && csmc.function_node.is_readonly || NetHelper.NetHelper.PABCSystemType != null && csmc.function_node.cont_type.compiled_type.Assembly == NetHelper.NetHelper.PABCSystemType.Assembly)) + if (csmc.type != null && csmc.type != SystemLibrary.SystemLibrary.void_type && (csmc.function_node.IsSpecialName && csmc.function_node.is_readonly || NetHelper.NetHelper.PABCSystemType != null && csmc.function_node.cont_type.compiled_type.Assembly == NetHelper.NetHelper.PABCSystemType.Assembly || !is_const_section)) constant = new compiled_static_method_call_as_constant(csmc, expr.location); } else if (expr is common_namespace_function_call && SystemLibrary.SystemLibInitializer.CreateSetProcedure != null && (expr as common_namespace_function_call).function_node == SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info as common_namespace_function_node)