private Designator designator() throws Exception
    {
        Identifier id = ident();
        // if variable
        if(scan.sym != Token.opensquare) {
            return new Designator(id);
        }
        ArrayList<Value> index = new ArrayList<Value>();
        while(scan.sym == Token.opensquare) {
            scan.next();
            index.add(expression());
            if(scan.sym == Token.closesqare) {
                scan.next();
            } else {
                throw new Exception("Designator: no closing ']'");
            }
        }
        return new ArrayDesignator(id, index);
    }