- fix \ in filenames:

* copy long_string to long_stringfn and long_string.
 * turn off interpretive I/O (escapes) for long_stringfn
 * use long_stringfn for filenames.

 * filenames also get unquoted production for Delphi compatibility using new non_whitespace_string.  Regex for that is a bit t.b.d, but this made it work with my examples

git-svn-id: trunk@47820 -
This commit is contained in:
marco 2020-12-19 21:47:25 +00:00
parent b8fc193b0c
commit 5cffbad92a
4 changed files with 1999 additions and 1793 deletions

File diff suppressed because it is too large Load Diff

View File

@ -63,6 +63,7 @@ O [0-7]
D [0-9]
H [0-9a-fA-F]
IDENT [a-zA-Z_]([a-zA-Z0-9_])*
NSWPSTR ([a-zA-Z0-9_\:\.\\])*
%%
@ -108,6 +109,7 @@ END|} return(_END);
else
return(_ID);
end;
{NSWPSTR} return(_NSWPSTR);
[ \t\n\f] ;
[,()|^&+-*/%~] returnc(yytext[1]);
. return(_ILLEGAL);

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ unit rcparser;
%token _ILLEGAL
%token _NUMBER _QUOTEDSTR _QUOTEDSTRL
%token _STR_StringFileInfo _STR_VarFileInfo _STR_Translation
%token _BEGIN _END _ID
%token _BEGIN _END _ID _NSWPSTR
%token _LANGUAGE _CHARACTERISTICS _VERSION _MOVEABLE _FIXED _PURE _IMPURE _PRELOAD _LOADONCALL _DISCARDABLE
%token _BITMAP _CURSOR _ICON _STRINGTABLE _VERSIONINFO
%token _ANICURSOR _ANIICON _DLGINCLUDE _DLGINIT _HTML _MANIFEST _MESSAGETABLE _PLUGPLAY _RCDATA _VXD
@ -20,7 +20,7 @@ unit rcparser;
%token _ACCELERATORS _DIALOG _DIALOGEX _MENU _MENUEX
%type <rcnumtype> numpos numexpr numeral
%type <rcstrtype> ident_string long_string
%type <rcstrtype> ident_string long_string non_whitespace_string long_stringfn
%type <TResourceDesc> resid rcdataid
%type <TMemoryStream> raw_data raw_item
%type <TFileStream> filename_string
@ -188,8 +188,21 @@ ident_string
| long_string
;
non_whitespace_string
: _NSWPSTR { string_new($$, yytext, opt_code_page); }
;
filename_string
: long_string { $$:= TFileStream.Create($1.v^, fmOpenRead or fmShareDenyWrite); }
: long_stringfn { $$:= TFileStream.Create($1.v^, fmOpenRead or fmShareDenyWrite); }
| non_whitespace_string { $$:= TFileStream.Create($1.v^, fmOpenRead or fmShareDenyWrite); }
;
long_stringfn
: _QUOTEDSTR { string_new_uni($$, @strbuf[0], strbuflen, opt_code_page, false); }
| _QUOTEDSTRL { string_new_uni($$, @strbuf[0], strbuflen, CP_UTF16, false); }
| _STR_StringFileInfo { string_new($$, yytext, opt_code_page); }
| _STR_VarFileInfo { string_new($$, yytext, opt_code_page); }
| _STR_Translation { string_new($$, yytext, opt_code_page); }
;
long_string