MinecraftForge / AccessTransformers

Antlr4 definition for MCP / Forge Access Transformers
GNU Lesser General Public License v2.1
14 stars 12 forks source link

Improve AT lexer to handle really bad naming #2

Closed DenWav closed 6 years ago

DenWav commented 6 years ago

The previous lexer failed in two cases:

  1. Classes in the default package wouldn't properly be picked up as class names
  2. Names of fields or classes that matched primitive named values would be lexed as primitive type declarations rather than their respective names

The previous lexer also lacked support for more extreme class names, such as names that contained Unicode letters or names including non-dollar sign currency symbols, both of which are valid Java in identifiers. This commit fixes all of these issues.

All of the changes to accomplish this are in the lexer, the parser is unaffected. Consequently, none of the client code needs modification either.

To ensure proper compatibility is maintained, I added test expecations for the forge_at.cfg parse test from before the changes were applied to verify the output is the same after. I also added a unit test with expectations to specifically test the issues described above.