Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow @ as label prefix #60

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs/language_spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,18 @@ A statement can be marked with multiple labels.

.. code:: ExplorerScript

§hello_label;
@hello_label;
operation();

§another_label;
§and_another_one;
@another_label;
@and_another_one;
another_operation();

.. admonition:: SkyTemple

``§label;`` can be used instead of ``@label;`` for backwards
compatibility. You should use ``@label;`` in new scripts.

Control statements
~~~~~~~~~~~~~~~~~~
Control statements have special meaning to the control flow
Expand Down Expand Up @@ -355,7 +360,7 @@ Jumps to a label.
.. code:: ExplorerScript

// This will execute operation() in an endless loop.
§hello_label;
@hello_label;
operation();
jump @hello_label;

Expand Down
2 changes: 1 addition & 1 deletion explorerscript/antlr/ExplorerScript.interp

Large diffs are not rendered by default.

371 changes: 190 additions & 181 deletions explorerscript/antlr/ExplorerScriptParser.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion explorerscript/antlr/SsbCommon.g4
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pos_argument: integer_like | string | position_marker;
position_marker: POSITION OPEN_SHARP STRING_LITERAL ',' position_marker_arg ',' position_marker_arg CLOSE_SHARP;
position_marker_arg: INTEGER | DECIMAL;

label: PARAGRAPH IDENTIFIER;
label: (PARAGRAPH | AT) IDENTIFIER;

string: string_value | lang_string;
lang_string: OPEN_BRACE lang_string_argument (',' lang_string_argument)* (',')? CLOSE_BRACE;
Expand Down
2 changes: 1 addition & 1 deletion explorerscript/antlr/SsbScript.interp
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ string_value


