Skip to content

Commit

Permalink
Add accessors for some parser elements
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbot16 committed Dec 22, 2021
1 parent 217317f commit 0b3e804
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/main/java/kroppeb/stareval/element/token/NumberToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public NumberToken(String number) {
this.number = number;
}

public String getNumber() {
return number;
}

@Override
public String toString() {
return "Number{" + this.number + "}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ public AccessExpressionElement(AccessibleExpressionElement base, String index) {
this.index = index;
}

public AccessibleExpressionElement getBase() {
return this.base;
}

public String getIndex() {
return this.index;
}

@Override
public String toString() {
return "Access{" + this.base + "[" + this.index + "]}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@

public class BinaryExpressionElement implements ExpressionElement {
private final BinaryOp op;
private ExpressionElement left;
private ExpressionElement right;
private final ExpressionElement left;
private final ExpressionElement right;

public BinaryExpressionElement(BinaryOp op, ExpressionElement left, ExpressionElement right) {
this.op = op;
this.left = left;
this.right = right;
}

public BinaryOp getOp() {
return this.op;
}

public ExpressionElement getLeft() {
return this.left;
}

public ExpressionElement getRight() {
return this.right;
}

@Override
public String toString() {
return "BinaryExpr{ {" + this.left + "} " + this.op + " {" + this.right + "} }";
Expand Down

0 comments on commit 0b3e804

Please sign in to comment.