This commit is contained in:
Бондарев Иван 2017-08-17 20:15:54 +02:00
parent 42a37069dc
commit 902f103319
2 changed files with 18 additions and 7 deletions

View file

@ -369,8 +369,13 @@ namespace CodeCompletion
off = test_str.Length;
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
assert(s.Trim('\n',' ','\t')==test_str);
int num_param = 0;
test_str = "()->(obj as string).Trim";
off = test_str.Length;
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
assert(s.Trim('\n', ' ', '\t') == "(obj as string).Trim");
int num_param = 0;
//testirovanie nazhatija skobki
test_str = "writeln";
off = test_str.Length;
@ -460,8 +465,14 @@ namespace CodeCompletion
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
assert(s == test_str);
assert(num_param==0);
test_str = "test; \n sin";
test_str = "()->(obj as string).Trim";
off = test_str.Length;
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
assert(s == "(obj as string).Trim");
assert(num_param == 0);
test_str = "test; \n sin";
off = test_str.Length;
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
assert(s.Trim(' ','\n','\t') == "sin");

View file

@ -2656,12 +2656,12 @@ namespace PascalABCCompiler.Parsers
case '>':
if (tokens.Count == 0)
{
if (ugl_skobki.Count > 0 || i == off - 1 || i + 1 < Text.Length && (Text[i + 1] == '.' || Text[i + 1] == '('))
if (ugl_skobki.Count > 0 || i == off - 1 || i + 1 < Text.Length && Text[i - 1] != '-' && (Text[i + 1] == '.' || Text[i + 1] == '('))
{
ugl_skobki.Push('>');
sb.Insert(0, ch);
}
else if (i >=1 && Text[i - 1] == '-')
else if (i >= 1 && Text[i - 1] == '-')
{
if (!(kav.Count == 0 && tokens.Count == 0))
sb.Insert(0, ch);
@ -3158,7 +3158,7 @@ namespace PascalABCCompiler.Parsers
skobki.Push(ch);
if (tokens.Count > 0 || pressed_key == ',')
sb.Insert(0, ch);
else if (i == off - 1 || ugl_skobki.Count > 0 || i + 1 < Text.Length && (Text[i + 1] == '.' || Text[i + 1] == '('))
else if (i == off - 1 || ugl_skobki.Count > 0 || i + 1 < Text.Length && Text[i-1] != '-' && (Text[i + 1] == '.' || Text[i + 1] == '('))
{
tokens.Push(ch);
ugl_skobki.Push(ch);