-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringExpression.java
More file actions
32 lines (28 loc) · 845 Bytes
/
StringExpression.java
File metadata and controls
32 lines (28 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* A Literal is an AST node that
* corresponds to a literal integer value
* (a number in the source code).
*
* @author Mak Fazlic & Roberto Ferrari - Latex project.
* @version v1.0
*/
public class StringExpression extends Node {
// instance variables
private final String value;
private final Node expression;
/**
* Create a new Literal node.
* @param value the integer value this node evaluates to.
* @param expression is the AST which is after the String.
*/
public StringExpression(final String value, final Node expression) {
super();
this.value = value;
this.expression = expression;
}
@Override
// Returns Latex of Literal
public String toLatex() {
return "\\textit{" + value + "}: $" + expression.toLatex() + "$";
}
}