Table of Contents

Enigma Mapping Format

:!: This write-up isn't finalized yet and may contain errors!

The Enigma mapping format consists of a list of hierarchical sections. Every line starts a new section, whether it continues an existing section is determined by the indentation level. A section's parent is always the closest preceding section indented once less than itself. Accordingly, a section ends just before the next line with the same or a lesser indentation level.

The child-to-parent relationships form the paths to uniquely identify any element globally. For example, all method and field sections that are children of a class section represent members of the represented class. Sections need to be unique within their level. For example a specific class may only be recorded once, a comment can't be redefined or the same parameter listed twice.

Supported elements are classes, fields, methods, parameters and comments. If you need support for variables, namespaces, arbitrary top-level metadata and more resistance against obfuscated names, Tiny v2 is recommended instead.

Example:

CLASS a pkg/SomeClass
	FIELD a	someField [I
	METHOD a someMethod (III)V
		ARG 1 amount
		# This is a file comment. It can be put basically everywhere, except in the same line as a COMMENT.
CLASS b pkg/xy/AnotherClass ACC:PUBLIC
	COMMENT This is a
	COMMENT multiline comment. You can use <b>HTML tags</b> if you like, or leave
	COMMENT
	COMMENT empty lines.
	METHOD a anotherMethod (Ljava/lang/String;)I
	CLASS c InnerClass
		COMMENT This class's obfuscated fully qualified name is {@code b$c}.

Grammar

<file>                          ::= <content>
<content>                       ::= '' | <class-section> <content>

<class-section>                 ::= <class-section-indentation> 'CLASS' <space> <class-name-a> <class-name-b> <formatted-access-modifier> <eol> <class-sub-sections>
<class-section-indentation>     ::= '' | <tab> <class-section-indentation>
<class-name-a>                  ::= <class-name>
<class-name-b>                  ::= <optional-class-name>
<optional-class-name>           ::= <empty-mapping> | <space> <class-name>
<class-name>                    ::= <spaceless-safe-string>
<class-sub-sections>            ::= '' | <class-comment-section> <class-sub-sections> | <field-section> <class-sub-sections> | <method-section> <class-sub-sections> | <class-section> <class-sub-sections>

<field-section>                 ::= <class-section-indentation> <tab> 'FIELD' <space> <field-name-a> <field-name-b> <formatted-access-modifier> <field-desc-a> <eol> <field-sub-sections>
<field-name-a>                  ::= <field-name>
<field-name-b>                  ::= <optional-field-name>
<optional-field-name>           ::= <empty-mapping> | <space> <field-name>
<field-name>                    ::= <spaceless-safe-string>
<field-desc-a>                  ::= <field-desc>
<field-desc>                    ::= <spaceless-safe-string>
<field-sub-sections>            ::= '' | <member-comment-section> <field-sub-sections>

<method-section>                ::= <class-section-indentation> <tab> 'METHOD' <space> <method-name-a> <method-name-b> <formatted-access-modifier> <method-desc-a> <eol> <method-sub-sections>
<method-name-a>                 ::= <method-name>
<method-name-b>                 ::= <optional-method-name>
<optional-method-name>          ::= <empty-mapping> | <space> <method-name>
<method-name>                   ::= <spaceless-safe-string>
<method-desc-a>                 ::= <method-desc>
<method-desc>                   ::= <spaceless-safe-string>
<method-sub-sections>           ::= '' | <member-comment-section> <method-sub-sections> | <method-parameter-section> <method-sub-sections>

<method-parameter-section>      ::= <class-section-indentation> <tab> <tab> 'ARG' <space> <lv-index> <space> <parameter-name-b> <eol> <method-parameter-sub-sections>
<lv-index>                      ::= <non-negative-int>
<parameter-name-b>              ::= <optional-parameter-name>
<optional-parameter-name>       ::= <empty-mapping> | <space> <parameter-name>
<parameter-name>                ::= <spaceless-safe-string>
<method-parameter-sub-sections> ::= '' | <parameter-comment-section> <method-parameter-sub-sections>

<empty-mapping>                 ::= '' | <space> '-'
<formatted-access-modifier>     ::= '' | <space> 'ACC:' <access-modifier>
<access-modifier>               ::= 'UNCHANGED' | 'PUBLIC' | 'PROTECTED' | 'PRIVATE'

<class-comment-section>         ::= '' | <class-section-indentation> <tab> <indented-comment-section> <eol> <class-comment-section>
<member-comment-section>        ::= '' | <class-section-indentation> <tab> <tab> <tab> <indented-comment-section> <eol> <member-comment-section>
<parameter-comment-section>     ::= '' | <class-section-indentation> <tab> <tab> <tab> <tab> <indented-comment-section> <eol> <parameter-comment-section>
<indented-comment-line>         ::= 'COMMENT' <comment-content-line>
<comment-content-line>          ::= <safe-string>

Notes

Miscellaneous Notes