Skip to content

Commit

Permalink
Make expressions full visitable (#657)
Browse files Browse the repository at this point in the history
Added methods to visit and traverse all expression nodes
  • Loading branch information
ezanaga1 authored Nov 27, 2023
1 parent 1b2ccbf commit 99af0ff
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public List<?> evaluate(PebbleTemplateImpl self, EvaluationContextImpl context)
return returnValues;
}

public List<Expression<?>> getValues() {
return this.values;
}

@Override
public int getLineNumber() {
return this.lineNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public void accept(NodeVisitor visitor) {
visitor.visit(this);
}

public Expression<?> getBlockNameExpression() {
return this.blockNameExpression;
}

@Override
public int getLineNumber() {
return this.lineNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public int getLineNumber() {
return this.lineNumber;
}

public BigDecimal getValue() {
return this.value;
}

@Override
public String toString() {
return this.value.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public int getLineNumber() {
return this.lineNumber;
}

public Boolean getValue() {
return this.value;
}

@Override
public String toString() {
return this.value.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public int getLineNumber() {
return this.lineNumber;
}

public Double getValue() {
return this.value;
}

@Override
public String toString() {
return this.value.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ public int getLineNumber() {
return this.lineNumber;
}

public Integer getValue() {
return this.value;
}

@Override
public String toString() {
return this.value.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public int getLineNumber() {
return this.lineNumber;
}

public Long getValue() {
return this.value;
}

@Override
public String toString() {
return this.value.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public void accept(NodeVisitor visitor) {
return returnEntries;
}

public Map<Expression<?>, Expression<?>> getEntries() {
return this.entries;
}

@Override
public int getLineNumber() {
return this.lineNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public void accept(NodeVisitor visitor) {
visitor.visit(this);
}

public String getBlockName() {
return this.blockName;
}

@Override
public int getLineNumber() {
return this.lineNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public Object evaluate(PebbleTemplateImpl self, EvaluationContextImpl context) {
return writer.toString();
}

public RenderableNode getNode() {
return this.node;
}

@Override
public int getLineNumber() {
return this.lineNumber;
Expand Down

0 comments on commit 99af0ff

Please sign in to comment.