fcl-res: support octal numbers

Reintegrate fpcres-rc branch by Martok

git-svn-id: trunk@46382 -
This commit is contained in:
svenbarth 2020-08-12 19:05:44 +00:00
parent b88adc8e64
commit 3a65c1912b
3 changed files with 544 additions and 503 deletions
packages/fcl-res/src

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@ end;
%}
%x INCOMLINE INCOMMENT INSTRING INSTRINGL
O [0-7]
D [0-9]
H [0-9a-fA-F]
IDENT [a-zA-Z_]([a-zA-Z0-9_])*
@ -76,6 +77,7 @@ IDENT [a-zA-Z_]([a-zA-Z0-9_])*
{D}+L? return(_NUMBER);
0x{H}+L? return(_NUMBER);
0o{O}+L? return(_NUMBER);
L\" begin start(INSTRINGL); strbuf_begin(); end;
\" begin start(INSTRING); strbuf_begin(); end;
<INSTRING,INSTRINGL>\"\" strbuf_append('"');

View File

@ -120,6 +120,8 @@ begin
Exit(0);
if Copy(s, 1, 2) = '0x' then
Exit(StrToInt('$' + Copy(s, 3, Maxint)));
if Copy(s, 1, 2) = '0o' then
Exit(StrToInt('&' + Copy(s, 3, Maxint)));
if Copy(s, 1, 1) = '0' then
Exit(StrToInt('&' + Copy(s, 2, Maxint)));
Result:= StrToInt(s);