mirror of
https://github.com/DMaroo/GhidRust.git
synced 2025-10-06 04:53:57 +02:00
Add C to Rust transpiler
* Add grammar for C and transpile it to Rust code * Add `generate.sh` to generate the JavaCC and JJTree files * Update `build.sh`
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree&JavaCC: Do not edit this line. CParserConstants.java */
|
||||
|
||||
/**
|
||||
* Token literal values and constants.
|
||||
* Generated by org.javacc.parser.OtherFilesGen#start()
|
||||
*/
|
||||
public interface CParserConstants {
|
||||
|
||||
/** End of File. */
|
||||
int EOF = 0;
|
||||
/** RegularExpression Id. */
|
||||
int INTEGER_LITERAL = 12;
|
||||
/** RegularExpression Id. */
|
||||
int DECIMAL_LITERAL = 13;
|
||||
/** RegularExpression Id. */
|
||||
int HEX_LITERAL = 14;
|
||||
/** RegularExpression Id. */
|
||||
int OCTAL_LITERAL = 15;
|
||||
/** RegularExpression Id. */
|
||||
int FLOATING_POINT_LITERAL = 16;
|
||||
/** RegularExpression Id. */
|
||||
int EXPONENT = 17;
|
||||
/** RegularExpression Id. */
|
||||
int CHARACTER_LITERAL = 18;
|
||||
/** RegularExpression Id. */
|
||||
int STRING_LITERAL = 19;
|
||||
/** RegularExpression Id. */
|
||||
int UNDEFINED_TYPE = 20;
|
||||
/** RegularExpression Id. */
|
||||
int CONTINUE = 21;
|
||||
/** RegularExpression Id. */
|
||||
int VOLATILE = 22;
|
||||
/** RegularExpression Id. */
|
||||
int REGISTER = 23;
|
||||
/** RegularExpression Id. */
|
||||
int UNSIGNED = 24;
|
||||
/** RegularExpression Id. */
|
||||
int TYPEDEF = 25;
|
||||
/** RegularExpression Id. */
|
||||
int DFLT = 26;
|
||||
/** RegularExpression Id. */
|
||||
int DOUBLE = 27;
|
||||
/** RegularExpression Id. */
|
||||
int SIZEOF = 28;
|
||||
/** RegularExpression Id. */
|
||||
int SWITCH = 29;
|
||||
/** RegularExpression Id. */
|
||||
int RETURN = 30;
|
||||
/** RegularExpression Id. */
|
||||
int EXTERN = 31;
|
||||
/** RegularExpression Id. */
|
||||
int STRUCT = 32;
|
||||
/** RegularExpression Id. */
|
||||
int STATIC = 33;
|
||||
/** RegularExpression Id. */
|
||||
int SIGNED = 34;
|
||||
/** RegularExpression Id. */
|
||||
int WHILE = 35;
|
||||
/** RegularExpression Id. */
|
||||
int BREAK = 36;
|
||||
/** RegularExpression Id. */
|
||||
int UNION = 37;
|
||||
/** RegularExpression Id. */
|
||||
int CONST = 38;
|
||||
/** RegularExpression Id. */
|
||||
int FLOAT = 39;
|
||||
/** RegularExpression Id. */
|
||||
int SHORT = 40;
|
||||
/** RegularExpression Id. */
|
||||
int ELSE = 41;
|
||||
/** RegularExpression Id. */
|
||||
int CASE = 42;
|
||||
/** RegularExpression Id. */
|
||||
int LONG = 43;
|
||||
/** RegularExpression Id. */
|
||||
int ENUM = 44;
|
||||
/** RegularExpression Id. */
|
||||
int AUTO = 45;
|
||||
/** RegularExpression Id. */
|
||||
int VOID = 46;
|
||||
/** RegularExpression Id. */
|
||||
int CHAR = 47;
|
||||
/** RegularExpression Id. */
|
||||
int GOTO = 48;
|
||||
/** RegularExpression Id. */
|
||||
int FOR = 49;
|
||||
/** RegularExpression Id. */
|
||||
int INT = 50;
|
||||
/** RegularExpression Id. */
|
||||
int IF = 51;
|
||||
/** RegularExpression Id. */
|
||||
int DO = 52;
|
||||
/** RegularExpression Id. */
|
||||
int CODE = 53;
|
||||
/** RegularExpression Id. */
|
||||
int IDENTIFIER = 54;
|
||||
/** RegularExpression Id. */
|
||||
int LETTER = 55;
|
||||
/** RegularExpression Id. */
|
||||
int DIGIT = 56;
|
||||
|
||||
/** Lexical state. */
|
||||
int DEFAULT = 0;
|
||||
/** Lexical state. */
|
||||
int PREPROCESSOR_OUTPUT = 1;
|
||||
|
||||
/** Literal token values. */
|
||||
String[] tokenImage = {
|
||||
"<EOF>",
|
||||
"\" \"",
|
||||
"\"\\t\"",
|
||||
"\"\\n\"",
|
||||
"\"\\r\"",
|
||||
"<token of kind 5>",
|
||||
"<token of kind 6>",
|
||||
"\"#\"",
|
||||
"\"\\n\"",
|
||||
"\"\\\\\\n\"",
|
||||
"\"\\\\\\r\\n\"",
|
||||
"<token of kind 11>",
|
||||
"<INTEGER_LITERAL>",
|
||||
"<DECIMAL_LITERAL>",
|
||||
"<HEX_LITERAL>",
|
||||
"<OCTAL_LITERAL>",
|
||||
"<FLOATING_POINT_LITERAL>",
|
||||
"<EXPONENT>",
|
||||
"<CHARACTER_LITERAL>",
|
||||
"<STRING_LITERAL>",
|
||||
"<UNDEFINED_TYPE>",
|
||||
"\"continue\"",
|
||||
"\"volatile\"",
|
||||
"\"register\"",
|
||||
"\"unsigned\"",
|
||||
"\"typedef\"",
|
||||
"\"default\"",
|
||||
"\"double\"",
|
||||
"\"sizeof\"",
|
||||
"\"switch\"",
|
||||
"\"return\"",
|
||||
"\"extern\"",
|
||||
"\"struct\"",
|
||||
"\"static\"",
|
||||
"\"signed\"",
|
||||
"\"while\"",
|
||||
"\"break\"",
|
||||
"\"union\"",
|
||||
"\"const\"",
|
||||
"\"float\"",
|
||||
"\"short\"",
|
||||
"\"else\"",
|
||||
"\"case\"",
|
||||
"\"long\"",
|
||||
"\"enum\"",
|
||||
"\"auto\"",
|
||||
"\"void\"",
|
||||
"\"char\"",
|
||||
"\"goto\"",
|
||||
"\"for\"",
|
||||
"\"int\"",
|
||||
"\"if\"",
|
||||
"\"do\"",
|
||||
"\"code\"",
|
||||
"<IDENTIFIER>",
|
||||
"<LETTER>",
|
||||
"<DIGIT>",
|
||||
"\";\"",
|
||||
"\",\"",
|
||||
"\"=\"",
|
||||
"\"(\"",
|
||||
"\")\"",
|
||||
"\"[\"",
|
||||
"\"]\"",
|
||||
"\"*\"",
|
||||
"\"...\"",
|
||||
"\"{\"",
|
||||
"\"}\"",
|
||||
"\":\"",
|
||||
"\"*=\"",
|
||||
"\"/=\"",
|
||||
"\"%=\"",
|
||||
"\"+=\"",
|
||||
"\"-=\"",
|
||||
"\"<<=\"",
|
||||
"\">>=\"",
|
||||
"\"&=\"",
|
||||
"\"^=\"",
|
||||
"\"|=\"",
|
||||
"\"?\"",
|
||||
"\"||\"",
|
||||
"\"&&\"",
|
||||
"\"|\"",
|
||||
"\"^\"",
|
||||
"\"&\"",
|
||||
"\"==\"",
|
||||
"\"!=\"",
|
||||
"\"<\"",
|
||||
"\">\"",
|
||||
"\"<=\"",
|
||||
"\">=\"",
|
||||
"\"<<\"",
|
||||
"\">>\"",
|
||||
"\"+\"",
|
||||
"\"-\"",
|
||||
"\"/\"",
|
||||
"\"%\"",
|
||||
"\"++\"",
|
||||
"\"--\"",
|
||||
"\"~\"",
|
||||
"\"!\"",
|
||||
"\".\"",
|
||||
"\"->\"",
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user