atn:
[4, 1, 35, 158, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 45, 8, 0, 1, 1, 1, 1, 1, 1, 1, 2, 5, 2, 51, 8, 2, 10, 2, 12, 2, 54, 9, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 3, 3, 61, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 3, 8, 83, 8, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 3, 9, 90, 8, 9, 1, 9, 1, 9, 1, 10, 1, 10, 4, 10, 96, 8, 10, 11, 10, 12, 10, 97, 1, 10, 3, 10, 101, 8, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 5, 12, 112, 8, 12, 10, 12, 12, 12, 115, 9, 12, 1, 12, 3, 12, 118, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 136, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 5, 17, 142, 8, 17, 10, 17, 12, 17, 145, 9, 17, 1, 17, 3, 17, 148, 8, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 0, 0, 20, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 0, 3, 3, 0, 13, 14, 16, 16, 33, 33, 2, 0, 16, 16, 33, 33, 1, 0, 2, 3, 152, 0, 44, 1, 0, 0, 0, 2, 46, 1, 0, 0, 0, 4, 52, 1, 0, 0, 0, 6, 60, 1, 0, 0, 0, 8, 62, 1, 0, 0, 0, 10, 66, 1, 0, 0, 0, 12, 70, 1, 0, 0, 0, 14, 78, 1, 0, 0, 0, 16, 82, 1, 0, 0, 0, 18, 86, 1, 0, 0, 0, 20, 93, 1, 0, 0, 0, 22, 104, 1, 0, 0, 0, 24, 108, 1, 0, 0, 0, 26, 119, 1, 0, 0, 0, 28, 128, 1, 0, 0, 0, 30, 130, 1, 0, 0, 0, 32, 135, 1, 0, 0, 0, 34, 137, 1, 0, 0, 0, 36, 151, 1, 0, 0, 0, 38, 155, 1, 0, 0, 0, 40, 45, 3, 14, 7, 0, 41, 45, 3, 32, 16, 0, 42, 45, 3, 26, 13, 0, 43, 45, 3, 2, 1, 0, 44, 40, 1, 0, 0, 0, 44, 41, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 43, 1, 0, 0, 0, 45, 1, 1, 0, 0, 0, 46, 47, 5, 27, 0, 0, 47, 48, 5, 13, 0, 0, 48, 3, 1, 0, 0, 0, 49, 51, 3, 6, 3, 0, 50, 49, 1, 0, 0, 0, 51, 54, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 55, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 55, 56, 5, 0, 0, 1, 56, 5, 1, 0, 0, 0, 57, 61, 3, 10, 5, 0, 58, 61, 3, 8, 4, 0, 59, 61, 3, 12, 6, 0, 60, 57, 1, 0, 0, 0, 60, 58, 1, 0, 0, 0, 60, 59, 1, 0, 0, 0, 61, 7, 1, 0, 0, 0, 62, 63, 5, 6, 0, 0, 63, 64, 5, 16, 0, 0, 64, 65, 3, 20, 10, 0, 65, 9, 1, 0, 0, 0, 66, 67, 5, 5, 0, 0, 67, 68, 5, 13, 0, 0, 68, 69, 3, 20, 10, 0, 69, 11, 1, 0, 0, 0, 70, 71, 5, 6, 0, 0, 71, 72, 5, 16, 0, 0, 72, 73, 5, 4, 0, 0, 73, 74, 5, 21, 0, 0, 74, 75, 3, 14, 7, 0, 75, 76, 5, 22, 0, 0, 76, 77, 3, 20, 10, 0, 77, 13, 1, 0, 0, 0, 78, 79, 7, 0, 0, 0, 79, 15, 1, 0, 0, 0, 80, 83, 3, 18, 9, 0, 81, 83, 3, 30, 15, 0, 82, 80, 1, 0, 0, 0, 82, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 85, 5, 1, 0, 0, 85, 17, 1, 0, 0, 0, 86, 87, 5, 13, 0, 0, 87, 89, 5, 21, 0, 0, 88, 90, 3, 24, 12, 0, 89, 88, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 5, 22, 0, 0, 92, 19, 1, 0, 0, 0, 93, 100, 5, 29, 0, 0, 94, 96, 3, 16, 8, 0, 95, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 101, 1, 0, 0, 0, 99, 101, 3, 22, 11, 0, 100, 95, 1, 0, 0, 0, 100, 99, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 103, 5, 30, 0, 0, 103, 21, 1, 0, 0, 0, 104, 105, 5, 10, 0, 0, 105, 106, 5, 11, 0, 0, 106, 107, 5, 1, 0, 0, 107, 23, 1, 0, 0, 0, 108, 113, 3, 0, 0, 0, 109, 110, 5, 23, 0, 0, 110, 112, 3, 0, 0, 0, 111, 109, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 117, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 118, 5, 23, 0, 0, 117, 116, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 25, 1, 0, 0, 0, 119, 120, 5, 12, 0, 0, 120, 121, 5, 31, 0, 0, 121, 122, 5, 2, 0, 0, 122, 123, 5, 23, 0, 0, 123, 124, 3, 28, 14, 0, 124, 125, 5, 23, 0, 0, 125, 126, 3, 28, 14, 0, 126, 127, 5, 32, 0, 0, 127, 27, 1, 0, 0, 0, 128, 129, 7, 1, 0, 0, 129, 29, 1, 0, 0, 0, 130, 131, 5, 28, 0, 0, 131, 132, 5, 13, 0, 0, 132, 31, 1, 0, 0, 0, 133, 136, 3, 38, 19, 0, 134, 136, 3, 34, 17, 0, 135, 133, 1, 0, 0, 0, 135, 134, 1, 0, 0, 0, 136, 33, 1, 0, 0, 0, 137, 138, 5, 29, 0, 0, 138, 143, 3, 36, 18, 0, 139, 140, 5, 23, 0, 0, 140, 142, 3, 36, 18, 0, 141, 139, 1, 0, 0, 0, 142, 145, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 147, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 146, 148, 5, 23, 0, 0, 147, 146, 1, 0, 0, 0, 147, 148, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 150, 5, 30, 0, 0, 150, 35, 1, 0, 0, 0, 151, 152, 5, 13, 0, 0, 152, 153, 5, 25, 0, 0, 153, 154, 3, 38, 19, 0, 154, 37, 1, 0, 0, 0, 155, 156, 7, 2, 0, 0, 156, 39, 1, 0, 0, 0, 12, 44, 52, 60, 82, 89, 97, 100, 113, 117, 135, 143, 147]
[4, 1, 35, 158, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 45, 8, 0, 1, 1, 1, 1, 1, 1, 1, 2, 5, 2, 51, 8, 2, 10, 2, 12, 2, 54, 9, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 3, 3, 61, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 3, 8, 83, 8, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 3, 9, 90, 8, 9, 1, 9, 1, 9, 1, 10, 1, 10, 4, 10, 96, 8, 10, 11, 10, 12, 10, 97, 1, 10, 3, 10, 101, 8, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 5, 12, 112, 8, 12, 10, 12, 12, 12, 115, 9, 12, 1, 12, 3, 12, 118, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 136, 8, 16, 1, 17, 1, 17, 1, 17, 1, 17, 5, 17, 142, 8, 17, 10, 17, 12, 17, 145, 9, 17, 1, 17, 3, 17, 148, 8, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 0, 0, 20, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 0, 4, 3, 0, 13, 14, 16, 16, 33, 33, 2, 0, 16, 16, 33, 33, 1, 0, 27, 28, 1, 0, 2, 3, 152, 0, 44, 1, 0, 0, 0, 2, 46, 1, 0, 0, 0, 4, 52, 1, 0, 0, 0, 6, 60, 1, 0, 0, 0, 8, 62, 1, 0, 0, 0, 10, 66, 1, 0, 0, 0, 12, 70, 1, 0, 0, 0, 14, 78, 1, 0, 0, 0, 16, 82, 1, 0, 0, 0, 18, 86, 1, 0, 0, 0, 20, 93, 1, 0, 0, 0, 22, 104, 1, 0, 0, 0, 24, 108, 1, 0, 0, 0, 26, 119, 1, 0, 0, 0, 28, 128, 1, 0, 0, 0, 30, 130, 1, 0, 0, 0, 32, 135, 1, 0, 0, 0, 34, 137, 1, 0, 0, 0, 36, 151, 1, 0, 0, 0, 38, 155, 1, 0, 0, 0, 40, 45, 3, 14, 7, 0, 41, 45, 3, 32, 16, 0, 42, 45, 3, 26, 13, 0, 43, 45, 3, 2, 1, 0, 44, 40, 1, 0, 0, 0, 44, 41, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 43, 1, 0, 0, 0, 45, 1, 1, 0, 0, 0, 46, 47, 5, 27, 0, 0, 47, 48, 5, 13, 0, 0, 48, 3, 1, 0, 0, 0, 49, 51, 3, 6, 3, 0, 50, 49, 1, 0, 0, 0, 51, 54, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 55, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 55, 56, 5, 0, 0, 1, 56, 5, 1, 0, 0, 0, 57, 61, 3, 10, 5, 0, 58, 61, 3, 8, 4, 0, 59, 61, 3, 12, 6, 0, 60, 57, 1, 0, 0, 0, 60, 58, 1, 0, 0, 0, 60, 59, 1, 0, 0, 0, 61, 7, 1, 0, 0, 0, 62, 63, 5, 6, 0, 0, 63, 64, 5, 16, 0, 0, 64, 65, 3, 20, 10, 0, 65, 9, 1, 0, 0, 0, 66, 67, 5, 5, 0, 0, 67, 68, 5, 13, 0, 0, 68, 69, 3, 20, 10, 0, 69, 11, 1, 0, 0, 0, 70, 71, 5, 6, 0, 0, 71, 72, 5, 16, 0, 0, 72, 73, 5, 4, 0, 0, 73, 74, 5, 21, 0, 0, 74, 75, 3, 14, 7, 0, 75, 76, 5, 22, 0, 0, 76, 77, 3, 20, 10, 0, 77, 13, 1, 0, 0, 0, 78, 79, 7, 0, 0, 0, 79, 15, 1, 0, 0, 0, 80, 83, 3, 18, 9, 0, 81, 83, 3, 30, 15, 0, 82, 80, 1, 0, 0, 0, 82, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 85, 5, 1, 0, 0, 85, 17, 1, 0, 0, 0, 86, 87, 5, 13, 0, 0, 87, 89, 5, 21, 0, 0, 88, 90, 3, 24, 12, 0, 89, 88, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 5, 22, 0, 0, 92, 19, 1, 0, 0, 0, 93, 100, 5, 29, 0, 0, 94, 96, 3, 16, 8, 0, 95, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 101, 1, 0, 0, 0, 99, 101, 3, 22, 11, 0, 100, 95, 1, 0, 0, 0, 100, 99, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 103, 5, 30, 0, 0, 103, 21, 1, 0, 0, 0, 104, 105, 5, 10, 0, 0, 105, 106, 5, 11, 0, 0, 106, 107, 5, 1, 0, 0, 107, 23, 1, 0, 0, 0, 108, 113, 3, 0, 0, 0, 109, 110, 5, 23, 0, 0, 110, 112, 3, 0, 0, 0, 111, 109, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 117, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 118, 5, 23, 0, 0, 117, 116, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 25, 1, 0, 0, 0, 119, 120, 5, 12, 0, 0, 120, 121, 5, 31, 0, 0, 121, 122, 5, 2, 0, 0, 122, 123, 5, 23, 0, 0, 123, 124, 3, 28, 14, 0, 124, 125, 5, 23, 0, 0, 125, 126, 3, 28, 14, 0, 126, 127, 5, 32, 0, 0, 127, 27, 1, 0, 0, 0, 128, 129, 7, 1, 0, 0, 129, 29, 1, 0, 0, 0, 130, 131, 7, 2, 0, 0, 131, 132, 5, 13, 0, 0, 132, 31, 1, 0, 0, 0, 133, 136, 3, 38, 19, 0, 134, 136, 3, 34, 17, 0, 135, 133, 1, 0, 0, 0, 135, 134, 1, 0, 0, 0, 136, 33, 1, 0, 0, 0, 137, 138, 5, 29, 0, 0, 138, 143, 3, 36, 18, 0, 139, 140, 5, 23, 0, 0, 140, 142, 3, 36, 18, 0, 141, 139, 1, 0, 0, 0, 142, 145, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 147, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 146, 148, 5, 23, 0, 0, 147, 146, 1, 0, 0, 0, 147, 148, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 150, 5, 30, 0, 0, 150, 35, 1, 0, 0, 0, 151, 152, 5, 13, 0, 0, 152, 153, 5, 25, 0, 0, 153, 154, 3, 38, 19, 0, 154, 37, 1, 0, 0, 0, 155, 156, 7, 3, 0, 0, 156, 39, 1, 0, 0, 0, 12, 44, 52, 60, 82, 89, 97, 100, 113, 117, 135, 143, 147]
97 changes: 53 additions & 44 deletions explorerscript/antlr/SsbScriptParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,44 @@ def serializedATN():
1,16,1,16,3,16,136,8,16,1,17,1,17,1,17,1,17,5,17,142,8,17,10,17,
12,17,145,9,17,1,17,3,17,148,8,17,1,17,1,17,1,18,1,18,1,18,1,18,
1,19,1,19,1,19,0,0,20,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,
32,34,36,38,0,3,3,0,13,14,16,16,33,33,2,0,16,16,33,33,1,0,2,3,152,
0,44,1,0,0,0,2,46,1,0,0,0,4,52,1,0,0,0,6,60,1,0,0,0,8,62,1,0,0,0,
10,66,1,0,0,0,12,70,1,0,0,0,14,78,1,0,0,0,16,82,1,0,0,0,18,86,1,
0,0,0,20,93,1,0,0,0,22,104,1,0,0,0,24,108,1,0,0,0,26,119,1,0,0,0,
28,128,1,0,0,0,30,130,1,0,0,0,32,135,1,0,0,0,34,137,1,0,0,0,36,151,
1,0,0,0,38,155,1,0,0,0,40,45,3,14,7,0,41,45,3,32,16,0,42,45,3,26,
13,0,43,45,3,2,1,0,44,40,1,0,0,0,44,41,1,0,0,0,44,42,1,0,0,0,44,
43,1,0,0,0,45,1,1,0,0,0,46,47,5,27,0,0,47,48,5,13,0,0,48,3,1,0,0,
0,49,51,3,6,3,0,50,49,1,0,0,0,51,54,1,0,0,0,52,50,1,0,0,0,52,53,
1,0,0,0,53,55,1,0,0,0,54,52,1,0,0,0,55,56,5,0,0,1,56,5,1,0,0,0,57,
61,3,10,5,0,58,61,3,8,4,0,59,61,3,12,6,0,60,57,1,0,0,0,60,58,1,0,
0,0,60,59,1,0,0,0,61,7,1,0,0,0,62,63,5,6,0,0,63,64,5,16,0,0,64,65,
3,20,10,0,65,9,1,0,0,0,66,67,5,5,0,0,67,68,5,13,0,0,68,69,3,20,10,
0,69,11,1,0,0,0,70,71,5,6,0,0,71,72,5,16,0,0,72,73,5,4,0,0,73,74,
5,21,0,0,74,75,3,14,7,0,75,76,5,22,0,0,76,77,3,20,10,0,77,13,1,0,
0,0,78,79,7,0,0,0,79,15,1,0,0,0,80,83,3,18,9,0,81,83,3,30,15,0,82,
80,1,0,0,0,82,81,1,0,0,0,83,84,1,0,0,0,84,85,5,1,0,0,85,17,1,0,0,
0,86,87,5,13,0,0,87,89,5,21,0,0,88,90,3,24,12,0,89,88,1,0,0,0,89,
90,1,0,0,0,90,91,1,0,0,0,91,92,5,22,0,0,92,19,1,0,0,0,93,100,5,29,
0,0,94,96,3,16,8,0,95,94,1,0,0,0,96,97,1,0,0,0,97,95,1,0,0,0,97,
98,1,0,0,0,98,101,1,0,0,0,99,101,3,22,11,0,100,95,1,0,0,0,100,99,
1,0,0,0,101,102,1,0,0,0,102,103,5,30,0,0,103,21,1,0,0,0,104,105,
5,10,0,0,105,106,5,11,0,0,106,107,5,1,0,0,107,23,1,0,0,0,108,113,
3,0,0,0,109,110,5,23,0,0,110,112,3,0,0,0,111,109,1,0,0,0,112,115,
1,0,0,0,113,111,1,0,0,0,113,114,1,0,0,0,114,117,1,0,0,0,115,113,
1,0,0,0,116,118,5,23,0,0,117,116,1,0,0,0,117,118,1,0,0,0,118,25,
1,0,0,0,119,120,5,12,0,0,120,121,5,31,0,0,121,122,5,2,0,0,122,123,
5,23,0,0,123,124,3,28,14,0,124,125,5,23,0,0,125,126,3,28,14,0,126,
127,5,32,0,0,127,27,1,0,0,0,128,129,7,1,0,0,129,29,1,0,0,0,130,131,
5,28,0,0,131,132,5,13,0,0,132,31,1,0,0,0,133,136,3,38,19,0,134,136,
3,34,17,0,135,133,1,0,0,0,135,134,1,0,0,0,136,33,1,0,0,0,137,138,
5,29,0,0,138,143,3,36,18,0,139,140,5,23,0,0,140,142,3,36,18,0,141,
139,1,0,0,0,142,145,1,0,0,0,143,141,1,0,0,0,143,144,1,0,0,0,144,
147,1,0,0,0,145,143,1,0,0,0,146,148,5,23,0,0,147,146,1,0,0,0,147,
148,1,0,0,0,148,149,1,0,0,0,149,150,5,30,0,0,150,35,1,0,0,0,151,
152,5,13,0,0,152,153,5,25,0,0,153,154,3,38,19,0,154,37,1,0,0,0,155,
156,7,2,0,0,156,39,1,0,0,0,12,44,52,60,82,89,97,100,113,117,135,
143,147
32,34,36,38,0,4,3,0,13,14,16,16,33,33,2,0,16,16,33,33,1,0,27,28,
1,0,2,3,152,0,44,1,0,0,0,2,46,1,0,0,0,4,52,1,0,0,0,6,60,1,0,0,0,
8,62,1,0,0,0,10,66,1,0,0,0,12,70,1,0,0,0,14,78,1,0,0,0,16,82,1,0,
0,0,18,86,1,0,0,0,20,93,1,0,0,0,22,104,1,0,0,0,24,108,1,0,0,0,26,
119,1,0,0,0,28,128,1,0,0,0,30,130,1,0,0,0,32,135,1,0,0,0,34,137,
1,0,0,0,36,151,1,0,0,0,38,155,1,0,0,0,40,45,3,14,7,0,41,45,3,32,
16,0,42,45,3,26,13,0,43,45,3,2,1,0,44,40,1,0,0,0,44,41,1,0,0,0,44,
42,1,0,0,0,44,43,1,0,0,0,45,1,1,0,0,0,46,47,5,27,0,0,47,48,5,13,
0,0,48,3,1,0,0,0,49,51,3,6,3,0,50,49,1,0,0,0,51,54,1,0,0,0,52,50,
1,0,0,0,52,53,1,0,0,0,53,55,1,0,0,0,54,52,1,0,0,0,55,56,5,0,0,1,
56,5,1,0,0,0,57,61,3,10,5,0,58,61,3,8,4,0,59,61,3,12,6,0,60,57,1,
0,0,0,60,58,1,0,0,0,60,59,1,0,0,0,61,7,1,0,0,0,62,63,5,6,0,0,63,
64,5,16,0,0,64,65,3,20,10,0,65,9,1,0,0,0,66,67,5,5,0,0,67,68,5,13,
0,0,68,69,3,20,10,0,69,11,1,0,0,0,70,71,5,6,0,0,71,72,5,16,0,0,72,
73,5,4,0,0,73,74,5,21,0,0,74,75,3,14,7,0,75,76,5,22,0,0,76,77,3,
20,10,0,77,13,1,0,0,0,78,79,7,0,0,0,79,15,1,0,0,0,80,83,3,18,9,0,
81,83,3,30,15,0,82,80,1,0,0,0,82,81,1,0,0,0,83,84,1,0,0,0,84,85,
5,1,0,0,85,17,1,0,0,0,86,87,5,13,0,0,87,89,5,21,0,0,88,90,3,24,12,
0,89,88,1,0,0,0,89,90,1,0,0,0,90,91,1,0,0,0,91,92,5,22,0,0,92,19,
1,0,0,0,93,100,5,29,0,0,94,96,3,16,8,0,95,94,1,0,0,0,96,97,1,0,0,
0,97,95,1,0,0,0,97,98,1,0,0,0,98,101,1,0,0,0,99,101,3,22,11,0,100,
95,1,0,0,0,100,99,1,0,0,0,101,102,1,0,0,0,102,103,5,30,0,0,103,21,
1,0,0,0,104,105,5,10,0,0,105,106,5,11,0,0,106,107,5,1,0,0,107,23,
1,0,0,0,108,113,3,0,0,0,109,110,5,23,0,0,110,112,3,0,0,0,111,109,
1,0,0,0,112,115,1,0,0,0,113,111,1,0,0,0,113,114,1,0,0,0,114,117,
1,0,0,0,115,113,1,0,0,0,116,118,5,23,0,0,117,116,1,0,0,0,117,118,
1,0,0,0,118,25,1,0,0,0,119,120,5,12,0,0,120,121,5,31,0,0,121,122,
5,2,0,0,122,123,5,23,0,0,123,124,3,28,14,0,124,125,5,23,0,0,125,
126,3,28,14,0,126,127,5,32,0,0,127,27,1,0,0,0,128,129,7,1,0,0,129,
29,1,0,0,0,130,131,7,2,0,0,131,132,5,13,0,0,132,31,1,0,0,0,133,136,
3,38,19,0,134,136,3,34,17,0,135,133,1,0,0,0,135,134,1,0,0,0,136,
33,1,0,0,0,137,138,5,29,0,0,138,143,3,36,18,0,139,140,5,23,0,0,140,
142,3,36,18,0,141,139,1,0,0,0,142,145,1,0,0,0,143,141,1,0,0,0,143,
144,1,0,0,0,144,147,1,0,0,0,145,143,1,0,0,0,146,148,5,23,0,0,147,
146,1,0,0,0,147,148,1,0,0,0,148,149,1,0,0,0,149,150,5,30,0,0,150,
35,1,0,0,0,151,152,5,13,0,0,152,153,5,25,0,0,153,154,3,38,19,0,154,
37,1,0,0,0,155,156,7,3,0,0,156,39,1,0,0,0,12,44,52,60,82,89,97,100,
113,117,135,143,147
]

