More documentation.

This commit is contained in:
Jindra Petřík
2024-08-08 19:27:14 +02:00
parent 5c1811582a
commit f219b49372
394 changed files with 13018 additions and 552 deletions
@@ -145,6 +145,13 @@ public class As12PCodeDocs extends AbstractDocs {
static final String NEWLINE = "\r\n";
/**
* Constructor.
*/
public As12PCodeDocs() {
}
private static String makeIdent(String name) {
StringBuilder identName = new StringBuilder();
boolean cap = false;
@@ -164,6 +171,16 @@ public class As12PCodeDocs extends AbstractDocs {
return identName.toString();
}
/**
* Gets documentation for given instruction.
*
* @param insName Instruction name
* @param ui If true, returns documentation for UI
* @param standalone If true, returns standalone documentation
* @param nightMode If true, uses night mode
* @param argumentToHilight Argument to hilight
* @return Documentation for given instruction
*/
public static String getDocsForIns(String insName, boolean ui, boolean standalone, boolean nightMode, int argumentToHilight) {
insName = insName.toLowerCase();
if (!allInstructionNames.contains(insName)) {
@@ -244,6 +261,10 @@ public class As12PCodeDocs extends AbstractDocs {
return hilightArgument(r, argumentToHilight);
}
/**
* Gets JS code for documentation.
* @return JS code for documentation
*/
public static String getJs() {
String cached = docsCache.get("__js");
if (cached != null) {
@@ -261,6 +282,11 @@ public class As12PCodeDocs extends AbstractDocs {
return js;
}
/**
* Gets all instruction documentation.
* @param nightMode If true, uses night mode
* @return All instruction documentation
*/
public static String getAllInstructionDocs(boolean nightMode) {
String jsData = "";
@@ -293,10 +319,22 @@ public class As12PCodeDocs extends AbstractDocs {
return sb.toString();
}
/**
* Main method.
* @param args Arguments
* @throws UnsupportedEncodingException If encoding is not supported
*/
public static void main(String[] args) throws UnsupportedEncodingException {
System.out.println(getAllInstructionDocs(false));
}
/**
* Gets HTML header.
* @param js JS code
* @param style Style
* @param nightMode If true, uses night mode
* @return HTML header
*/
protected static String htmlHeader(String js, String style, boolean nightMode) {
Date dateGenerated = new Date();
StringBuilder sb = new StringBuilder();
@@ -321,6 +359,11 @@ public class As12PCodeDocs extends AbstractDocs {
return sb.toString();
}
/**
* Gets property.
* @param name Name
* @return Property
*/
protected static String getProperty(String name) {
if (prop.containsKey(name)) {
return Helper.escapeHTML(prop.getString(name));
@@ -64,6 +64,13 @@ public class As3PCodeDocs extends AbstractDocs {
}
}
/**
* Constructor.
*/
public As3PCodeDocs() {
}
private static String makeIdent(String name) {
StringBuilder identName = new StringBuilder();
boolean cap = false;
@@ -83,6 +90,16 @@ public class As3PCodeDocs extends AbstractDocs {
return identName.toString();
}
/**
* Get documentation for instruction.
* @param insName Name of the instruction
* @param showDataSize Show data size
* @param ui UI
* @param withStyle With style
* @param nightMode Night mode
* @param argumentToHilight Argument to hilight
* @return Documentation for instruction
*/
public static String getDocsForIns(String insName, boolean showDataSize, boolean ui, boolean withStyle, boolean nightMode, int argumentToHilight) {
if (!nameToDef.containsKey(insName)) {
return null;
@@ -90,6 +107,16 @@ public class As3PCodeDocs extends AbstractDocs {
return getDocsForIns(nameToDef.get(insName), showDataSize, ui, withStyle, nightMode, argumentToHilight);
}
/**
* Get documentation for instruction.
* @param def Instruction definition
* @param showDataSize Show data size
* @param ui UI
* @param standalone Standalone
* @param nightMode Night mode
* @param argumentToHilight Argument to hilight
* @return Documentation for instruction
*/
public static String getDocsForIns(InstructionDefinition def, boolean showDataSize, boolean ui, boolean standalone, boolean nightMode, int argumentToHilight) {
final String cacheKey = def.instructionName + "|" + (showDataSize ? 1 : 0) + "|" + (ui ? 1 : 0) + "|" + (standalone ? 1 : 0);
String v = docsCache.get(cacheKey);
@@ -239,6 +266,10 @@ public class As3PCodeDocs extends AbstractDocs {
return hilightArgument(r, argumentToHilight);
}
/**
* Gets JavaScript.
* @return JavaScript
*/
public static String getJs() {
String cached = docsCache.get("__js");
if (cached != null) {
@@ -256,6 +287,11 @@ public class As3PCodeDocs extends AbstractDocs {
return js;
}
/**
* Gets all instruction documentation.
* @param nightMode Night mode
* @return All instruction documentation
*/
public static String getAllInstructionDocs(boolean nightMode) {
String jsData = "";
@@ -304,10 +340,22 @@ public class As3PCodeDocs extends AbstractDocs {
return sb.toString();
}
/**
* Main method.
* @param args Arguments
* @throws UnsupportedEncodingException On unsupported encoding
*/
public static void main(String[] args) throws UnsupportedEncodingException {
System.out.println(getAllInstructionDocs(false));
}
/**
* Gets HTML header.
* @param js JavaScript
* @param style Style
* @param nightMode Night mode
* @return HTML header
*/
protected static String htmlHeader(String js, String style, boolean nightMode) {
Date dateGenerated = new Date();
StringBuilder sb = new StringBuilder();
@@ -332,6 +380,11 @@ public class As3PCodeDocs extends AbstractDocs {
return sb.toString();
}
/**
* Gets property.
* @param name Name
* @return Property
*/
protected static String getProperty(String name) {
if (prop.containsKey(name)) {
return Helper.escapeHTML(prop.getString(name));
@@ -34,6 +34,19 @@ public class As3PCodeOtherDocs extends AbstractDocs {
prop = ResourceBundle.getBundle("com.jpexs.decompiler.flash.locales.docs.pcode.AS3other");
}
/**
* Constructor.
*/
public As3PCodeOtherDocs() {
}
/**
* Gets documentation for path.
* @param path Path
* @param nightMode Night mode
* @return Documentation
*/
public static String getDocsForPath(String path, boolean nightMode) {
return getDocsForPath(path, true, nightMode);
@@ -108,6 +121,12 @@ public class As3PCodeOtherDocs extends AbstractDocs {
return r;
}
/**
* Gets HTML header.
* @param js JavaScript
* @param style Style
* @return HTML header
*/
protected static String htmlHeader(String js, String style) {
Date dateGenerated = new Date();
StringBuilder sb = new StringBuilder();
@@ -132,6 +151,11 @@ public class As3PCodeOtherDocs extends AbstractDocs {
return sb.toString();
}
/**
* Gets property.
* @param name Name
* @return Property
*/
protected static String getProperty(String name) {
if (prop.containsKey(name)) {
return Helper.escapeHTML(prop.getString(name));
@@ -23,19 +23,59 @@ package com.jpexs.decompiler.flash.docs;
*/
public class ParsedSymbol {
/**
* End of file
*/
public static int TYPE_EOF = 0;
/**
* Identifier
*/
public static int TYPE_IDENTIFIER = 1;
/**
* Colon
*/
public static int TYPE_COLON = 2;
/**
* Open bracket
*/
public static int TYPE_BRACKET_OPEN = 3;
/**
* Close bracket
*/
public static int TYPE_BRACKET_CLOSE = 4;
/**
* Dots
*/
public static int TYPE_DOTS = 5;
/**
* Comma
*/
public static int TYPE_COMMA = 6;
/**
* Pipe
*/
public static int TYPE_PIPE = 7;
/**
* Star
*/
public static int TYPE_STAR = 8;
/**
* Type
*/
public final int type;
/**
* Value
*/
public final String value;
/**
* Constructor.
*
* @param type Type
* @param value Value
*/
public ParsedSymbol(int type, String value) {
this.type = type;
this.value = value;