MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / ExpressionParser

Class ExpressionParser

src/main/java/net/optifine/expr/ExpressionParser.java:13–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11import net.minecraft.src.Config;
12
13public class ExpressionParser
14{
15 private IExpressionResolver expressionResolver;
16
17 public ExpressionParser(IExpressionResolver expressionResolver)
18 {
19 this.expressionResolver = expressionResolver;
20 }
21
22 public IExpressionFloat parseFloat(String str) throws ParseException
23 {
24 IExpression iexpression = this.parse(str);
25
26 if (!(iexpression instanceof IExpressionFloat))
27 {
28 throw new ParseException("Not a float expression: " + iexpression.getExpressionType());
29 }
30 else
31 {
32 return (IExpressionFloat)iexpression;
33 }
34 }
35
36 public IExpressionBool parseBool(String str) throws ParseException
37 {
38 IExpression iexpression = this.parse(str);
39
40 if (!(iexpression instanceof IExpressionBool))
41 {
42 throw new ParseException("Not a boolean expression: " + iexpression.getExpressionType());
43 }
44 else
45 {
46 return (IExpressionBool)iexpression;
47 }
48 }
49
50 public IExpression parse(String str) throws ParseException
51 {
52 try
53 {
54 Token[] atoken = TokenParser.parse(str);
55
56 if (atoken == null)
57 {
58 return null;
59 }
60 else
61 {
62 Deque<Token> deque = new ArrayDeque(Arrays.asList(atoken));
63 return this.parseInfix(deque);
64 }
65 }
66 catch (IOException ioexception)
67 {
68 throw new ParseException(ioexception.getMessage(), ioexception);
69 }
70 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected