WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
45.03k stars 1.95k forks source link

[Bug] Error when parsing gb.pat #1946

Open euamotubaina opened 2 weeks ago

euamotubaina commented 2 weeks ago

Operating System

Windows 11 Pro x64 22H2 10.0.22621.2506

What's the issue you encountered?

Error when loading gb.pat

E: error: Expected ';' at end of statement, got Keyword (from).
E:   -->   in C:\Users\xxx\ImHex\includes\std/mem.pat:261:9
E:    >> from C:\Users\xxx\ImHex\includes\std/string.pat:4:12
E:    >> from <Source Code>:7:12
E: 261 |         From from;
E:               ^^^^
E: error: Invalid struct member definition.
E:   -->   in C:\Users\xxx\ImHex\includes\std/mem.pat:261:14
E:    >> from C:\Users\xxx\ImHex\includes\std/string.pat:4:12
E:    >> from <Source Code>:7:12
E: 261 |         From from;
E:                    ^^^^
E: error: Invalid struct member definition.
E:   -->   in C:\Users\xxx\ImHex\includes\std/mem.pat:261:18
E:    >> from C:\Users\xxx\ImHex\includes\std/string.pat:4:12
E:    >> from <Source Code>:7:12
E: 261 |         From from;
E:                        ^
E: error: Expected ';' at end of statement, got Separator (}).
E:   -->   in C:\Users\xxx\ImHex\includes\std/mem.pat:271:57
E:    >> from C:\Users\xxx\ImHex\includes\std/string.pat:4:12
E:    >> from <Source Code>:7:12
E: 271 |  % Alignment) + 1)];
E:                           ^

How can the issue be reproduced?

  1. Load any .gb rom (tested with Pokemon - Red Version (USA, Europe) (SGB Enhanced).gb, CRC-32 9f7fdd53, No-Intro)
  2. Load gb.pat

ImHex Version

Windows Portable x86_64.zip https://github.com/WerWolv/ImHex/commit/592f613a61c7b5ed59c4694891e27030ce801e6c

ImHex Build Type

Installation type

Portable

LeagueRaINi commented 1 week ago

Same error here on a previously working pattern, not sure when it broke but i noticed it when i downloaded the nightly for https://github.com/WerWolv/ImHex/commit/3739bcc40c32087cfb0516ee9d0cc39256aa9cff

I used the windows installer and already tried a complete reinstall (including deleting appdata folder)

paxcut commented 1 week ago

This is a know error caused by the introduction of a new keyword (from) to the pattern language. It has been determined that this may be the only place where a variable named 'from' is used in the library and it has also been determined that there is only one place where the offending union is used. Changing the variable name would be easy, but there is no telling how the change would impact user created patterns so we are waiting on the author's feedback on how to resolve this.