}
if (index == -1) {
TokenNode t = phraseStructure.addTokenNode(terminalCounter);
if (t == null) {
close();
throw new MaltChainedException("Bracket Reader error: could not create a terminal node. ");
}
terminalCounter++;
Edge e = null;
if (parent != null) {
e = phraseStructure.addPhraseStructureEdge(parent, (PhraseStructureNode)t);
} else {
close();
throw new MaltChainedException("Bracket Reader error: could not find the parent node. ");
}
int start = begin;
Iterator<String> inputColumnsIterator = inputColumns.keySet().iterator();
Iterator<String> edgeLabelsColumnsIterator = edgeLabelColumns.keySet().iterator();
boolean noneNode = false;
boolean edgeLabels = false;
for (int i = begin; i < end; i++) {
if (input.charAt(i) == EDGELABEL_SEPARATOR || (input.charAt(i) == INPUT_SEPARATOR
// Start BracketProgLangReader
&& (i == begin || input.charAt(i - 1) != '\\')
// end BracketProgLangReader
) || i == end - 1) {
if (i == begin && input.charAt(i) == EDGELABEL_SEPARATOR) {
noneNode = true;
} else if (start == begin) {
if ((noneNode && input.charAt(i) != EDGELABEL_SEPARATOR) || !noneNode) {
if (inputColumnsIterator.hasNext()) {
t.addLabel(inputColumns.get(inputColumnsIterator.next()).getSymbolTable(),
// Start BracketProgLangReader
decodeString(
// end BracketProgLangReader
(i == end - 1)?input.substring(start,end):input.substring(start, i)
// Start BracketProgLangReader
)
// end BracketProgLangReader
);
}
start = i + 1;
if (input.charAt(i) == EDGELABEL_SEPARATOR) {
edgeLabels = true;
}
}
} else if (edgeLabels && e != null) {
if (edgeLabelsColumnsIterator.hasNext()) {
e.addLabel(edgeLabelColumns.get(edgeLabelsColumnsIterator.next()).getSymbolTable(), (i == end - 1)?input.substring(start,end):input.substring(start, i));
}
start = i + 1;
if (input.charAt(i) == INPUT_SEPARATOR
// Start BracketProgLangReader
&& (i == begin || input.charAt(i - 1) != '\\')
// end BracketProgLangReader
) {
edgeLabels = false;
}
} else if (input.charAt(i) == EDGELABEL_SEPARATOR && i != end - 1 && (input.charAt(i+1) != INPUT_SEPARATOR
// Start BracketProgLangReader
&& (i == begin || input.charAt(i - 1) != '\\')
// end BracketProgLangReader
)
) {
} else {
if (inputColumnsIterator.hasNext()) {
t.addLabel(inputColumns.get(inputColumnsIterator.next()).getSymbolTable(), (i == end - 1)?input.substring(start,end):input.substring(start, i));
}
start = i + 1;
}
}
}
} else {
PhraseStructureNode nt;
Edge e = null;
if (parent == null) {
nt = phraseStructure.getPhraseStructureRoot();
} else {
nt = phraseStructure.addNonTerminalNode(nonTerminalCounter);
if (nt == null) {
close();
throw new MaltChainedException("Bracket Reader error: could not create a nonterminal node. ");
}
nonTerminalCounter++;
e = phraseStructure.addPhraseStructureEdge(parent, nt);
}