class SsbScriptParser ( Parser ):
Expand Down Expand Up @@ -689,7 +689,7 @@ def stmt(self):
self.state = 80
self.operation()
pass
elif token in [28]:
elif token in [27, 28]:
self.state = 81
self.label()
pass
Expand Down Expand Up @@ -821,7 +821,7 @@ def func_suite(self):
self.state = 100
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [13, 28]:
if token in [13, 27, 28]:
self.state = 95
self._errHandler.sync(self)
_la = self._input.LA(1)
Expand All @@ -831,7 +831,7 @@ def func_suite(self):
self.state = 97
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (_la==13 or _la==28):
if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 402661376) != 0)):
break

pass
Expand Down Expand Up @@ -1108,11 +1108,14 @@ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser

def IDENTIFIER(self):
return self.getToken(SsbScriptParser.IDENTIFIER, 0)

def PARAGRAPH(self):
return self.getToken(SsbScriptParser.PARAGRAPH, 0)

def IDENTIFIER(self):
return self.getToken(SsbScriptParser.IDENTIFIER, 0)
def AT(self):
return self.getToken(SsbScriptParser.AT, 0)

def getRuleIndex(self):
return SsbScriptParser.RULE_label
Expand All @@ -1132,10 +1135,16 @@ def label(self):

