public ArrayList<Element> parse() throws HPPPlusException {
        ArrayList<Parseable> parseList = (ArrayList<Parseable>) data.clone();

        for (int i=0;i<handlers.size();i++) {
            Element handler = handlers.get(i);
            for (int j=0;j<parseList.size();j++) {
                if (handler.isMatch(parseList, j)) {
                    Element e = handler.match(parseList, j);
                    if (e!=null) {
                        for (int k=0;k<e.getDeletionLength();k++) {
                            if (j<parseList.size())
                                parseList.remove(j);
                        }
                        parseList.add(j, e);
                    } else {
                       for (int k=0;k<handler.getDeletionLength();k++) {
                            parseList.remove(j);
                        }
                    }
                    i--;
                    break;
                }
            }
        }
        
        ArrayList<Element> output = new ArrayList<>();
        for (Parseable o : parseList) {
            if (o instanceof Token) {
                //System.out.println(parseList);
                throw new SyntaxException(o.getRange(), (Token) o);
            } else {
                output.add((Element) o);
            }
        }
        return output;
    }