MCPcopy
hub / github.com/Col-E/Recaf / getParser

Method getParser

src/main/java/me/coley/recaf/parse/bytecode/Parse.java:112–141  ·  view source on GitHub ↗

@param lineNo Line the token appears on. @param token First token on line. @return Parser associated with the token. @throws ASTParseException When the token is not valid.

(int lineNo, String token)

Source from the content-addressed store, hash-verified

110 * When the token is not valid.
111 */
112 public static AbstractParser<?> getParser(int lineNo, String token) throws ASTParseException {
113 if (token.startsWith("//"))
114 return new CommentParser();
115 if(token.endsWith(":"))
116 return new LabelParser();
117 if (token.equals("DEFINE"))
118 return new DefinitionParser();
119 if (token.equals("VALUE"))
120 return new DefaultValueParser();
121 if(token.equals("THROWS"))
122 return new ThrowsParser();
123 if(token.equals("TRY"))
124 return new TryCatchParser();
125 if(token.equals("ALIAS"))
126 return new AliasDeclarationParser();
127 if(token.equals("SIGNATURE"))
128 return new SignatureParser();
129 if(token.equals("EXPR"))
130 return new ExpressionParser();
131 // Get opcode from token (opcode?) then get the opcode's group
132 // Lookup group's parser
133 try {
134 int opcode = OpcodeUtil.nameToOpcode(token);
135 int type = OpcodeUtil.opcodeToType(opcode);
136 return getInsnParser(type);
137 } catch(NullPointerException ex) {
138 // Thrown when the opcode name isn't a real opcode
139 throw new ASTParseException(lineNo, "Not a real opcode: " + token);
140 }
141 }
142
143 /**
144 * @param type

Callers 4

suggestMethod · 0.95
parseMethod · 0.95
suggestMethod · 0.95
loopMethod · 0.80

Calls 4

nameToOpcodeMethod · 0.95
opcodeToTypeMethod · 0.95
getInsnParserMethod · 0.95
equalsMethod · 0.45

Tested by 1

suggestMethod · 0.76