====== 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, [[documentation:tiny2|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 HTML tags 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 ===== ::= ::= '' | ::= 'CLASS' ::= '' | ::= ::= ::= | ::= ::= '' | | | | ::= 'FIELD' ::= ::= ::= | ::= ::= ::= ::= '' | ::= 'METHOD' ::= ::= ::= | ::= ::= ::= ::= '' | | ::= 'ARG' ::= ::= ::= | ::= ::= '' | ::= '' | '-' ::= '' | 'ACC:' ::= 'UNCHANGED' | 'PUBLIC' | 'PROTECTED' | 'PRIVATE' ::= '' | ::= '' | ::= '' | ::= 'COMMENT' ::= ==== Notes ==== * ''%%%%'' is ''\t''. * ''%%%%'' is the space character (''U+0020''). * ''%%%%'' is ''\n'' or ''\r\n''. * ''%%%%'' is a non-empty string that must not contain: * ''\'', * ''\n'', * ''\r'', * ''\t'' or * ''\0''. * ''%%%%'' is the same as ''%%%%'', but in addition mustn't contain ''%%%%'' as well. * Each line of an unprocessed comment string gets its own ''%%%%''. * ''%%%%'' is any integer from 0 to 2147483647 (2^31-1) inclusive, represented as per ''java.lang.Integer.toString()''. * ''%%%%'', is the binary name of a class as specified in JVMS SE 8 §4.2.1. Inner classes get their own ''%%%%'' within their outer class's ''%%%%''. The outer names should be omitted then, though older versions of the format didn't do this. * ''%%%%'' is ''%%''%%'' for top-level ''%%%%''s. Inner classes' ''%%%%'' increases by one ''%%%%'' per nest level. E.g. a doubly-nested inner class ''Outer$Inner$InnerInner'' must have a ''%%%%'' of one ''%%%%'' for ''Inner'' and two ''%%%%''s for ''InnerInner''. * ''%%%%''/''%%%%''/''%%%%'' is the unqualified name of a field/method/parameter as specified in JVMS SE 8 §4.2.2. * ''%%%%'' is a field descriptor as specified in JVMS SE 8 §4.3.2. * ''%%%%'' is a method descriptor as specified in JVMS SE 8 §4.3.3. * ''%%%%'' refers to the local variable array index of the frames having the variable, see "index" in JVMS SE 8 §4.7.13. ===== Miscellaneous Notes ===== * The encoding for the entire file is UTF-8. Escape sequences are limited to the types, locations and conditions mentioned above. * Indenting uses tab characters exclusively, one tab character equals one level. The amount of leading tab characters is at most 1 more than in the preceding line. * Sections with unknown types should be skipped without generating an error. * Sections representing the same element must not be repeated, e.g. there can be only one top-level section for a specific class or one class-level section for a specific member. * Mappings without any (useful) names should be omitted. * Sections without any (useful) mappings or sub-sections should be omitted. * Comments should be without their enclosing syntax elements, indentation or decoration. For example, the comment /** * A comment * on two lines. */ (note the indentation) should be recorded as COMMENT A comment COMMENT on two lines.