summaryrefslogtreecommitdiffstats
path: root/src/grammar/StringScalarExpr.java
blob: d16ea609d5537362a640f95f17c31681b8a1aa82 (plain)
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
33
34
35
36
37
38
39
package grammar;

/**
 * @author: Andrei Aiordachioaie
 */

public class StringScalarExpr implements IParseTreeNode
{
    String val;
    String function;
    CoverageExpr cov;
    String op;

    public StringScalarExpr(String val)
    {
        this.val = val;
        this.function = "stringConstant";
    }

    public StringScalarExpr(String op, CoverageExpr cov)
    {
        this.cov = cov;
        function = "stringIdentifier";
        this.op = op;
    }

    public String toXML()
    {
        String result = "<" + function + ">";

        if (function.equals("stringConstant"))
            result += val;
        else if (function.equals("stringIdentifier"))
            result += cov.toXML();
        result += "</" + function + ">";

        return result;
    }
}