localctx = SsbScriptParser.LabelContext(self, self._ctx, self.state)
self.enterRule(localctx, 30, self.RULE_label)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 130
self.match(SsbScriptParser.PARAGRAPH)
_la = self._input.LA(1)
if not(_la==27 or _la==28):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 131
self.match(SsbScriptParser.IDENTIFIER)
except RecognitionException as re:
Expand Down
2 changes: 1 addition & 1 deletion explorerscript/pygments/expslexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ExplorerScriptLexer(RegexLexer):
include("comments"),
(r"\$[a-zA-Z_][0-9a-zA-Z_]*", Name.Variable),
(r"§[a-zA-Z_][0-9a-zA-Z_]*", Name.Label),
(r"@[a-zA-Z_][0-9a-zA-Z_]*", Name.Decorator),
(r"@[a-zA-Z_][0-9a-zA-Z_]*", Name.Label),
(r"[a-zA-Z_][0-9a-zA-Z_]*", Name),
include("numbers"),
('"""', String, "mdq_string"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,5 @@ def write_content(self) -> Vertex | None:
raise ValueError("After a label there must be exactly 1 opcode.")

def _write_label(self, label: SsbLabel) -> None:
self.decompiler.write_stmnt(f"§label_{label.id};")
self.decompiler.write_stmnt(f"@label_{label.id};")
self.decompiler.labels_already_printed.append(label.id)
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def write_content(self) -> Vertex | None:
logger.debug("... NOW block for cases.")
# If this will be visited multiple times, we need a label
if e in edges_that_will_be_visited_multiple_times and e not in already_printed_edges:
self.decompiler.write_stmnt(f"§switch{m.switch_id}_{e.index};")
self.decompiler.write_stmnt(f"@switch{m.switch_id}_{e.index};")
if e in already_printed_edges:
# Write the label jump instead
self.decompiler.write_stmnt(f"jump @switch{m.switch_id}_{e.index};")
Expand Down
Loading