protected void finalizeExceptions() { inException = false; if (!exceptionSet) { tokenElement = new Element( StringTools.trimWhitespace(elements.toString()), caseSensitive, regExpression, tokenInflected); exceptionSet = true; } tokenElement.setNegation(tokenNegated); if (!StringTools.isEmpty(exceptions.toString()) || exceptionPosToken != null) { tokenElement.setStringPosException( StringTools.trimWhitespace(exceptions.toString()), exceptionStringRegExp, exceptionStringInflected, exceptionStringNegation, exceptionValidNext, exceptionValidPrev, exceptionPosToken, exceptionPosRegExp, exceptionPosNegation); exceptionPosToken = null; } if (exceptionSpaceBeforeSet) { tokenElement.setExceptionSpaceBefore(exceptionSpaceBefore); } resetException(); }
protected void finalizeTokens() { if (!exceptionSet || tokenElement == null) { tokenElement = new Element( StringTools.trimWhitespace(elements.toString()), caseSensitive, regExpression, tokenInflected); tokenElement.setNegation(tokenNegated); } else { tokenElement.setStringElement(StringTools.trimWhitespace(elements.toString())); } if (skipPos != 0) { tokenElement.setSkipNext(skipPos); skipPos = 0; } if (minOccurrence != 1) { tokenElement.setMinOccurrence(minOccurrence); minOccurrence = 1; } if (maxOccurrence != 1) { tokenElement.setMaxOccurrence(maxOccurrence); maxOccurrence = 1; } if (posToken != null) { tokenElement.setPosElement(posToken, posRegExp, posNegation); posToken = null; } if (chunkTag != null) { tokenElement.setChunkElement(chunkTag); chunkTag = null; } if (tokenReference != null) { tokenElement.setMatch(tokenReference); } if (inAndGroup && andGroupCounter > 0) { elementList.get(elementList.size() - 1).setAndGroupElement(tokenElement); } else if (inOrGroup && orGroupCounter > 0) { elementList.get(elementList.size() - 1).setOrGroupElement(tokenElement); } else { elementList.add(tokenElement); } if (inAndGroup) { andGroupCounter++; } if (inOrGroup) { orGroupCounter++; } if (inUnification) { tokenElement.setUnification(equivalenceFeatures); } tokenElement.setInsideMarker(inMarker); if (inUnificationDef) { language.getUnifierConfiguration().setEquivalence(uFeature, uType, tokenElement); elementList.clear(); } if (tokenSpaceBeforeSet) { tokenElement.setWhitespaceBefore(tokenSpaceBefore); } resetToken(); }