From 42dba03d94de206e8196f79473d1b9ffa5a90921 Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 7 May 2018 18:14:38 +0000 Subject: [PATCH] IDE, EditorMacro: fix parsing of arguments. Fix numbers and #123 git-svn-id: branches/fixes_1_8@57809 - --- ide/editormacrolistviewer.pas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ide/editormacrolistviewer.pas b/ide/editormacrolistviewer.pas index b73342153b..29f31afb57 100644 --- a/ide/editormacrolistviewer.pas +++ b/ide/editormacrolistviewer.pas @@ -868,7 +868,7 @@ begin SkipNum(i); SetLength(FParams, c + 1); FParams[c].ParamType := ptInteger; - FParams[c].Num := StrToInt(copy(FText, i, j-i)); + FParams[c].Num := StrToInt(copy(FText, j, i-j)); inc(c); end else @@ -877,10 +877,17 @@ begin s := ''; repeat case FText[i] of + ' ',#9,#10,#13: inc(i); + '+': begin + inc(i); + if not (FText[i] in ['''', '#']) then exit(AddError('Expected string or char after +')); + end; '#': begin + inc(i); j := i; SkipNum(i); - k := StrToInt(copy(FText, i, j-i)); + if i = j then exit(AddError('Expected number in string after #')); + k := StrToInt(copy(FText, j, i-j)); if k > 255 then exit(AddError('Argument to long')); s := s + chr(k); end;