package xyz.ignatz.antlr.java9.utils;

public class JavaName {
    String name = "";

    public void push(char c, String name) {
        this.name += c + name;
    }

    public String pop(char c) {
        int idx = name.lastIndexOf(c);
        String top = name.substring(idx + 1);
        name = name.substring(0, idx);
        return top;
    }

    @Override
    public String toString() {
        return name.length() > 0 ? name.substring(1) : "";
    }
}
