static void parenthesesToKaf(String parOut, KAFDocument kaf) throws Exception {
	String[] tokens = Tree.tokenize(parOut);
	Tree.check(tokens);
        HashMap<Integer, Integer> parMatching = Tree.matchParentheses(tokens);
	HashMap<Integer, Term> termMatching = Tree.matchTerms(tokens, kaf.getTerms());
	// behin-behineko irtenbidea errorea ekiditeko: hutsa itzuli
	if (termMatching.size() == 0) {
	    return;
	}
	List<Tree> trees = new ArrayList<Tree>();
	int current = 0;
	while (current < tokens.length) {
	    int end = parMatching.get(current);
	    NonTerminal root = Tree.createNonTerminal(tokens, current+1, end-1, parMatching, termMatching, kaf);
	    kaf.newConstituent(root);
	    current = end + 1;
	}
    }
static void parenthesesToKaf ( String parOut , KAFDocument kaf ) throws Exception { String [ ] tokens = Tree . tokenize ( parOut ) ; Tree . check ( tokens ) ; HashMap < Integer , Integer > parMatching = Tree . matchParentheses ( tokens ) ; HashMap < Integer , Term > termMatching = Tree . matchTerms ( tokens , kaf . getTerms ( ) ) ; if ( termMatching . size ( ) == 0 ) { return ; } List < Tree > trees = new ArrayList < Tree > ( ) ; int current = 0 ; while ( current < tokens . length ) { int end = parMatching . get ( current ) ; NonTerminal root = Tree . createNonTerminal ( tokens , current + 1 , end - 1 , parMatching , termMatching , kaf ) ; kaf . newConstituent ( root ) ; current = end + 1 ; } }
********************************************************