Explorar o código

+ support of octal literals

florian %!s(int64=2) %!d(string=hai) anos
pai
achega
5691f2a2c0
Modificáronse 2 ficheiros con 10 adicións e 0 borrados
  1. 5 0
      utils/h2pas/scan.l
  2. 5 0
      utils/h2pas/scan.pas

+ 5 - 0
utils/h2pas/scan.l

@@ -619,6 +619,11 @@ D [0-9]
                           skip_until_eol;
 {D}+[Uu]?[Ll]?[Ll]?     if NotInCPlusBlock then
                         begin
+                           if yytext[1]='0' then
+                             begin
+                                delete(yytext,1,1);
+                                yytext:='&'+yytext;
+                             end;
                            while yytext[length(yytext)] in ['L','U','l','u'] do
                              Delete(yytext,length(yytext),1);
                            return(NUMBER);

+ 5 - 0
utils/h2pas/scan.pas

@@ -634,6 +634,11 @@ begin
   7:
                         if NotInCPlusBlock then
                         begin
+                           if yytext[1]='0' then
+                             begin
+                                delete(yytext,1,1);
+                                yytext:='&'+yytext;
+                             end;
                            while yytext[length(yytext)] in ['L','U','l','u'] do
                              Delete(yytext,length(yytext),1);
                            return(NUMBER);