1
3 package jminusminus;
4
5 import static jminusminus.CLConstants.*;
6
7
10 class JLiteralDouble extends JExpression {
11 private String text;
13
14
20 public JLiteralDouble(int line, String text) {
21 super(line);
22 this.text = text;
23 }
24
25
30 public double toDouble() {
31 return Double.parseDouble(text);
32 }
33
34
37 public JExpression analyze(Context context) {
38 return this;
40 }
41
42
45 public void codegen(CLEmitter output) {
46 }
48
49
52 public void toJSON(JSONElement json) {
53 JSONElement e = new JSONElement();
54 json.addChild("JLiteralDouble:" + line, e);
55 e.addAttribute("type", type == null ? "" : type.toString());
56 e.addAttribute("value", text);
57 }
58 }
59