package net.zero918nobita.Xemime;

import java.util.HashMap;

/**
 * シンボル
 * @author Kodai Matsumoto
 */

class X_Symbol extends X_Code {
    private static HashMap<String, X_Symbol> table = new HashMap<>();
    private String name;

    X_Symbol(String s) {
        name = s;
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof X_Symbol && ((X_Symbol)obj).getName().equals(this.getName());
    }

    @Override
    public int hashCode() {
        return name.hashCode();
    }

    public String getName() {
        return name;
    }

    static X_Symbol intern(String s) {
        if (!table.containsKey(s)) table.put(s, new X_Symbol(s));
        return table.get(s);
    }

    public X_Code run() throws Exception {
        X_Code c = Main.getValueOfSymbol(this);
        if (c == null) throw new Exception("シンボル" + name + "は定義されていません");
        return c;
    }

    public String toString() {
        return name;
    }
}

@@ -849,16 +849,18 @@
 on(%22%E3%82%B7%E3%83%B3%E3%83%9C%E3%83%AB
+ %60
 %22 + name
@@ -863,16 +863,18 @@
 name + %22
+%60 
 %E3%81%AF%E5%AE%9A%E7%BE%A9%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%BE

Fix the exception message