mirror of
https://github.com/DMaroo/GhidRust.git
synced 2025-05-22 15:02:06 +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:
parent
6d653d6aef
commit
8f7c12d3fe
build.sh
src/main/java/ghidrust/decompiler
RustDecPlugin.javaRustDecProvider.java
parser
Run.java
c
CVisitor.java
generate.shgen
ASTANDExpression.javaASTAbstractDeclarator.javaASTAdditiveExpression.javaASTArgumentExpressionList.javaASTAssignmentExpression.javaASTAssignmentOperator.javaASTCastExpression.javaASTCompoundStatement.javaASTConditionalExpression.javaASTConstantExpression.javaASTDeclaration.javaASTDeclarationList.javaASTDeclarationSpecifiers.javaASTDeclarator.javaASTDirectAbstractDeclarator.javaASTDirectDeclarator.javaASTEqualityExpression.javaASTExclusiveORExpression.javaASTExpression.javaASTExpressionStatement.javaASTFunctionDefinition.javaASTGhostStringToken.javaASTIdentifierList.javaASTInclusiveORExpression.javaASTInitDeclarator.javaASTInitDeclaratorList.javaASTInitializer.javaASTInitializerList.javaASTIterationStatement.javaASTJumpStatement.javaASTLabeledStatement.javaASTLogicalANDExpression.javaASTLogicalORExpression.javaASTMultiplicativeExpression.javaASTParameterDeclaration.javaASTParameterList.javaASTParameterTypeList.javaASTPointer.javaASTPostfixExpression.javaASTPrimaryExpression.javaASTRelationalExpression.javaASTSelectionStatement.javaASTShiftExpression.javaASTSpecifierQualifierList.javaASTStatement.javaASTStatementList.javaASTStringToken.javaASTTypeName.javaASTTypeQualifierList.javaASTTypeStringToken.javaASTUnaryExpression.javaASTUnaryOperator.javaCParser.javaCParserConstants.javaCParserDefaultVisitor.javaCParserTokenManager.javaCParserTreeConstants.javaCParserVisitor.javaJJTCParserState.javaNode.javaParseException.javaSimpleCharStream.javaSimpleNode.javaToken.javaTokenMgrError.javac.jjc.jjt
2
build.sh
2
build.sh
@ -87,7 +87,7 @@ fi
|
||||
|
||||
status "Installing GhidRust"
|
||||
|
||||
sudo rm -f "$GHIDRA"/*GhidRust* 2> /dev/null
|
||||
sudo rm -f "$GHIDRA"/Extensions/Ghidra/*GhidRust* 2> /dev/null
|
||||
sudo cp dist/* "$GHIDRA"/Extensions/Ghidra
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
|
@ -33,7 +33,7 @@ import docking.action.MenuData;
|
||||
|
||||
//@formatter:off
|
||||
@PluginInfo(
|
||||
status = PluginStatus.RELEASED,
|
||||
status = PluginStatus.STABLE,
|
||||
packageName = "HELLO",
|
||||
category = PluginCategoryNames.DECOMPILER,
|
||||
shortDescription = "Rust Decompiler",
|
||||
|
@ -14,6 +14,8 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ActionListener;
|
||||
@ -27,8 +29,6 @@ public class RustDecProvider extends ComponentProvider {
|
||||
private JPanel panel;
|
||||
private JTextArea code_area;
|
||||
private JLabel func_title;
|
||||
private JToolBar toolbar;
|
||||
private JButton reload;
|
||||
|
||||
private Program prog;
|
||||
private Address addr;
|
||||
@ -56,7 +56,7 @@ public class RustDecProvider extends ComponentProvider {
|
||||
panel = new JPanel(new BorderLayout());
|
||||
|
||||
func_title = new JLabel(EMPTY_LABEL);
|
||||
reload = new JButton(ResourceManager.loadImage("images/reload.png"));
|
||||
JButton reload = new JButton(ResourceManager.loadImage("images/reload.png"));
|
||||
|
||||
reload.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@ -64,15 +64,20 @@ public class RustDecProvider extends ComponentProvider {
|
||||
}
|
||||
});
|
||||
|
||||
toolbar = new JToolBar("GhidRust", JToolBar.HORIZONTAL);
|
||||
JToolBar toolbar = new JToolBar("GhidRust", JToolBar.HORIZONTAL);
|
||||
toolbar.setFloatable(false);
|
||||
toolbar.add(func_title);
|
||||
toolbar.add(Box.createHorizontalGlue());
|
||||
toolbar.add(reload);
|
||||
|
||||
code_area = new JTextArea();
|
||||
code_area.setEditable(false);
|
||||
|
||||
JScrollPane scroll = new JScrollPane(code_area);
|
||||
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
|
||||
panel.add(toolbar, BorderLayout.PAGE_START);
|
||||
panel.add(code_area);
|
||||
panel.add(scroll);
|
||||
}
|
||||
|
||||
public void activateProvider() {
|
||||
|
9
src/main/java/ghidrust/decompiler/parser/Run.java
Normal file
9
src/main/java/ghidrust/decompiler/parser/Run.java
Normal file
@ -0,0 +1,9 @@
|
||||
package ghidrust.decompiler.parser;
|
||||
|
||||
import ghidrust.decompiler.parser.c.gen.CParser;
|
||||
|
||||
public class Run {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(CParser.transpile("int main(int a) { int c = 2; return 0; }"));
|
||||
}
|
||||
}
|
338
src/main/java/ghidrust/decompiler/parser/c/CVisitor.java
Normal file
338
src/main/java/ghidrust/decompiler/parser/c/CVisitor.java
Normal file
@ -0,0 +1,338 @@
|
||||
package ghidrust.decompiler.parser.c;
|
||||
|
||||
import ghidrust.decompiler.parser.c.gen.*;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. CParserDefaultVisitor.java Version 7.0.9 */
|
||||
public class CVisitor implements CParserVisitor {
|
||||
HashMap<String, String> type_map = new HashMap<String, String>();
|
||||
|
||||
int indent_level = 0;
|
||||
|
||||
public CVisitor() {
|
||||
type_map.put("void", "");
|
||||
type_map.put("int", "i32");
|
||||
|
||||
/* Not entirely true, but works for now */
|
||||
type_map.put("char", "char");
|
||||
|
||||
type_map.put("short", "i16");
|
||||
type_map.put("long", "i32");
|
||||
type_map.put("float", "f32");
|
||||
type_map.put("double", "f64");
|
||||
type_map.put("signed", "i32");
|
||||
type_map.put("unsigned", "u32");
|
||||
type_map.put("code", "code");
|
||||
}
|
||||
|
||||
public Object defaultVisit(SimpleNode node, Object data) {
|
||||
StringBuilder sb = new StringBuilder("");
|
||||
|
||||
int child_count = node.jjtGetNumChildren();
|
||||
for (int i = 0; i < child_count; i++) {
|
||||
Node child = node.jjtGetChild(i);
|
||||
String ret = (String) child.jjtAccept(this, data);
|
||||
if (ret != null) {
|
||||
sb.append(ret);
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Object defaultSpacedVisit(SimpleNode node, Object data) {
|
||||
StringBuilder sb = new StringBuilder("");
|
||||
|
||||
int child_count = node.jjtGetNumChildren();
|
||||
for (int i = 0; i < child_count; i++) {
|
||||
Node child = node.jjtGetChild(i);
|
||||
String ret = (String) child.jjtAccept(this, data);
|
||||
if (ret != null) {
|
||||
sb.append(ret);
|
||||
if (!ret.equals("")) {
|
||||
sb.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Object visit(SimpleNode node, Object data) {
|
||||
return node.jjtAccept(this, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTStringToken node, Object data) {
|
||||
return node.getValue();
|
||||
}
|
||||
|
||||
public Object visit(ASTGhostStringToken node, Object data) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public Object visit(ASTTypeStringToken node, Object data) {
|
||||
String typename = node.getValue();
|
||||
|
||||
if (type_map.containsKey(typename)) {
|
||||
return type_map.get(typename);
|
||||
} else {
|
||||
return typename;
|
||||
}
|
||||
}
|
||||
|
||||
public Object visit(ASTFunctionDefinition node, Object data) {
|
||||
node.dump("");
|
||||
StringBuilder rust_code = new StringBuilder("");
|
||||
|
||||
rust_code.append("fn ");
|
||||
rust_code.append(node.jjtGetChild(1).jjtAccept(this, data));
|
||||
rust_code.append("-> ");
|
||||
rust_code.append(node.jjtGetChild(0).jjtAccept(this, data));
|
||||
rust_code.append(" {\n");
|
||||
indent_level++;
|
||||
rust_code.append(node.jjtGetChild(2).jjtAccept(this, data));
|
||||
rust_code.append("\n}\n");
|
||||
indent_level--;
|
||||
|
||||
return rust_code.toString();
|
||||
}
|
||||
|
||||
public Object visit(ASTDeclaration node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTDeclarationList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTDeclarationSpecifiers node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTInitDeclaratorList node, Object data) {
|
||||
if (node.jjtGetNumChildren() == 1) {
|
||||
return node.jjtGetChild(0).jjtAccept(this, data);
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder("&");
|
||||
sb.append(node.jjtGetChild(0).jjtAccept(this, data));
|
||||
sb.append(node.jjtGetChild(1).jjtAccept(this, data));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public Object visit(ASTInitDeclarator node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTSpecifierQualifierList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTDeclarator node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTDirectDeclarator node, Object data) {
|
||||
int child_num = node.jjtGetNumChildren();
|
||||
|
||||
StringBuilder sb = new StringBuilder("");
|
||||
for (int i = 0; i < child_num; i++) {
|
||||
Node child = node.jjtGetChild(i);
|
||||
String child_val = (String) child.jjtAccept(this, data);
|
||||
|
||||
if (child instanceof ASTDeclarator || child instanceof ASTParameterTypeList
|
||||
|| child instanceof ASTIdentifierList) {
|
||||
sb.append("(");
|
||||
sb.append(child_val);
|
||||
sb.append(") ");
|
||||
} else if (child instanceof ASTConstantExpression) {
|
||||
sb.append("[");
|
||||
sb.append(child_val);
|
||||
sb.append("] ");
|
||||
} else {
|
||||
sb.append(child_val);
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Object visit(ASTPointer node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTTypeQualifierList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTParameterTypeList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTParameterList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTParameterDeclaration node, Object data) {
|
||||
StringBuilder param = new StringBuilder((String) defaultSpacedVisit(node, data));
|
||||
/* Get rid of the trailing space */
|
||||
param.setLength(param.length() - 1);
|
||||
return param.toString();
|
||||
}
|
||||
|
||||
public Object visit(ASTIdentifierList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTInitializer node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTInitializerList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTTypeName node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTAbstractDeclarator node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTDirectAbstractDeclarator node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTStatement node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTLabeledStatement node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTExpressionStatement node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTCompoundStatement node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTStatementList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTSelectionStatement node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTIterationStatement node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTJumpStatement node, Object data) {
|
||||
StringBuilder sb = new StringBuilder("");
|
||||
for (int i = 0; i < indent_level; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
|
||||
if (node.jjtGetNumChildren() == 0 || node.jjtGetChild(0) instanceof ASTExpression) {
|
||||
sb.append("return ");
|
||||
sb.append(node.jjtGetChild(0).jjtAccept(this, data));
|
||||
sb.append(";");
|
||||
} else {
|
||||
sb.append(defaultVisit(node, data));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Object visit(ASTExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTAssignmentExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTAssignmentOperator node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTConditionalExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTConstantExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTLogicalORExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTLogicalANDExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTInclusiveORExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTExclusiveORExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTANDExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTEqualityExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTRelationalExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTShiftExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTAdditiveExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTMultiplicativeExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTCastExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTUnaryExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTUnaryOperator node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTPostfixExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTPrimaryExpression node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
|
||||
public Object visit(ASTArgumentExpressionList node, Object data) {
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* JavaCC - OriginalChecksum=fd39d82df2a1b516298b94d6f4a5e997 (do not edit this
|
||||
* line)
|
||||
*/
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTANDExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTANDExpression extends SimpleNode {
|
||||
public ASTANDExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTANDExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=7e93c9974e8f2b14420427b910c803b4 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTAbstractDeclarator.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTAbstractDeclarator extends SimpleNode {
|
||||
public ASTAbstractDeclarator(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTAbstractDeclarator(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=3c80989bb20f86b9b8036d71e7bef9c2 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTAdditiveExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTAdditiveExpression extends SimpleNode {
|
||||
public ASTAdditiveExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTAdditiveExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=f71bb1e7a072d878a992f57313d16468 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTArgumentExpressionList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTArgumentExpressionList extends SimpleNode {
|
||||
public ASTArgumentExpressionList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTArgumentExpressionList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=3d50396a2f3da00f02231d6bf8462c1f (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTAssignmentExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTAssignmentExpression extends SimpleNode {
|
||||
public ASTAssignmentExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTAssignmentExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=4e1bb62c278549e39d52bdb3b3ba2d83 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTAssignmentOperator.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTAssignmentOperator extends SimpleNode {
|
||||
public ASTAssignmentOperator(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTAssignmentOperator(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=12f8178c7ddf074d791222ca3a98afdd (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTCastExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTCastExpression extends SimpleNode {
|
||||
public ASTCastExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTCastExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=5f74743ccea636bb6764ebed2ac163e2 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTCompoundStatement.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTCompoundStatement extends SimpleNode {
|
||||
public ASTCompoundStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTCompoundStatement(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=0e0e31b45cd47c4f4461f95fd3e3de78 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTConditionalExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTConditionalExpression extends SimpleNode {
|
||||
public ASTConditionalExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTConditionalExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=0abef7756156c947795a60956e579484 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTConstantExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTConstantExpression extends SimpleNode {
|
||||
public ASTConstantExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTConstantExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=9f5650e6758d6a765d019f16147af60b (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTDeclaration.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTDeclaration extends SimpleNode {
|
||||
public ASTDeclaration(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTDeclaration(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=348ef19493387532712ee3fd63bef963 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTDeclarationList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTDeclarationList extends SimpleNode {
|
||||
public ASTDeclarationList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTDeclarationList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=74a8d1f0be8d1ac35c19038dd28661b6 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTDeclarationSpecifiers.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTDeclarationSpecifiers extends SimpleNode {
|
||||
public ASTDeclarationSpecifiers(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTDeclarationSpecifiers(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=2696c846786a5a2eade82856402afbaa (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTDeclarator.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTDeclarator extends SimpleNode {
|
||||
public ASTDeclarator(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTDeclarator(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=8171a8ae0c9b5d4aed5906caced0fc03 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTDirectAbstractDeclarator.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTDirectAbstractDeclarator extends SimpleNode {
|
||||
public ASTDirectAbstractDeclarator(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTDirectAbstractDeclarator(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=73556b7b7bb74f11f30bb99721dd1118 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTDirectDeclarator.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTDirectDeclarator extends SimpleNode {
|
||||
public ASTDirectDeclarator(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTDirectDeclarator(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=4b709aa773fb5b1aa3770e5a95e3fa10 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTEqualityExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTEqualityExpression extends SimpleNode {
|
||||
public ASTEqualityExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTEqualityExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=aab2519466666944adaf86111afb0582 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTExclusiveORExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTExclusiveORExpression extends SimpleNode {
|
||||
public ASTExclusiveORExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTExclusiveORExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=6f56922e1bdf9afc2877228247e2891b (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTExpression extends SimpleNode {
|
||||
public ASTExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=9adff7edeff999906ffb1039a66f050d (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTExpressionStatement.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTExpressionStatement extends SimpleNode {
|
||||
public ASTExpressionStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTExpressionStatement(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=1c74fd0cb78ed440334aeeb1769835bf (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTFunctionDefinition.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTFunctionDefinition extends SimpleNode {
|
||||
public ASTFunctionDefinition(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTFunctionDefinition(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=ceed4da5ab63eb8db1c189c0a2b48e1d (do not edit this line) */
|
@ -0,0 +1,33 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTGhostStringToken.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTGhostStringToken extends SimpleNode {
|
||||
String str_value;
|
||||
|
||||
public ASTGhostStringToken(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTGhostStringToken(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
|
||||
public void setValue(String s) {
|
||||
value = s;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return str_value;
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=7d91f560265b12b4f437803bcd66b7ba (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTIdentifierList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTIdentifierList extends SimpleNode {
|
||||
public ASTIdentifierList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTIdentifierList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=4b59a3f78866b6522e8f01a33a7e42ea (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTInclusiveORExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTInclusiveORExpression extends SimpleNode {
|
||||
public ASTInclusiveORExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTInclusiveORExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=4be48bfdf235cd5783ba6d95e5f75d7a (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTInitDeclarator.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTInitDeclarator extends SimpleNode {
|
||||
public ASTInitDeclarator(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTInitDeclarator(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=5a3d91755680a04c5498b43e77500777 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTInitDeclaratorList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTInitDeclaratorList extends SimpleNode {
|
||||
public ASTInitDeclaratorList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTInitDeclaratorList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=a2d08638fd0cf7a82e33e58b0478332a (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTInitializer.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTInitializer extends SimpleNode {
|
||||
public ASTInitializer(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTInitializer(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=1e50ef3004d5c30bf923f81791f50da2 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTInitializerList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTInitializerList extends SimpleNode {
|
||||
public ASTInitializerList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTInitializerList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=558244df30965162e70057ea29c24a1b (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTIterationStatement.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTIterationStatement extends SimpleNode {
|
||||
public ASTIterationStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTIterationStatement(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=7b7c82e89dcb516eca8590537cd9f70a (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTJumpStatement.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTJumpStatement extends SimpleNode {
|
||||
public ASTJumpStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTJumpStatement(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=8f8900c8aee5bbcbce1cd63910a5145a (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTLabeledStatement.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTLabeledStatement extends SimpleNode {
|
||||
public ASTLabeledStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTLabeledStatement(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=90c945b0f67caa48bc985322079aff53 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTLogicalANDExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTLogicalANDExpression extends SimpleNode {
|
||||
public ASTLogicalANDExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTLogicalANDExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=1d00e1b3f3b5cc84eb240091695aa110 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTLogicalORExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTLogicalORExpression extends SimpleNode {
|
||||
public ASTLogicalORExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTLogicalORExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=4b98654445da39285ab465c0e8addd5e (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTMultiplicativeExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTMultiplicativeExpression extends SimpleNode {
|
||||
public ASTMultiplicativeExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTMultiplicativeExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=bc0ec0ccb8aa48f86316c0b7a00f830c (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTParameterDeclaration.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTParameterDeclaration extends SimpleNode {
|
||||
public ASTParameterDeclaration(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTParameterDeclaration(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=4aebee4940a994d0d51c48c5280f9eb8 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTParameterList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTParameterList extends SimpleNode {
|
||||
public ASTParameterList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTParameterList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=4df2dd10fe864789b789e1afaa3b1ed1 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTParameterTypeList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTParameterTypeList extends SimpleNode {
|
||||
public ASTParameterTypeList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTParameterTypeList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=2424e97a6a345ef3f2a72b0086086cb7 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTPointer.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTPointer extends SimpleNode {
|
||||
public ASTPointer(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTPointer(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=e3d91b51bd9822af624c9f60557bbd98 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTPostfixExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTPostfixExpression extends SimpleNode {
|
||||
public ASTPostfixExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTPostfixExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=921e4951da40bb22d131f8b3ba6a1988 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTPrimaryExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTPrimaryExpression extends SimpleNode {
|
||||
public ASTPrimaryExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTPrimaryExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=74ddac2af3988d157a1b94a9d821defd (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTRelationalExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTRelationalExpression extends SimpleNode {
|
||||
public ASTRelationalExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTRelationalExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=819382a46b070e41d5029a3e39fe5a89 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTSelectionStatement.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTSelectionStatement extends SimpleNode {
|
||||
public ASTSelectionStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTSelectionStatement(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=1d0effb2de665660bde555051d4eaf39 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTShiftExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTShiftExpression extends SimpleNode {
|
||||
public ASTShiftExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTShiftExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=6e6a85bea0361907c843fbe90c9de598 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTSpecifierQualifierList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTSpecifierQualifierList extends SimpleNode {
|
||||
public ASTSpecifierQualifierList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTSpecifierQualifierList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=7fafbaad1e5888617b5543d24af0d7e3 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTStatement.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTStatement extends SimpleNode {
|
||||
public ASTStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTStatement(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=c72fe84922519215ac2b49c1d95d7b03 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTStatementList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTStatementList extends SimpleNode {
|
||||
public ASTStatementList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTStatementList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=7d811424c808895d04aa0efe33fefd71 (do not edit this line) */
|
@ -0,0 +1,33 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTStringToken.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTStringToken extends SimpleNode {
|
||||
String str_value;
|
||||
|
||||
public ASTStringToken(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTStringToken(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
|
||||
public void setValue(String s) {
|
||||
str_value = s;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return str_value;
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=c289df07a5b51163b866d4bfab28fb00 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTTypeName.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTTypeName extends SimpleNode {
|
||||
public ASTTypeName(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTTypeName(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=6649fc4e18b27ff4c36885518a37d22c (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTTypeQualifierList.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTTypeQualifierList extends SimpleNode {
|
||||
public ASTTypeQualifierList(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTTypeQualifierList(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=9ed914bbeab9d4fba7337616cdf8c796 (do not edit this line) */
|
@ -0,0 +1,33 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTTypeStringToken.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTTypeStringToken extends SimpleNode {
|
||||
String str_value;
|
||||
|
||||
public ASTTypeStringToken(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTTypeStringToken(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
|
||||
public void setValue(String s) {
|
||||
str_value = s;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return str_value;
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=726f5c0cafc2cba1f5ca608dfd54d3e2 (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTUnaryExpression.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTUnaryExpression extends SimpleNode {
|
||||
public ASTUnaryExpression(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTUnaryExpression(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=d19d61fd0527008bafedc0dbcae70bec (do not edit this line) */
|
@ -0,0 +1,23 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTUnaryOperator.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class ASTUnaryOperator extends SimpleNode {
|
||||
public ASTUnaryOperator(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTUnaryOperator(CParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data) {
|
||||
|
||||
return
|
||||
visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=6c43a4b6e42256ad16599f05ce4392a5 (do not edit this line) */
|
5171
src/main/java/ghidrust/decompiler/parser/c/gen/CParser.java
Normal file
5171
src/main/java/ghidrust/decompiler/parser/c/gen/CParser.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -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>",
|
||||
"\";\"",
|
||||
"\",\"",
|
||||
"\"=\"",
|
||||
"\"(\"",
|
||||
"\")\"",
|
||||
"\"[\"",
|
||||
"\"]\"",
|
||||
"\"*\"",
|
||||
"\"...\"",
|
||||
"\"{\"",
|
||||
"\"}\"",
|
||||
"\":\"",
|
||||
"\"*=\"",
|
||||
"\"/=\"",
|
||||
"\"%=\"",
|
||||
"\"+=\"",
|
||||
"\"-=\"",
|
||||
"\"<<=\"",
|
||||
"\">>=\"",
|
||||
"\"&=\"",
|
||||
"\"^=\"",
|
||||
"\"|=\"",
|
||||
"\"?\"",
|
||||
"\"||\"",
|
||||
"\"&&\"",
|
||||
"\"|\"",
|
||||
"\"^\"",
|
||||
"\"&\"",
|
||||
"\"==\"",
|
||||
"\"!=\"",
|
||||
"\"<\"",
|
||||
"\">\"",
|
||||
"\"<=\"",
|
||||
"\">=\"",
|
||||
"\"<<\"",
|
||||
"\">>\"",
|
||||
"\"+\"",
|
||||
"\"-\"",
|
||||
"\"/\"",
|
||||
"\"%\"",
|
||||
"\"++\"",
|
||||
"\"--\"",
|
||||
"\"~\"",
|
||||
"\"!\"",
|
||||
"\".\"",
|
||||
"\"->\"",
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. CParserDefaultVisitor.java Version 7.0.9 */
|
||||
public class CParserDefaultVisitor implements CParserVisitor{
|
||||
public Object defaultVisit(SimpleNode node, Object data){
|
||||
node.childrenAccept(this, data);
|
||||
return data;
|
||||
}
|
||||
public Object visit(SimpleNode node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTFunctionDefinition node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTDeclaration node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTDeclarationList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTDeclarationSpecifiers node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTGhostStringToken node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTTypeStringToken node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTStringToken node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTInitDeclaratorList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTInitDeclarator node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTSpecifierQualifierList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTDeclarator node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTDirectDeclarator node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTPointer node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTTypeQualifierList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTParameterTypeList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTParameterList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTParameterDeclaration node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTIdentifierList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTInitializer node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTInitializerList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTTypeName node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTAbstractDeclarator node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTDirectAbstractDeclarator node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTStatement node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTLabeledStatement node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTExpressionStatement node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTCompoundStatement node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTStatementList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTSelectionStatement node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTIterationStatement node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTJumpStatement node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTAssignmentExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTAssignmentOperator node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTConditionalExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTConstantExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTLogicalORExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTLogicalANDExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTInclusiveORExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTExclusiveORExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTANDExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTEqualityExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTRelationalExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTShiftExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTAdditiveExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTMultiplicativeExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTCastExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTUnaryExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTUnaryOperator node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTPostfixExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTPrimaryExpression node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
public Object visit(ASTArgumentExpressionList node, Object data){
|
||||
return defaultVisit(node, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=3e084c4d4fc2f72217d78b4001ae5330 (do not edit this line) */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,115 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. CParserTreeConstants.java Version 7.0.9 */
|
||||
public interface CParserTreeConstants
|
||||
{
|
||||
public int JJTFUNCTIONDEFINITION = 0;
|
||||
public int JJTDECLARATION = 1;
|
||||
public int JJTDECLARATIONLIST = 2;
|
||||
public int JJTDECLARATIONSPECIFIERS = 3;
|
||||
public int JJTGHOSTSTRINGTOKEN = 4;
|
||||
public int JJTTYPESTRINGTOKEN = 5;
|
||||
public int JJTSTRINGTOKEN = 6;
|
||||
public int JJTINITDECLARATORLIST = 7;
|
||||
public int JJTINITDECLARATOR = 8;
|
||||
public int JJTSPECIFIERQUALIFIERLIST = 9;
|
||||
public int JJTDECLARATOR = 10;
|
||||
public int JJTDIRECTDECLARATOR = 11;
|
||||
public int JJTPOINTER = 12;
|
||||
public int JJTTYPEQUALIFIERLIST = 13;
|
||||
public int JJTPARAMETERTYPELIST = 14;
|
||||
public int JJTPARAMETERLIST = 15;
|
||||
public int JJTPARAMETERDECLARATION = 16;
|
||||
public int JJTIDENTIFIERLIST = 17;
|
||||
public int JJTINITIALIZER = 18;
|
||||
public int JJTINITIALIZERLIST = 19;
|
||||
public int JJTTYPENAME = 20;
|
||||
public int JJTABSTRACTDECLARATOR = 21;
|
||||
public int JJTDIRECTABSTRACTDECLARATOR = 22;
|
||||
public int JJTSTATEMENT = 23;
|
||||
public int JJTLABELEDSTATEMENT = 24;
|
||||
public int JJTEXPRESSIONSTATEMENT = 25;
|
||||
public int JJTCOMPOUNDSTATEMENT = 26;
|
||||
public int JJTSTATEMENTLIST = 27;
|
||||
public int JJTSELECTIONSTATEMENT = 28;
|
||||
public int JJTITERATIONSTATEMENT = 29;
|
||||
public int JJTJUMPSTATEMENT = 30;
|
||||
public int JJTEXPRESSION = 31;
|
||||
public int JJTASSIGNMENTEXPRESSION = 32;
|
||||
public int JJTASSIGNMENTOPERATOR = 33;
|
||||
public int JJTCONDITIONALEXPRESSION = 34;
|
||||
public int JJTCONSTANTEXPRESSION = 35;
|
||||
public int JJTLOGICALOREXPRESSION = 36;
|
||||
public int JJTLOGICALANDEXPRESSION = 37;
|
||||
public int JJTINCLUSIVEOREXPRESSION = 38;
|
||||
public int JJTEXCLUSIVEOREXPRESSION = 39;
|
||||
public int JJTANDEXPRESSION = 40;
|
||||
public int JJTEQUALITYEXPRESSION = 41;
|
||||
public int JJTRELATIONALEXPRESSION = 42;
|
||||
public int JJTSHIFTEXPRESSION = 43;
|
||||
public int JJTADDITIVEEXPRESSION = 44;
|
||||
public int JJTMULTIPLICATIVEEXPRESSION = 45;
|
||||
public int JJTCASTEXPRESSION = 46;
|
||||
public int JJTUNARYEXPRESSION = 47;
|
||||
public int JJTUNARYOPERATOR = 48;
|
||||
public int JJTPOSTFIXEXPRESSION = 49;
|
||||
public int JJTPRIMARYEXPRESSION = 50;
|
||||
public int JJTARGUMENTEXPRESSIONLIST = 51;
|
||||
|
||||
|
||||
public String[] jjtNodeName = {
|
||||
"FunctionDefinition",
|
||||
"Declaration",
|
||||
"DeclarationList",
|
||||
"DeclarationSpecifiers",
|
||||
"GhostStringToken",
|
||||
"TypeStringToken",
|
||||
"StringToken",
|
||||
"InitDeclaratorList",
|
||||
"InitDeclarator",
|
||||
"SpecifierQualifierList",
|
||||
"Declarator",
|
||||
"DirectDeclarator",
|
||||
"Pointer",
|
||||
"TypeQualifierList",
|
||||
"ParameterTypeList",
|
||||
"ParameterList",
|
||||
"ParameterDeclaration",
|
||||
"IdentifierList",
|
||||
"Initializer",
|
||||
"InitializerList",
|
||||
"TypeName",
|
||||
"AbstractDeclarator",
|
||||
"DirectAbstractDeclarator",
|
||||
"Statement",
|
||||
"LabeledStatement",
|
||||
"ExpressionStatement",
|
||||
"CompoundStatement",
|
||||
"StatementList",
|
||||
"SelectionStatement",
|
||||
"IterationStatement",
|
||||
"JumpStatement",
|
||||
"Expression",
|
||||
"AssignmentExpression",
|
||||
"AssignmentOperator",
|
||||
"ConditionalExpression",
|
||||
"ConstantExpression",
|
||||
"LogicalORExpression",
|
||||
"LogicalANDExpression",
|
||||
"InclusiveORExpression",
|
||||
"ExclusiveORExpression",
|
||||
"ANDExpression",
|
||||
"EqualityExpression",
|
||||
"RelationalExpression",
|
||||
"ShiftExpression",
|
||||
"AdditiveExpression",
|
||||
"MultiplicativeExpression",
|
||||
"CastExpression",
|
||||
"UnaryExpression",
|
||||
"UnaryOperator",
|
||||
"PostfixExpression",
|
||||
"PrimaryExpression",
|
||||
"ArgumentExpressionList",
|
||||
};
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=6481848a6a13fcbf09c2152866d8e998 (do not edit this line) */
|
@ -0,0 +1,60 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. CParserVisitor.java Version 7.0.9 */
|
||||
public interface CParserVisitor
|
||||
{
|
||||
public Object visit(SimpleNode node, Object data);
|
||||
public Object visit(ASTFunctionDefinition node, Object data);
|
||||
public Object visit(ASTDeclaration node, Object data);
|
||||
public Object visit(ASTDeclarationList node, Object data);
|
||||
public Object visit(ASTDeclarationSpecifiers node, Object data);
|
||||
public Object visit(ASTGhostStringToken node, Object data);
|
||||
public Object visit(ASTTypeStringToken node, Object data);
|
||||
public Object visit(ASTStringToken node, Object data);
|
||||
public Object visit(ASTInitDeclaratorList node, Object data);
|
||||
public Object visit(ASTInitDeclarator node, Object data);
|
||||
public Object visit(ASTSpecifierQualifierList node, Object data);
|
||||
public Object visit(ASTDeclarator node, Object data);
|
||||
public Object visit(ASTDirectDeclarator node, Object data);
|
||||
public Object visit(ASTPointer node, Object data);
|
||||
public Object visit(ASTTypeQualifierList node, Object data);
|
||||
public Object visit(ASTParameterTypeList node, Object data);
|
||||
public Object visit(ASTParameterList node, Object data);
|
||||
public Object visit(ASTParameterDeclaration node, Object data);
|
||||
public Object visit(ASTIdentifierList node, Object data);
|
||||
public Object visit(ASTInitializer node, Object data);
|
||||
public Object visit(ASTInitializerList node, Object data);
|
||||
public Object visit(ASTTypeName node, Object data);
|
||||
public Object visit(ASTAbstractDeclarator node, Object data);
|
||||
public Object visit(ASTDirectAbstractDeclarator node, Object data);
|
||||
public Object visit(ASTStatement node, Object data);
|
||||
public Object visit(ASTLabeledStatement node, Object data);
|
||||
public Object visit(ASTExpressionStatement node, Object data);
|
||||
public Object visit(ASTCompoundStatement node, Object data);
|
||||
public Object visit(ASTStatementList node, Object data);
|
||||
public Object visit(ASTSelectionStatement node, Object data);
|
||||
public Object visit(ASTIterationStatement node, Object data);
|
||||
public Object visit(ASTJumpStatement node, Object data);
|
||||
public Object visit(ASTExpression node, Object data);
|
||||
public Object visit(ASTAssignmentExpression node, Object data);
|
||||
public Object visit(ASTAssignmentOperator node, Object data);
|
||||
public Object visit(ASTConditionalExpression node, Object data);
|
||||
public Object visit(ASTConstantExpression node, Object data);
|
||||
public Object visit(ASTLogicalORExpression node, Object data);
|
||||
public Object visit(ASTLogicalANDExpression node, Object data);
|
||||
public Object visit(ASTInclusiveORExpression node, Object data);
|
||||
public Object visit(ASTExclusiveORExpression node, Object data);
|
||||
public Object visit(ASTANDExpression node, Object data);
|
||||
public Object visit(ASTEqualityExpression node, Object data);
|
||||
public Object visit(ASTRelationalExpression node, Object data);
|
||||
public Object visit(ASTShiftExpression node, Object data);
|
||||
public Object visit(ASTAdditiveExpression node, Object data);
|
||||
public Object visit(ASTMultiplicativeExpression node, Object data);
|
||||
public Object visit(ASTCastExpression node, Object data);
|
||||
public Object visit(ASTUnaryExpression node, Object data);
|
||||
public Object visit(ASTUnaryOperator node, Object data);
|
||||
public Object visit(ASTPostfixExpression node, Object data);
|
||||
public Object visit(ASTPrimaryExpression node, Object data);
|
||||
public Object visit(ASTArgumentExpressionList node, Object data);
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=268378ad65a278fa22d6bd4787195a5f (do not edit this line) */
|
@ -0,0 +1,123 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. JJTCParserState.java Version 7.0.9 */
|
||||
public class JJTCParserState {
|
||||
private java.util.List<Node> nodes;
|
||||
private java.util.List<Integer> marks;
|
||||
|
||||
private int sp; // number of nodes on stack
|
||||
private int mk; // current mark
|
||||
private boolean node_created;
|
||||
|
||||
public JJTCParserState() {
|
||||
nodes = new java.util.ArrayList<Node>();
|
||||
marks = new java.util.ArrayList<Integer>();
|
||||
sp = 0;
|
||||
mk = 0;
|
||||
}
|
||||
|
||||
/* Determines whether the current node was actually closed and
|
||||
pushed. This should only be called in the final user action of a
|
||||
node scope. */
|
||||
public boolean nodeCreated() {
|
||||
return node_created;
|
||||
}
|
||||
|
||||
/* Call this to reinitialize the node stack. It is called
|
||||
automatically by the parser's ReInit() method. */
|
||||
public void reset() {
|
||||
nodes.clear();
|
||||
marks.clear();
|
||||
sp = 0;
|
||||
mk = 0;
|
||||
}
|
||||
|
||||
/* Returns the root node of the AST. It only makes sense to call
|
||||
this after a successful parse. */
|
||||
public Node rootNode() {
|
||||
return nodes.get(0);
|
||||
}
|
||||
|
||||
/* Pushes a node on to the stack. */
|
||||
public void pushNode(Node n) {
|
||||
nodes.add(n);
|
||||
++sp;
|
||||
}
|
||||
|
||||
/* Returns the node on the top of the stack, and remove it from the
|
||||
stack. */
|
||||
public Node popNode() {
|
||||
if (--sp < mk) {
|
||||
mk = marks.remove(marks.size()-1);
|
||||
}
|
||||
return nodes.remove(nodes.size()-1);
|
||||
}
|
||||
|
||||
/* Returns the node currently on the top of the stack. */
|
||||
public Node peekNode() {
|
||||
return nodes.get(nodes.size()-1);
|
||||
}
|
||||
|
||||
/* Returns the number of children on the stack in the current node
|
||||
scope. */
|
||||
public int nodeArity() {
|
||||
return sp - mk;
|
||||
}
|
||||
|
||||
|
||||
public void clearNodeScope(Node n) {
|
||||
while (sp > mk) {
|
||||
popNode();
|
||||
}
|
||||
mk = marks.remove(marks.size()-1);
|
||||
}
|
||||
|
||||
|
||||
public void openNodeScope(Node n) {
|
||||
marks.add(mk);
|
||||
mk = sp;
|
||||
n.jjtOpen();
|
||||
}
|
||||
|
||||
|
||||
/* A definite node is constructed from a specified number of
|
||||
children. That number of nodes are popped from the stack and
|
||||
made the children of the definite node. Then the definite node
|
||||
is pushed on to the stack. */
|
||||
public void closeNodeScope(Node n, int num) {
|
||||
mk = marks.remove(marks.size()-1);
|
||||
while (num-- > 0) {
|
||||
Node c = popNode();
|
||||
c.jjtSetParent(n);
|
||||
n.jjtAddChild(c, num);
|
||||
}
|
||||
n.jjtClose();
|
||||
pushNode(n);
|
||||
node_created = true;
|
||||
}
|
||||
|
||||
|
||||
/* A conditional node is constructed if its condition is true. All
|
||||
the nodes that have been pushed since the node was opened are
|
||||
made children of the conditional node, which is then pushed
|
||||
on to the stack. If the condition is false the node is not
|
||||
constructed and they are left on the stack. */
|
||||
public void closeNodeScope(Node n, boolean condition) {
|
||||
if (condition) {
|
||||
int a = nodeArity();
|
||||
mk = marks.remove(marks.size()-1);
|
||||
while (a-- > 0) {
|
||||
Node c = popNode();
|
||||
c.jjtSetParent(n);
|
||||
n.jjtAddChild(c, a);
|
||||
}
|
||||
n.jjtClose();
|
||||
pushNode(n);
|
||||
node_created = true;
|
||||
} else {
|
||||
mk = marks.remove(marks.size()-1);
|
||||
node_created = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=ab6c16d936495b21e639077683ccf423 (do not edit this line) */
|
41
src/main/java/ghidrust/decompiler/parser/c/gen/Node.java
Normal file
41
src/main/java/ghidrust/decompiler/parser/c/gen/Node.java
Normal file
@ -0,0 +1,41 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. Node.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
/* All AST nodes must implement this interface. It provides basic
|
||||
machinery for constructing the parent and child relationships
|
||||
between nodes. */
|
||||
|
||||
public
|
||||
interface Node {
|
||||
|
||||
/** This method is called after the node has been made the current
|
||||
node. It indicates that child nodes can now be added to it. */
|
||||
public void jjtOpen();
|
||||
|
||||
/** This method is called after all the child nodes have been
|
||||
added. */
|
||||
public void jjtClose();
|
||||
|
||||
/** This pair of methods are used to inform the node of its
|
||||
parent. */
|
||||
public void jjtSetParent(Node n);
|
||||
public Node jjtGetParent();
|
||||
|
||||
/** This method tells the node to add its argument to the node's
|
||||
list of children. */
|
||||
public void jjtAddChild(Node n, int i);
|
||||
|
||||
/** This method returns a child node. The children are numbered
|
||||
from zero, left to right. */
|
||||
public Node jjtGetChild(int i);
|
||||
|
||||
/** Return the number of children the node has. */
|
||||
public int jjtGetNumChildren();
|
||||
|
||||
public int getId();
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data);
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=93c32f64ec01c5821c3fb11c9d59d33b (do not edit this line) */
|
@ -0,0 +1,193 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */
|
||||
/* JavaCCOptions:KEEP_LINE_COLUMN=true */
|
||||
/**
|
||||
* This exception is thrown when parse errors are encountered.
|
||||
* You can explicitly create objects of this exception type by
|
||||
* calling the method generateParseException in the generated
|
||||
* parser.
|
||||
*
|
||||
* You can modify this class to customize your error reporting
|
||||
* mechanisms so long as you retain the public fields.
|
||||
*/
|
||||
public class ParseException extends Exception {
|
||||
|
||||
/**
|
||||
* The version identifier for this Serializable class.
|
||||
* Increment only if the <i>serialized</i> form of the
|
||||
* class changes.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The end of line string for this machine.
|
||||
*/
|
||||
protected static String EOL = System.getProperty("line.separator", "\n");
|
||||
|
||||
/**
|
||||
* This constructor is used by the method "generateParseException"
|
||||
* in the generated parser. Calling this constructor generates
|
||||
* a new object of this type with the fields "currentToken",
|
||||
* "expectedTokenSequences", and "tokenImage" set.
|
||||
*/
|
||||
public ParseException(Token currentTokenVal,
|
||||
int[][] expectedTokenSequencesVal,
|
||||
String[] tokenImageVal
|
||||
)
|
||||
{
|
||||
super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
|
||||
currentToken = currentTokenVal;
|
||||
expectedTokenSequences = expectedTokenSequencesVal;
|
||||
tokenImage = tokenImageVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* The following constructors are for use by you for whatever
|
||||
* purpose you can think of. Constructing the exception in this
|
||||
* manner makes the exception behave in the normal way - i.e., as
|
||||
* documented in the class "Throwable". The fields "errorToken",
|
||||
* "expectedTokenSequences", and "tokenImage" do not contain
|
||||
* relevant information. The JavaCC generated code does not use
|
||||
* these constructors.
|
||||
*/
|
||||
|
||||
public ParseException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/** Constructor with message. */
|
||||
public ParseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the last token that has been consumed successfully. If
|
||||
* this object has been created due to a parse error, the token
|
||||
* following this token will (therefore) be the first error token.
|
||||
*/
|
||||
public Token currentToken;
|
||||
|
||||
/**
|
||||
* Each entry in this array is an array of integers. Each array
|
||||
* of integers represents a sequence of tokens (by their ordinal
|
||||
* values) that is expected at this point of the parse.
|
||||
*/
|
||||
public int[][] expectedTokenSequences;
|
||||
|
||||
/**
|
||||
* This is a reference to the "tokenImage" array of the generated
|
||||
* parser within which the parse error occurred. This array is
|
||||
* defined in the generated ...Constants interface.
|
||||
*/
|
||||
public String[] tokenImage;
|
||||
|
||||
/**
|
||||
* It uses "currentToken" and "expectedTokenSequences" to generate a parse
|
||||
* error message and returns it. If this object has been created
|
||||
* due to a parse error, and you do not catch it (it gets thrown
|
||||
* from the parser) the correct error message
|
||||
* gets displayed.
|
||||
*/
|
||||
private static String initialise(Token currentToken,
|
||||
int[][] expectedTokenSequences,
|
||||
String[] tokenImage) {
|
||||
|
||||
StringBuilder expected = new StringBuilder();
|
||||
int maxSize = 0;
|
||||
for (int i = 0; i < expectedTokenSequences.length; i++) {
|
||||
if (maxSize < expectedTokenSequences[i].length) {
|
||||
maxSize = expectedTokenSequences[i].length;
|
||||
}
|
||||
for (int j = 0; j < expectedTokenSequences[i].length; j++) {
|
||||
expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
|
||||
}
|
||||
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
|
||||
expected.append("...");
|
||||
}
|
||||
expected.append(EOL).append(" ");
|
||||
}
|
||||
String retval = "Encountered \"";
|
||||
Token tok = currentToken.next;
|
||||
for (int i = 0; i < maxSize; i++) {
|
||||
if (i != 0) retval += " ";
|
||||
if (tok.kind == 0) {
|
||||
retval += tokenImage[0];
|
||||
break;
|
||||
}
|
||||
retval += " " + tokenImage[tok.kind];
|
||||
retval += " \"";
|
||||
retval += add_escapes(tok.image);
|
||||
retval += " \"";
|
||||
tok = tok.next;
|
||||
}
|
||||
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
|
||||
retval += "." + EOL;
|
||||
|
||||
|
||||
if (expectedTokenSequences.length == 0) {
|
||||
// Nothing to add here
|
||||
} else {
|
||||
if (expectedTokenSequences.length == 1) {
|
||||
retval += "Was expecting:" + EOL + " ";
|
||||
} else {
|
||||
retval += "Was expecting one of:" + EOL + " ";
|
||||
}
|
||||
retval += expected.toString();
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to convert raw characters to their escaped version
|
||||
* when these raw version cannot be used as part of an ASCII
|
||||
* string literal.
|
||||
*/
|
||||
static String add_escapes(String str) {
|
||||
StringBuilder retval = new StringBuilder();
|
||||
char ch;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
switch (str.charAt(i))
|
||||
{
|
||||
case '\b':
|
||||
retval.append("\\b");
|
||||
continue;
|
||||
case '\t':
|
||||
retval.append("\\t");
|
||||
continue;
|
||||
case '\n':
|
||||
retval.append("\\n");
|
||||
continue;
|
||||
case '\f':
|
||||
retval.append("\\f");
|
||||
continue;
|
||||
case '\r':
|
||||
retval.append("\\r");
|
||||
continue;
|
||||
case '\"':
|
||||
retval.append("\\\"");
|
||||
continue;
|
||||
case '\'':
|
||||
retval.append("\\\'");
|
||||
continue;
|
||||
case '\\':
|
||||
retval.append("\\\\");
|
||||
continue;
|
||||
default:
|
||||
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
|
||||
String s = "0000" + Integer.toString(ch, 16);
|
||||
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
|
||||
} else {
|
||||
retval.append(ch);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return retval.toString();
|
||||
}
|
||||
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=0fbdc1f3a882b6ef66ce3f2a7a0e4228 (do not edit this line) */
|
@ -0,0 +1,478 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 7.0 */
|
||||
/* JavaCCOptions:STATIC=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
/**
|
||||
* An implementation of interface CharStream, where the stream is assumed to
|
||||
* contain only ASCII characters (without unicode processing).
|
||||
*/
|
||||
|
||||
public class SimpleCharStream
|
||||
{
|
||||
/** Whether parser is static. */
|
||||
public static final boolean staticFlag = true;
|
||||
static int bufsize;
|
||||
static int available;
|
||||
static int tokenBegin;
|
||||
/** Position in buffer. */
|
||||
static public int bufpos = -1;
|
||||
static protected int bufline[];
|
||||
static protected int bufcolumn[];
|
||||
|
||||
static protected int column = 0;
|
||||
static protected int line = 1;
|
||||
|
||||
static protected boolean prevCharIsCR = false;
|
||||
static protected boolean prevCharIsLF = false;
|
||||
|
||||
static protected java.io.Reader inputStream;
|
||||
|
||||
static protected char[] buffer;
|
||||
static protected int maxNextCharInd = 0;
|
||||
static protected int inBuf = 0;
|
||||
static protected int tabSize = 1;
|
||||
static protected boolean trackLineColumn = true;
|
||||
|
||||
static public void setTabSize(int i) { tabSize = i; }
|
||||
static public int getTabSize() { return tabSize; }
|
||||
|
||||
|
||||
|
||||
static protected void ExpandBuff(boolean wrapAround)
|
||||
{
|
||||
char[] newbuffer = new char[bufsize + 2048];
|
||||
int newbufline[] = new int[bufsize + 2048];
|
||||
int newbufcolumn[] = new int[bufsize + 2048];
|
||||
|
||||
try
|
||||
{
|
||||
if (wrapAround)
|
||||
{
|
||||
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
|
||||
System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
|
||||
buffer = newbuffer;
|
||||
|
||||
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
|
||||
System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
|
||||
bufline = newbufline;
|
||||
|
||||
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
|
||||
System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
|
||||
bufcolumn = newbufcolumn;
|
||||
|
||||
maxNextCharInd = (bufpos += (bufsize - tokenBegin));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
|
||||
buffer = newbuffer;
|
||||
|
||||
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
|
||||
bufline = newbufline;
|
||||
|
||||
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
|
||||
bufcolumn = newbufcolumn;
|
||||
|
||||
maxNextCharInd = (bufpos -= tokenBegin);
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new Error(t.getMessage());
|
||||
}
|
||||
|
||||
|
||||
bufsize += 2048;
|
||||
available = bufsize;
|
||||
tokenBegin = 0;
|
||||
}
|
||||
|
||||
static protected void FillBuff() throws java.io.IOException
|
||||
{
|
||||
if (maxNextCharInd == available)
|
||||
{
|
||||
if (available == bufsize)
|
||||
{
|
||||
if (tokenBegin > 2048)
|
||||
{
|
||||
bufpos = maxNextCharInd = 0;
|
||||
available = tokenBegin;
|
||||
}
|
||||
else if (tokenBegin < 0)
|
||||
bufpos = maxNextCharInd = 0;
|
||||
else
|
||||
ExpandBuff(false);
|
||||
}
|
||||
else if (available > tokenBegin)
|
||||
available = bufsize;
|
||||
else if ((tokenBegin - available) < 2048)
|
||||
ExpandBuff(true);
|
||||
else
|
||||
available = tokenBegin;
|
||||
}
|
||||
|
||||
int i;
|
||||
try {
|
||||
if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
|
||||
{
|
||||
inputStream.close();
|
||||
throw new java.io.IOException();
|
||||
}
|
||||
else
|
||||
maxNextCharInd += i;
|
||||
return;
|
||||
}
|
||||
catch(java.io.IOException e) {
|
||||
--bufpos;
|
||||
backup(0);
|
||||
if (tokenBegin == -1)
|
||||
tokenBegin = bufpos;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/** Start. */
|
||||
static public char BeginToken() throws java.io.IOException
|
||||
{
|
||||
tokenBegin = -1;
|
||||
char c = readChar();
|
||||
tokenBegin = bufpos;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static protected void UpdateLineColumn(char c)
|
||||
{
|
||||
column++;
|
||||
|
||||
if (prevCharIsLF)
|
||||
{
|
||||
prevCharIsLF = false;
|
||||
line += (column = 1);
|
||||
}
|
||||
else if (prevCharIsCR)
|
||||
{
|
||||
prevCharIsCR = false;
|
||||
if (c == '\n')
|
||||
{
|
||||
prevCharIsLF = true;
|
||||
}
|
||||
else
|
||||
line += (column = 1);
|
||||
}
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r' :
|
||||
prevCharIsCR = true;
|
||||
break;
|
||||
case '\n' :
|
||||
prevCharIsLF = true;
|
||||
break;
|
||||
case '\t' :
|
||||
column--;
|
||||
column += (tabSize - (column % tabSize));
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
bufline[bufpos] = line;
|
||||
bufcolumn[bufpos] = column;
|
||||
}
|
||||
|
||||
/** Read a character. */
|
||||
static public char readChar() throws java.io.IOException
|
||||
{
|
||||
if (inBuf > 0)
|
||||
{
|
||||
--inBuf;
|
||||
|
||||
if (++bufpos == bufsize)
|
||||
bufpos = 0;
|
||||
|
||||
return buffer[bufpos];
|
||||
}
|
||||
|
||||
if (++bufpos >= maxNextCharInd)
|
||||
FillBuff();
|
||||
|
||||
char c = buffer[bufpos];
|
||||
|
||||
UpdateLineColumn(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated
|
||||
* @see #getEndColumn
|
||||
*/
|
||||
|
||||
static public int getColumn() {
|
||||
return bufcolumn[bufpos];
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated
|
||||
* @see #getEndLine
|
||||
*/
|
||||
|
||||
static public int getLine() {
|
||||
return bufline[bufpos];
|
||||
}
|
||||
|
||||
/** Get token end column number. */
|
||||
static public int getEndColumn() {
|
||||
return bufcolumn[bufpos];
|
||||
}
|
||||
|
||||
/** Get token end line number. */
|
||||
static public int getEndLine() {
|
||||
return bufline[bufpos];
|
||||
}
|
||||
|
||||
/** Get token beginning column number. */
|
||||
static public int getBeginColumn() {
|
||||
return bufcolumn[tokenBegin];
|
||||
}
|
||||
|
||||
/** Get token beginning line number. */
|
||||
static public int getBeginLine() {
|
||||
return bufline[tokenBegin];
|
||||
}
|
||||
|
||||
/** Backup a number of characters. */
|
||||
static public void backup(int amount) {
|
||||
|
||||
inBuf += amount;
|
||||
if ((bufpos -= amount) < 0)
|
||||
bufpos += bufsize;
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.Reader dstream, int startline,
|
||||
int startcolumn, int buffersize)
|
||||
{
|
||||
if (inputStream != null)
|
||||
throw new Error("\n ERROR: Second call to the constructor of a static SimpleCharStream.\n" +
|
||||
" You must either use ReInit() or set the JavaCC option STATIC to false\n" +
|
||||
" during the generation of this class.");
|
||||
inputStream = dstream;
|
||||
line = startline;
|
||||
column = startcolumn - 1;
|
||||
|
||||
available = bufsize = buffersize;
|
||||
buffer = new char[buffersize];
|
||||
bufline = new int[buffersize];
|
||||
bufcolumn = new int[buffersize];
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.Reader dstream, int startline,
|
||||
int startcolumn)
|
||||
{
|
||||
this(dstream, startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.Reader dstream)
|
||||
{
|
||||
this(dstream, 1, 1, 4096);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.Reader dstream, int startline,
|
||||
int startcolumn, int buffersize)
|
||||
{
|
||||
inputStream = dstream;
|
||||
line = startline;
|
||||
column = startcolumn - 1;
|
||||
|
||||
if (buffer == null || buffersize != buffer.length)
|
||||
{
|
||||
available = bufsize = buffersize;
|
||||
buffer = new char[buffersize];
|
||||
bufline = new int[buffersize];
|
||||
bufcolumn = new int[buffersize];
|
||||
}
|
||||
prevCharIsLF = prevCharIsCR = false;
|
||||
tokenBegin = inBuf = maxNextCharInd = 0;
|
||||
bufpos = -1;
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.Reader dstream, int startline,
|
||||
int startcolumn)
|
||||
{
|
||||
ReInit(dstream, startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.Reader dstream)
|
||||
{
|
||||
ReInit(dstream, 1, 1, 4096);
|
||||
}
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
|
||||
int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.InputStream dstream, int startline,
|
||||
int startcolumn, int buffersize)
|
||||
{
|
||||
this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
|
||||
int startcolumn) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(dstream, encoding, startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.InputStream dstream, int startline,
|
||||
int startcolumn)
|
||||
{
|
||||
this(dstream, startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(dstream, encoding, 1, 1, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public SimpleCharStream(java.io.InputStream dstream)
|
||||
{
|
||||
this(dstream, 1, 1, 4096);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
|
||||
int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, int startline,
|
||||
int startcolumn, int buffersize)
|
||||
{
|
||||
ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
ReInit(dstream, encoding, 1, 1, 4096);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream)
|
||||
{
|
||||
ReInit(dstream, 1, 1, 4096);
|
||||
}
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
|
||||
int startcolumn) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
ReInit(dstream, encoding, startline, startcolumn, 4096);
|
||||
}
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, int startline,
|
||||
int startcolumn)
|
||||
{
|
||||
ReInit(dstream, startline, startcolumn, 4096);
|
||||
}
|
||||
/** Get token literal value. */
|
||||
static public String GetImage()
|
||||
{
|
||||
if (bufpos >= tokenBegin)
|
||||
return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
|
||||
else
|
||||
return new String(buffer, tokenBegin, bufsize - tokenBegin) +
|
||||
new String(buffer, 0, bufpos + 1);
|
||||
}
|
||||
|
||||
/** Get the suffix. */
|
||||
static public char[] GetSuffix(int len)
|
||||
{
|
||||
char[] ret = new char[len];
|
||||
|
||||
if ((bufpos + 1) >= len)
|
||||
System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
|
||||
else
|
||||
{
|
||||
System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
|
||||
len - bufpos - 1);
|
||||
System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Reset buffer when finished. */
|
||||
static public void Done()
|
||||
{
|
||||
buffer = null;
|
||||
bufline = null;
|
||||
bufcolumn = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to adjust line and column numbers for the start of a token.
|
||||
*/
|
||||
static public void adjustBeginLineColumn(int newLine, int newCol)
|
||||
{
|
||||
int start = tokenBegin;
|
||||
int len;
|
||||
|
||||
if (bufpos >= tokenBegin)
|
||||
{
|
||||
len = bufpos - tokenBegin + inBuf + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
|
||||
}
|
||||
|
||||
int i = 0, j = 0, k = 0;
|
||||
int nextColDiff = 0, columnDiff = 0;
|
||||
|
||||
while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
|
||||
{
|
||||
bufline[j] = newLine;
|
||||
nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
|
||||
bufcolumn[j] = newCol + columnDiff;
|
||||
columnDiff = nextColDiff;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i < len)
|
||||
{
|
||||
bufline[j] = newLine++;
|
||||
bufcolumn[j] = newCol + columnDiff;
|
||||
|
||||
while (i++ < len)
|
||||
{
|
||||
if (bufline[j = start % bufsize] != bufline[++start % bufsize])
|
||||
bufline[j] = newLine++;
|
||||
else
|
||||
bufline[j] = newLine;
|
||||
}
|
||||
}
|
||||
|
||||
line = bufline[j];
|
||||
column = bufcolumn[j];
|
||||
}
|
||||
static boolean getTrackLineColumn() { return trackLineColumn; }
|
||||
static void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; }
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=052d2c8783a7a693ccde91d90feb1d3b (do not edit this line) */
|
102
src/main/java/ghidrust/decompiler/parser/c/gen/SimpleNode.java
Normal file
102
src/main/java/ghidrust/decompiler/parser/c/gen/SimpleNode.java
Normal file
@ -0,0 +1,102 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 7.0 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
public
|
||||
class SimpleNode implements Node {
|
||||
|
||||
protected Node parent;
|
||||
protected Node[] children;
|
||||
protected int id;
|
||||
protected Object value;
|
||||
protected CParser parser;
|
||||
|
||||
public SimpleNode(int i) {
|
||||
id = i;
|
||||
}
|
||||
|
||||
public SimpleNode(CParser p, int i) {
|
||||
this(i);
|
||||
parser = p;
|
||||
}
|
||||
|
||||
public void jjtOpen() {
|
||||
}
|
||||
|
||||
public void jjtClose() {
|
||||
}
|
||||
|
||||
public void jjtSetParent(Node n) { parent = n; }
|
||||
public Node jjtGetParent() { return parent; }
|
||||
|
||||
public void jjtAddChild(Node n, int i) {
|
||||
if (children == null) {
|
||||
children = new Node[i + 1];
|
||||
} else if (i >= children.length) {
|
||||
Node c[] = new Node[i + 1];
|
||||
System.arraycopy(children, 0, c, 0, children.length);
|
||||
children = c;
|
||||
}
|
||||
children[i] = n;
|
||||
}
|
||||
|
||||
public Node jjtGetChild(int i) {
|
||||
return children[i];
|
||||
}
|
||||
|
||||
public int jjtGetNumChildren() {
|
||||
return (children == null) ? 0 : children.length;
|
||||
}
|
||||
|
||||
public void jjtSetValue(Object value) { this.value = value; }
|
||||
public Object jjtGetValue() { return value; }
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object jjtAccept(CParserVisitor visitor, Object data)
|
||||
{
|
||||
return visitor.visit(this, data);
|
||||
}
|
||||
|
||||
/** Accept the visitor. **/
|
||||
public Object childrenAccept(CParserVisitor visitor, Object data)
|
||||
{
|
||||
if (children != null) {
|
||||
for (int i = 0; i < children.length; ++i) {
|
||||
children[i].jjtAccept(visitor, data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/* You can override these two methods in subclasses of SimpleNode to
|
||||
customize the way the node appears when the tree is dumped. If
|
||||
your output uses more than one line you should override
|
||||
toString(String), otherwise overriding toString() is probably all
|
||||
you need to do. */
|
||||
|
||||
public String toString() {
|
||||
return CParserTreeConstants.jjtNodeName[id];
|
||||
}
|
||||
public String toString(String prefix) { return prefix + toString(); }
|
||||
|
||||
/* Override this method if you want to customize how the node dumps
|
||||
out its children. */
|
||||
|
||||
public void dump(String prefix) {
|
||||
System.out.println(toString(prefix));
|
||||
if (children != null) {
|
||||
for (int i = 0; i < children.length; ++i) {
|
||||
SimpleNode n = (SimpleNode)children[i];
|
||||
if (n != null) {
|
||||
n.dump(prefix + " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
/* JavaCC - OriginalChecksum=97592567112e82e2388d067919812e6e (do not edit this line) */
|
132
src/main/java/ghidrust/decompiler/parser/c/gen/Token.java
Normal file
132
src/main/java/ghidrust/decompiler/parser/c/gen/Token.java
Normal file
@ -0,0 +1,132 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */
|
||||
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
/**
|
||||
* Describes the input token stream.
|
||||
*/
|
||||
|
||||
public class Token implements java.io.Serializable {
|
||||
|
||||
/**
|
||||
* The version identifier for this Serializable class.
|
||||
* Increment only if the <i>serialized</i> form of the
|
||||
* class changes.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* An integer that describes the kind of this token. This numbering
|
||||
* system is determined by JavaCCParser, and a table of these numbers is
|
||||
* stored in the file ...Constants.java.
|
||||
*/
|
||||
public int kind;
|
||||
|
||||
/** The line number of the first character of this Token. */
|
||||
public int beginLine;
|
||||
/** The column number of the first character of this Token. */
|
||||
public int beginColumn;
|
||||
/** The line number of the last character of this Token. */
|
||||
public int endLine;
|
||||
/** The column number of the last character of this Token. */
|
||||
public int endColumn;
|
||||
|
||||
/**
|
||||
* The string image of the token.
|
||||
*/
|
||||
public String image;
|
||||
|
||||
/**
|
||||
* A reference to the next regular (non-special) token from the input
|
||||
* stream. If this is the last token from the input stream, or if the
|
||||
* token manager has not read tokens beyond this one, this field is
|
||||
* set to null. This is true only if this token is also a regular
|
||||
* token. Otherwise, see below for a description of the contents of
|
||||
* this field.
|
||||
*/
|
||||
public Token next;
|
||||
|
||||
/**
|
||||
* This field is used to access special tokens that occur prior to this
|
||||
* token, but after the immediately preceding regular (non-special) token.
|
||||
* If there are no such special tokens, this field is set to null.
|
||||
* When there are more than one such special token, this field refers
|
||||
* to the last of these special tokens, which in turn refers to the next
|
||||
* previous special token through its specialToken field, and so on
|
||||
* until the first special token (whose specialToken field is null).
|
||||
* The next fields of special tokens refer to other special tokens that
|
||||
* immediately follow it (without an intervening regular token). If there
|
||||
* is no such token, this field is null.
|
||||
*/
|
||||
public Token specialToken;
|
||||
|
||||
/**
|
||||
* An optional attribute value of the Token.
|
||||
* Tokens which are not used as syntactic sugar will often contain
|
||||
* meaningful values that will be used later on by the compiler or
|
||||
* interpreter. This attribute value is often different from the image.
|
||||
* Any subclass of Token that actually wants to return a non-null value can
|
||||
* override this method as appropriate.
|
||||
*/
|
||||
public Object getValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* No-argument constructor
|
||||
*/
|
||||
public Token() {}
|
||||
|
||||
/**
|
||||
* Constructs a new token for the specified Image.
|
||||
*/
|
||||
public Token(int kind)
|
||||
{
|
||||
this(kind, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new token for the specified Image and Kind.
|
||||
*/
|
||||
public Token(int kind, String image)
|
||||
{
|
||||
this.kind = kind;
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the image.
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new Token object, by default. However, if you want, you
|
||||
* can create and return subclass objects based on the value of ofKind.
|
||||
* Simply add the cases to the switch for all those special cases.
|
||||
* For example, if you have a subclass of Token called IDToken that
|
||||
* you want to create if ofKind is ID, simply add something like :
|
||||
*
|
||||
* case MyParserConstants.ID : return new IDToken(ofKind, image);
|
||||
*
|
||||
* to the following switch statement. Then you can cast matchedToken
|
||||
* variable to the appropriate type and use sit in your lexical actions.
|
||||
*/
|
||||
public static Token newToken(int ofKind, String image)
|
||||
{
|
||||
switch(ofKind)
|
||||
{
|
||||
default : return new Token(ofKind, image);
|
||||
}
|
||||
}
|
||||
|
||||
public static Token newToken(int ofKind)
|
||||
{
|
||||
return newToken(ofKind, null);
|
||||
}
|
||||
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=093f73b266edc0ed6a424fcd3b5446d1 (do not edit this line) */
|
@ -0,0 +1,147 @@
|
||||
package ghidrust.decompiler.parser.c.gen;
|
||||
|
||||
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */
|
||||
/* JavaCCOptions: */
|
||||
/** Token Manager Error. */
|
||||
public class TokenMgrError extends Error
|
||||
{
|
||||
|
||||
/**
|
||||
* The version identifier for this Serializable class.
|
||||
* Increment only if the <i>serialized</i> form of the
|
||||
* class changes.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Ordinals for various reasons why an Error of this type can be thrown.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Lexical error occurred.
|
||||
*/
|
||||
public static final int LEXICAL_ERROR = 0;
|
||||
|
||||
/**
|
||||
* An attempt was made to create a second instance of a static token manager.
|
||||
*/
|
||||
public static final int STATIC_LEXER_ERROR = 1;
|
||||
|
||||
/**
|
||||
* Tried to change to an invalid lexical state.
|
||||
*/
|
||||
public static final int INVALID_LEXICAL_STATE = 2;
|
||||
|
||||
/**
|
||||
* Detected (and bailed out of) an infinite loop in the token manager.
|
||||
*/
|
||||
public static final int LOOP_DETECTED = 3;
|
||||
|
||||
/**
|
||||
* Indicates the reason why the exception is thrown. It will have
|
||||
* one of the above 4 values.
|
||||
*/
|
||||
int errorCode;
|
||||
|
||||
/**
|
||||
* Replaces unprintable characters by their escaped (or unicode escaped)
|
||||
* equivalents in the given string
|
||||
*/
|
||||
protected static final String addEscapes(String str) {
|
||||
StringBuilder retval = new StringBuilder();
|
||||
char ch;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
switch (str.charAt(i))
|
||||
{
|
||||
case '\b':
|
||||
retval.append("\\b");
|
||||
continue;
|
||||
case '\t':
|
||||
retval.append("\\t");
|
||||
continue;
|
||||
case '\n':
|
||||
retval.append("\\n");
|
||||
continue;
|
||||
case '\f':
|
||||
retval.append("\\f");
|
||||
continue;
|
||||
case '\r':
|
||||
retval.append("\\r");
|
||||
continue;
|
||||
case '\"':
|
||||
retval.append("\\\"");
|
||||
continue;
|
||||
case '\'':
|
||||
retval.append("\\\'");
|
||||
continue;
|
||||
case '\\':
|
||||
retval.append("\\\\");
|
||||
continue;
|
||||
default:
|
||||
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
|
||||
String s = "0000" + Integer.toString(ch, 16);
|
||||
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
|
||||
} else {
|
||||
retval.append(ch);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return retval.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a detailed message for the Error when it is thrown by the
|
||||
* token manager to indicate a lexical error.
|
||||
* Parameters :
|
||||
* EOFSeen : indicates if EOF caused the lexical error
|
||||
* curLexState : lexical state in which this error occurred
|
||||
* errorLine : line number when the error occurred
|
||||
* errorColumn : column number when the error occurred
|
||||
* errorAfter : prefix that was seen before this error occurred
|
||||
* curchar : the offending character
|
||||
* Note: You can customize the lexical error message by modifying this method.
|
||||
*/
|
||||
protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) {
|
||||
char curChar1 = (char)curChar;
|
||||
return("Lexical error at line " +
|
||||
errorLine + ", column " +
|
||||
errorColumn + ". Encountered: " +
|
||||
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + curChar + "), ") +
|
||||
"after : \"" + addEscapes(errorAfter) + "\"");
|
||||
}
|
||||
|
||||
/**
|
||||
* You can also modify the body of this method to customize your error messages.
|
||||
* For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
|
||||
* of end-users concern, so you can return something like :
|
||||
*
|
||||
* "Internal Error : Please file a bug report .... "
|
||||
*
|
||||
* from this method for such cases in the release version of your parser.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return super.getMessage();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructors of various flavors follow.
|
||||
*/
|
||||
|
||||
/** No arg constructor. */
|
||||
public TokenMgrError() {
|
||||
}
|
||||
|
||||
/** Constructor with message and reason. */
|
||||
public TokenMgrError(String message, int reason) {
|
||||
super(message);
|
||||
errorCode = reason;
|
||||
}
|
||||
|
||||
/** Full Constructor. */
|
||||
public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) {
|
||||
this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=9e201c978d59ab6f122a52837e6310b1 (do not edit this line) */
|
1817
src/main/java/ghidrust/decompiler/parser/c/gen/c.jj
Normal file
1817
src/main/java/ghidrust/decompiler/parser/c/gen/c.jj
Normal file
File diff suppressed because it is too large
Load Diff
477
src/main/java/ghidrust/decompiler/parser/c/gen/c.jjt
Normal file
477
src/main/java/ghidrust/decompiler/parser/c/gen/c.jjt
Normal file
@ -0,0 +1,477 @@
|
||||
/*
|
||||
C grammar and JJTree definition for use with JavaCC
|
||||
Contributed by Doug South (dsouth@squirrel.com.au) 21/3/97
|
||||
From: https://github.com/javacc/javacc/blob/master/grammars/CParser.jj
|
||||
*/
|
||||
|
||||
/* The following code has been significantly modified so as to make it compatible with Ghidra's decompiled output
|
||||
* and for the Rust transpilation
|
||||
*/
|
||||
|
||||
options {
|
||||
MULTI = true;
|
||||
VISITOR = true;
|
||||
}
|
||||
|
||||
PARSER_BEGIN(CParser)
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import ghidrust.decompiler.parser.c.CVisitor;
|
||||
|
||||
public class CParser {
|
||||
private static CParser c_parser;
|
||||
|
||||
// Run the parser
|
||||
public static String transpile(String c_code) {
|
||||
InputStream stream = new ByteArrayInputStream(c_code.getBytes(StandardCharsets.UTF_8));
|
||||
c_parser = new CParser(stream);
|
||||
|
||||
try {
|
||||
return parse();
|
||||
} catch (ParseException e) {
|
||||
System.out.println("Rust transpiler: Encountered errors during parsing.");
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String parse() throws ParseException {
|
||||
CParserVisitor visitor = new CVisitor();
|
||||
return (String) c_parser.FunctionDefinition().jjtAccept(visitor, null);
|
||||
}
|
||||
}
|
||||
|
||||
PARSER_END(CParser)
|
||||
|
||||
SKIP : {
|
||||
" "
|
||||
| "\t"
|
||||
| "\n"
|
||||
| "\r"
|
||||
| <"//" (~["\n","\r"])* ("\n" | "\r" | "\r\n")>
|
||||
| <"/*" (~["*"])* "*" ("*" | ~["*","/"] (~["*"])* "*")* "/">
|
||||
| "#" : PREPROCESSOR_OUTPUT
|
||||
}
|
||||
|
||||
<PREPROCESSOR_OUTPUT> SKIP:
|
||||
{
|
||||
"\n" : DEFAULT
|
||||
}
|
||||
|
||||
<PREPROCESSOR_OUTPUT> MORE:
|
||||
{
|
||||
"\\\n"
|
||||
|
|
||||
"\\\r\n"
|
||||
|
|
||||
< ~[] >
|
||||
}
|
||||
|
||||
|
||||
TOKEN : {
|
||||
<INTEGER_LITERAL: <DECIMAL_LITERAL> (["l","L"])? | <HEX_LITERAL> (["l","L"])? | <OCTAL_LITERAL> (["l","L"])?>
|
||||
| <#DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])*>
|
||||
| <#HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+>
|
||||
| <#OCTAL_LITERAL: "0" (["0"-"7"])*>
|
||||
| <FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])? | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])? | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])? | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]>
|
||||
| <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+>
|
||||
| <CHARACTER_LITERAL: "\'" (~["\'","\\","\n","\r"] | "\\" (["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])? | ["0"-"3"] ["0"-"7"] ["0"-"7"])) "\'">
|
||||
| <STRING_LITERAL: "\"" ( ~["\"","\\","\n","\r"] | "\\" ( ["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])? | ["0"-"3"] ["0"-"7"] ["0"-"7"] | ( ["\n","\r"] | "\r\n")))* "\"">
|
||||
| <UNDEFINED_TYPE: "undefined" (<DECIMAL_LITERAL>)?> // Ghidra specific unknown type
|
||||
}
|
||||
|
||||
TOKEN : {
|
||||
<CONTINUE: "continue"> |
|
||||
<VOLATILE: "volatile"> |
|
||||
<REGISTER: "register"> |
|
||||
<UNSIGNED: "unsigned"> |
|
||||
<TYPEDEF: "typedef"> |
|
||||
<DFLT: "default"> |
|
||||
<DOUBLE: "double"> |
|
||||
<SIZEOF: "sizeof"> |
|
||||
<SWITCH: "switch"> |
|
||||
<RETURN: "return"> |
|
||||
<EXTERN: "extern"> |
|
||||
<STRUCT: "struct"> |
|
||||
<STATIC: "static"> |
|
||||
<SIGNED: "signed"> |
|
||||
<WHILE: "while"> |
|
||||
<BREAK: "break"> |
|
||||
<UNION: "union"> |
|
||||
<CONST: "const"> |
|
||||
<FLOAT: "float"> |
|
||||
<SHORT: "short"> |
|
||||
<ELSE: "else"> |
|
||||
<CASE: "case"> |
|
||||
<LONG: "long"> |
|
||||
<ENUM: "enum"> |
|
||||
<AUTO: "auto"> |
|
||||
<VOID: "void"> |
|
||||
<CHAR: "char"> |
|
||||
<GOTO: "goto"> |
|
||||
<FOR: "for"> |
|
||||
<INT: "int"> |
|
||||
<IF: "if"> |
|
||||
<DO: "do"> |
|
||||
<CODE: "code"> // code ptr, Ghidra specific
|
||||
}
|
||||
|
||||
TOKEN : {
|
||||
<IDENTIFIER: <LETTER> (<LETTER> | <DIGIT>)*>
|
||||
| <#LETTER: ["$","A"-"Z","_","a"-"z"]>
|
||||
| <#DIGIT: ["0"-"9"]>
|
||||
}
|
||||
|
||||
|
||||
SimpleNode FunctionDefinition() : {}
|
||||
{
|
||||
[LOOKAHEAD(DeclarationSpecifiers()) DeclarationSpecifiers()] Declarator()
|
||||
CompoundStatement()
|
||||
{
|
||||
return jjtThis;
|
||||
}
|
||||
}
|
||||
|
||||
void Declaration() : {}
|
||||
{
|
||||
DeclarationSpecifiers() [ InitDeclaratorList() ] ";"
|
||||
}
|
||||
|
||||
void DeclarationList() : {}
|
||||
{
|
||||
( LOOKAHEAD(Declaration()) Declaration() )+
|
||||
}
|
||||
|
||||
void DeclarationSpecifiers() : {}
|
||||
{
|
||||
StorageClassSpecifier() [ LOOKAHEAD(DeclarationSpecifiers())
|
||||
DeclarationSpecifiers() ] |
|
||||
TypeSpecifier() [ LOOKAHEAD(DeclarationSpecifiers())
|
||||
DeclarationSpecifiers() ] |
|
||||
TypeQualifier() [ LOOKAHEAD(DeclarationSpecifiers())
|
||||
DeclarationSpecifiers() ]
|
||||
}
|
||||
|
||||
void StorageClassSpecifier() #GhostStringToken :
|
||||
{
|
||||
Token t;
|
||||
}
|
||||
{
|
||||
( t = <AUTO> | t = <REGISTER> | t = <STATIC> | t = <EXTERN> | t = <TYPEDEF> )
|
||||
{
|
||||
jjtThis.setValue(t.image);
|
||||
}
|
||||
}
|
||||
|
||||
void TypeSpecifier() #TypeStringToken :
|
||||
{
|
||||
Token t;
|
||||
}
|
||||
{
|
||||
( t = <VOID> | t = <CHAR> | t = <SHORT> | t = <INT> | t = <LONG> | t = <FLOAT> | t = <DOUBLE> | t = <SIGNED> |
|
||||
t = <UNSIGNED> | t = <CODE> | t = <UNDEFINED_TYPE> )
|
||||
{
|
||||
jjtThis.setValue(t.image);
|
||||
}
|
||||
}
|
||||
|
||||
void TypeQualifier() #StringToken :
|
||||
{
|
||||
Token t;
|
||||
}
|
||||
{
|
||||
( t = <CONST> | t = <VOLATILE> )
|
||||
{
|
||||
jjtThis.setValue(t.image);
|
||||
}
|
||||
}
|
||||
|
||||
void InitDeclaratorList() : {}
|
||||
{
|
||||
InitDeclarator() ("," InitDeclarator())*
|
||||
}
|
||||
|
||||
void InitDeclarator() : {}
|
||||
{
|
||||
Declarator() [ "=" Initializer() ]
|
||||
}
|
||||
|
||||
void SpecifierQualifierList() : {}
|
||||
{
|
||||
TypeSpecifier() [ LOOKAHEAD(SpecifierQualifierList())
|
||||
SpecifierQualifierList() ]|
|
||||
TypeQualifier() [ LOOKAHEAD(SpecifierQualifierList())
|
||||
SpecifierQualifierList() ]
|
||||
}
|
||||
|
||||
void Declarator() : {}
|
||||
{
|
||||
[ Pointer() ] DirectDeclarator()
|
||||
}
|
||||
|
||||
void DirectDeclarator() : {}
|
||||
{
|
||||
( Identifier() | "(" Declarator() ")" )
|
||||
( "[" [ ConstantExpression() ] "]" |
|
||||
LOOKAHEAD(3) "(" ParameterTypeList() ")" |
|
||||
"(" [ IdentifierList() ] ")" )*
|
||||
}
|
||||
|
||||
void Pointer() : {}
|
||||
{
|
||||
"*" [ TypeQualifierList() ] [ Pointer() ]
|
||||
}
|
||||
|
||||
void TypeQualifierList() : {}
|
||||
{
|
||||
(TypeQualifier())+
|
||||
}
|
||||
|
||||
void ParameterTypeList() : {}
|
||||
{
|
||||
ParameterList() ["," "..." ]
|
||||
}
|
||||
|
||||
void ParameterList() : {}
|
||||
{
|
||||
ParameterDeclaration() (LOOKAHEAD(2) "," ParameterDeclaration())*
|
||||
}
|
||||
|
||||
void ParameterDeclaration() : {}
|
||||
{
|
||||
DeclarationSpecifiers() ( LOOKAHEAD(Declarator()) Declarator() | [ AbstractDeclarator() ] )
|
||||
}
|
||||
|
||||
void IdentifierList() : {}
|
||||
{
|
||||
Identifier() ("," Identifier())*
|
||||
}
|
||||
|
||||
void Initializer() : {}
|
||||
{
|
||||
( AssignmentExpression() |
|
||||
"{" InitializerList() [","] "}" )
|
||||
}
|
||||
|
||||
void InitializerList() : {}
|
||||
{
|
||||
Initializer() (LOOKAHEAD(2) "," Initializer())*
|
||||
}
|
||||
|
||||
void TypeName() : {}
|
||||
{
|
||||
SpecifierQualifierList() [ AbstractDeclarator() ]
|
||||
|
||||
}
|
||||
|
||||
void AbstractDeclarator() : {}
|
||||
{
|
||||
( LOOKAHEAD(3) Pointer() |
|
||||
[Pointer()] DirectAbstractDeclarator() )
|
||||
}
|
||||
|
||||
void DirectAbstractDeclarator() : {}
|
||||
{
|
||||
( LOOKAHEAD(2) "(" AbstractDeclarator() ")" |
|
||||
"[" [ConstantExpression()] "]" |
|
||||
"(" [ParameterTypeList()] ")" )
|
||||
|
||||
( "[" [ ConstantExpression() ] "]" | "(" [ ParameterTypeList() ] ")" )*
|
||||
}
|
||||
|
||||
void Statement() : {}
|
||||
{
|
||||
( LOOKAHEAD(2) LabeledStatement() |
|
||||
ExpressionStatement() |
|
||||
CompoundStatement() |
|
||||
SelectionStatement() |
|
||||
IterationStatement() |
|
||||
JumpStatement() )
|
||||
}
|
||||
|
||||
void LabeledStatement() : {}
|
||||
{
|
||||
( Identifier() ":" Statement() |
|
||||
<CASE> ConstantExpression() ":" Statement() |
|
||||
<DFLT> ":" Statement() )
|
||||
}
|
||||
|
||||
void ExpressionStatement() : {}
|
||||
{
|
||||
[ Expression() ] ";"
|
||||
}
|
||||
|
||||
void CompoundStatement() : {}
|
||||
{
|
||||
"{" [ LOOKAHEAD(DeclarationList()) DeclarationList() ]
|
||||
[ StatementList() ]
|
||||
"}"
|
||||
}
|
||||
|
||||
void StatementList() : {}
|
||||
{
|
||||
(Statement())+
|
||||
}
|
||||
|
||||
void SelectionStatement() : {}
|
||||
{
|
||||
( <IF> "(" Expression() ")" Statement() [ LOOKAHEAD(2) <ELSE> Statement() ] |
|
||||
<SWITCH> "(" Expression() ")" Statement() )
|
||||
}
|
||||
|
||||
void IterationStatement() : {}
|
||||
{
|
||||
( <WHILE> "(" Expression() ")" Statement() |
|
||||
<DO> Statement() <WHILE> "(" Expression() ")" ";" |
|
||||
<FOR> "(" [ Expression() ] ";" [ Expression() ] ";" [ Expression() ] ")" Statement() )
|
||||
}
|
||||
|
||||
void JumpStatement() : {}
|
||||
{
|
||||
( <GOTO> Identifier() ";" |
|
||||
<CONTINUE> ";" |
|
||||
<BREAK> ";" |
|
||||
<RETURN> [ Expression() ] ";" )
|
||||
}
|
||||
|
||||
void Expression() : {}
|
||||
{
|
||||
AssignmentExpression() ( "," AssignmentExpression() )* | DeclarationSpecifiers() InitDeclaratorList()
|
||||
}
|
||||
|
||||
void AssignmentExpression() : {}
|
||||
{
|
||||
LOOKAHEAD(UnaryExpression() AssignmentOperator()) UnaryExpression() AssignmentOperator() AssignmentExpression() |
|
||||
LOOKAHEAD(3) ConditionalExpression()
|
||||
}
|
||||
|
||||
void AssignmentOperator() : {}
|
||||
{
|
||||
( "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | "&=" | "^=" | "|=" )
|
||||
}
|
||||
|
||||
void ConditionalExpression() : {}
|
||||
{
|
||||
LogicalORExpression() [ "?" Expression() ":" ConditionalExpression() ]
|
||||
}
|
||||
|
||||
void ConstantExpression() : {}
|
||||
{
|
||||
ConditionalExpression()
|
||||
}
|
||||
|
||||
void LogicalORExpression() : {}
|
||||
{
|
||||
LogicalANDExpression() [ "||" LogicalORExpression() ]
|
||||
}
|
||||
|
||||
void LogicalANDExpression() : {}
|
||||
{
|
||||
InclusiveORExpression() [ "&&" LogicalANDExpression() ]
|
||||
}
|
||||
|
||||
void InclusiveORExpression() : {}
|
||||
{
|
||||
ExclusiveORExpression() [ "|" InclusiveORExpression() ]
|
||||
}
|
||||
|
||||
void ExclusiveORExpression() : {}
|
||||
{
|
||||
ANDExpression() [ "^" ExclusiveORExpression() ]
|
||||
}
|
||||
|
||||
void ANDExpression() : {}
|
||||
{
|
||||
EqualityExpression() [ "&" ANDExpression() ]
|
||||
}
|
||||
|
||||
void EqualityExpression() : {}
|
||||
{
|
||||
RelationalExpression() [ ( "==" | "!=" ) EqualityExpression() ]
|
||||
}
|
||||
|
||||
void RelationalExpression() : {}
|
||||
{
|
||||
ShiftExpression() [ ( "<" | ">" | "<=" | ">=" ) RelationalExpression() ]
|
||||
}
|
||||
|
||||
void ShiftExpression() : {}
|
||||
{
|
||||
AdditiveExpression() [ ( "<<" | ">>" ) ShiftExpression() ]
|
||||
}
|
||||
|
||||
void AdditiveExpression() : {}
|
||||
{
|
||||
MultiplicativeExpression() [ ( "+" | "-" ) AdditiveExpression() ]
|
||||
}
|
||||
|
||||
void MultiplicativeExpression() : {}
|
||||
{
|
||||
CastExpression() [ ( "*" | "/" | "%" ) MultiplicativeExpression() ]
|
||||
}
|
||||
|
||||
void CastExpression() : {}
|
||||
{
|
||||
( LOOKAHEAD("(" TypeName() ")" CastExpression() ) "(" TypeName() ")" CastExpression() |
|
||||
UnaryExpression() )
|
||||
}
|
||||
|
||||
void UnaryExpression() : {}
|
||||
{
|
||||
( LOOKAHEAD(3) PostfixExpression() |
|
||||
"++" UnaryExpression() |
|
||||
"--" UnaryExpression() |
|
||||
UnaryOperator() CastExpression() |
|
||||
<SIZEOF> ( LOOKAHEAD(UnaryExpression() ) UnaryExpression() | "(" TypeName() ")" ) )
|
||||
}
|
||||
|
||||
void UnaryOperator() : {}
|
||||
{
|
||||
( "&" | "*" | "+" | "-" | "~" | "!" )
|
||||
}
|
||||
|
||||
void PostfixExpression() : {}
|
||||
{
|
||||
PrimaryExpression() ( "[" Expression() "]" |
|
||||
"(" [ LOOKAHEAD(ArgumentExpressionList() ) ArgumentExpressionList() ] ")" |
|
||||
"." Identifier() |
|
||||
"->" Identifier() |
|
||||
"++" |
|
||||
"--" )*
|
||||
}
|
||||
|
||||
void PrimaryExpression() : {}
|
||||
{
|
||||
( Identifier() |
|
||||
Constant() |
|
||||
"(" Expression() ")" )
|
||||
}
|
||||
|
||||
void ArgumentExpressionList() : {}
|
||||
{
|
||||
AssignmentExpression() ( "," AssignmentExpression() )*
|
||||
}
|
||||
|
||||
void Identifier() #StringToken :
|
||||
{
|
||||
Token t;
|
||||
}
|
||||
{
|
||||
t = <IDENTIFIER>
|
||||
{
|
||||
jjtThis.setValue(t.image);
|
||||
}
|
||||
}
|
||||
|
||||
void Constant() #StringToken :
|
||||
{
|
||||
Token t;
|
||||
}
|
||||
{
|
||||
(t = <INTEGER_LITERAL> | t = <FLOATING_POINT_LITERAL> | t = <CHARACTER_LITERAL> | t = <STRING_LITERAL>)
|
||||
{
|
||||
jjtThis.setValue(t.image);
|
||||
}
|
||||
}
|
24
src/main/java/ghidrust/decompiler/parser/generate.sh
Executable file
24
src/main/java/ghidrust/decompiler/parser/generate.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Shell script to generate the parsers and add the package statement to the top of each file
|
||||
|
||||
cd c/gen
|
||||
|
||||
for file in AST*Token.java; do
|
||||
mv -- "$file" "${file%.java}.bak"
|
||||
done
|
||||
|
||||
rm -f *.java c.jj
|
||||
|
||||
jjtree c.jjt
|
||||
javacc c.jj
|
||||
|
||||
sleep 1
|
||||
|
||||
for file in *.java; do
|
||||
sed -i '1s/^/package ghidrust.decompiler.parser.c.gen;\n\n/' $file
|
||||
done
|
||||
|
||||
for file in AST*Token.bak; do
|
||||
mv -- "$file" "${file%.bak}.java"
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user