edited obfuscation-explorer/src/main/grammars/ProGuardLexer.flex 
Open in IDE
KWkyle wood⁠ kyle wood: Fix ObfEx lexer generation
Copy Copy
        
  1. /*
  2. * Minecraft Development for IntelliJ
  3. *
  4. * https://mcdev.io/
  5. *
  6. * Copyright (C) 2025 minecraft-dev
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published
  10. * by the Free Software Foundation, version 3.0 only.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20.  
  21. package io.mcdev.obfex.formats.proguard.gen;
  22.  
  23. import com.intellij.lexer.*;
  24. import com.intellij.psi.tree.IElementType;
  25. import static io.mcdev.obfex.formats.proguard.gen.psi.ProGuardTypes.*;
  26. import static com.intellij.psi.TokenType.*;
  27.  
  28. %%
  29.  
  30. %{
  31. public ProGuardLexer() {
  32. this((java.io.Reader)null);
  33. }
  34. %}
  35.  
  36. %public
  37. %class ProGuardLexer
  38. %implements FlexLexer
  39. %function advance
  40. %type IElementType
  41.  
  42. %s CORE
  43.  
  44. %unicode
  45.  
  46. NAME_ELEMENT=[\p{L}_\p{Sc}][\p{L}\p{N}_\p{Sc}]*
  47.  
  48. PRIMITIVE=void|boolean|char|byte|short|int|long|float|double
  49.  
  50. NUMBER=\d
  51. POINTER=\s*->\s*
  52.  
  53. COMMENT=\s*#.*
  54.  
  55. WHITE_SPACE=\s
  56. CRLF=\r\n|\n|\r
  57.  
  58. %%
  59.  
  60. <YYINITIAL> {
  61. ":" { return COLON; }
  62. "." { return DOT; }
  63. "," { return COMMA; }
  64. "(" { return OPEN_PAREN; }
  65. ")" { return CLOSE_PAREN; }
  66. "<init>" { return INIT; }
  67. "<clinit>" { return INIT; }
  68. "[]" { return ARRAY_BRACKETS; }
  69. "package-info" { return PACKAGE_INFO; }
  70. {NUMBER}+ { return NUMBER; }
  71. {POINTER} { return POINTER; }
  72. {PRIMITIVE} { return PRIMITIVE; }
  73. {NAME_ELEMENT} { return NAME_ELEMENT; }
  74. }
  75.  
  76. {COMMENT} { return COMMENT; }
  77. {WHITE_SPACE} { return WHITE_SPACE; }
  78. [^] { return BAD_CHARACTER; }
        
  1. /*
  2. * Minecraft Development for IntelliJ
  3. *
  4. * https://mcdev.io/
  5. *
  6. * Copyright (C) 2025 minecraft-dev
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published
  10. * by the Free Software Foundation, version 3.0 only.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20.  
  21. package io.mcdev.obfex.formats.proguard.gen.lexer;
  22.  
  23. import com.intellij.lexer.*;
  24. import com.intellij.psi.tree.IElementType;
  25. import static io.mcdev.obfex.formats.proguard.gen.psi.ProGuardTypes.*;
  26. import static com.intellij.psi.TokenType.*;
  27.  
  28. %%
  29.  
  30. %{
  31. public ProGuardLexer() {
  32. this((java.io.Reader)null);
  33. }
  34. %}
  35.  
  36. %public
  37. %class ProGuardLexer
  38. %implements FlexLexer
  39. %function advance
  40. %type IElementType
  41.  
  42. %s CORE
  43.  
  44. %unicode
  45.  
  46. NAME_ELEMENT=[\p{L}_\p{Sc}][\p{L}\p{N}_\p{Sc}]*
  47.  
  48. PRIMITIVE=void|boolean|char|byte|short|int|long|float|double
  49.  
  50. NUMBER=\d
  51. POINTER=\s*->\s*
  52.  
  53. COMMENT=\s*#.*
  54.  
  55. WHITE_SPACE=\s
  56. CRLF=\r\n|\n|\r
  57.  
  58. %%
  59.  
  60. <YYINITIAL> {
  61. ":" { return COLON; }
  62. "." { return DOT; }
  63. "," { return COMMA; }
  64. "(" { return OPEN_PAREN; }
  65. ")" { return CLOSE_PAREN; }
  66. "<init>" { return INIT; }
  67. "<clinit>" { return INIT; }
  68. "[]" { return ARRAY_BRACKETS; }
  69. "package-info" { return PACKAGE_INFO; }
  70. {NUMBER}+ { return NUMBER; }
  71. {POINTER} { return POINTER; }
  72. {PRIMITIVE} { return PRIMITIVE; }
  73. {NAME_ELEMENT} { return NAME_ELEMENT; }
  74. }
  75.  
  76. {COMMENT} { return COMMENT; }
  77. {WHITE_SPACE} { return WHITE_SPACE; }
  78. [^] { return BAD_CHARACTER; }
×

Add build comment

Cancel
×

Mute test

×

×

Server communication failure

Server is unavailable

Server stopped or communication with the server is not possible due to network failure.

Server shutdown started.

Please relogin to continue your work.

×

Run Custom Build

×

TODO

Loading related builds...
Cancel
×

Responsibility

×

Edit tags

Cancel
×

Loading...

×

Are you sure?

Cancel
×

Please type to confirm.
Cancel