Browse Source

fcl-res: support octal numbers

Reintegrate fpcres-rc branch by Martok

git-svn-id: trunk@46382 -
svenbarth 5 years ago
parent
commit
3a65c1912b
3 changed files with 379 additions and 344 deletions
  1. 375 344
      packages/fcl-res/src/rclex.inc
  2. 2 0
      packages/fcl-res/src/rclex.l
  3. 2 0
      packages/fcl-res/src/rcparserfn.inc

File diff suppressed because it is too large
+ 375 - 344
packages/fcl-res/src/rclex.inc


+ 2 - 0
packages/fcl-res/src/rclex.l

@@ -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('"');

+ 2 - 0
packages/fcl-res/src/rcparserfn.inc

@@ -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);

Some files were not shown because too many files changed in this diff