public static void internalError(Object error, Throwable e) { StackTraceElement location = getLastNonErrorManagerCodeLocation(e); String msg = "Exception "+e+"@"+location+": "+error; error(MSG_INTERNAL_ERROR, msg); }
@Override public void info(String msg) { if (formatWantsSingleLineMessage()) { msg = msg.replaceAll("\n", " "); } System.err.println(msg); }
ErrorManager.nonLLStarDecision(this); ErrorManager.analysisAborted(this); Map<Integer, Set<Token>> insufficientAltToLocations = getIncompletelyCoveredAlts(d); if ( insufficientAltToLocations!=null && insufficientAltToLocations.size()>0 ) { ErrorManager.insufficientPredicates(this,d,insufficientAltToLocations); stripWildCardAlts(disabledAlts); if ( disabledAlts.size()>0 ) { ErrorManager.nondeterminism(this,d); ErrorManager.danglingState(this,d); if ( delegatedTokensAlt !=null ) { isInheritedTokensRule = true; ErrorManager.grammarWarning(ErrorManager.MSG_IMPORTED_TOKENS_RULE_EMPTY, dfa.nfa.grammar, null, ErrorManager.unreachableAlts(this,unreachableAlts);
public static void analysisAborted(DecisionProbe probe) { getErrorState().warnings++; Message msg = new GrammarAnalysisAbortedMessage(probe); getErrorState().warningMsgIDs.add(msg.msgID); getErrorListener().warning(msg); }
public String toString(ST messageST) { locationST = ErrorManager.getLocationFormat(); reportST = ErrorManager.getReportFormat(); messageFormatST = ErrorManager.getMessageFormat(); boolean locationValid = false; if (line != -1) { reportST.add("type", ErrorManager.getMessageType(msgID));
if ( ErrorManager.doNotAttemptAnalysis() ) { return null; if ( ErrorManager.doNotAttemptCodeGen() ) { return null; ErrorManager.error(ErrorManager.MSG_BAD_AST_STRUCTURE, re); if ( ErrorManager.getErrorState().errors > 0 ) { return null; ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, ioe);
public void alt(GrammarAST alt) { numElementsInAlt = 0; try { out.writeByte('A'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } //streams.push(out); //altBuf = new ByteArrayOutputStream(); //out = new DataOutputStream(altBuf); }
if ( ErrorManager.doNotAttemptAnalysis() ) { return null; if ( ErrorManager.doNotAttemptCodeGen() ) { return null; ErrorManager.error(ErrorManager.MSG_BAD_AST_STRUCTURE, re); ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, getVocabFileName(), ioe);
public static boolean doNotAttemptCodeGen() { return doNotAttemptAnalysis() || !getErrorState().errorMsgIDs.and(ERRORS_FORCING_NO_CODEGEN).isNil(); }
public static String getMessageType(int msgID) { if (getErrorState().warningMsgIDs.member(msgID)) { return messages.getInstanceOf("warning").toString(); } else if (getErrorState().errorMsgIDs.member(msgID)) { return messages.getInstanceOf("error").toString(); } assertTrue(false, "Assertion failed! Message ID " + msgID + " created but is not present in errorMsgIDs or warningMsgIDs."); return ""; }
public void createNFAs() { if ( ErrorManager.doNotAttemptAnalysis() ) { return; } List<Grammar> grammars = delegateGrammarTreeRoot.getPostOrderedGrammarList(); //System.out.println("### createNFAs for composite; grammars: "+names); for (int i = 0; grammars!=null && i < grammars.size(); i++) { Grammar g = grammars.get(i); g.createRuleStartAndStopNFAStates(); } for (int i = 0; grammars!=null && i < grammars.size(); i++) { Grammar g = grammars.get(i); g.buildNFA(); } }
ErrorManager.setErrorListener(el); if(ErrorManager.doNotAttemptAnalysis()) { return analyzeCompleted(el);
ErrorManager.nonLLStarDecision(this); Map<Integer, Set<Token>> insufficientAltToLocations = getIncompletelyCoveredAlts(d); if ( insufficientAltToLocations!=null && insufficientAltToLocations.size()>0 ) { ErrorManager.insufficientPredicates(this,d,insufficientAltToLocations); if ( greedyS!=null && greedyS.equals("true") ) explicitlyGreedy = true; if ( !explicitlyGreedy) ErrorManager.nondeterminism(this,d); ErrorManager.danglingState(this,d); if ( delegatedTokensAlt !=null ) { isInheritedTokensRule = true; ErrorManager.grammarWarning(ErrorManager.MSG_IMPORTED_TOKENS_RULE_EMPTY, dfa.nfa.grammar, null, ErrorManager.unreachableAlts(this,unreachableAlts);
public static void recursionOverflow(DecisionProbe probe, DFAState sampleBadState, int alt, Collection<String> targetRules, Collection<? extends Collection<? extends NFAState>> callSiteStates) { getErrorState().errors++; Message msg = new RecursionOverflowMessage(probe,sampleBadState, alt, targetRules, callSiteStates); getErrorState().errorMsgIDs.add(msg.msgID); getErrorListener().error(msg); }
public String toString(ST messageST) { locationST = ErrorManager.getLocationFormat(); reportST = ErrorManager.getReportFormat(); messageFormatST = ErrorManager.getMessageFormat(); boolean locationValid = false; if (line != -1) { reportST.add("type", ErrorManager.getMessageType(msgID));
if ( ErrorManager.doNotAttemptAnalysis() ) { return null; if ( ErrorManager.doNotAttemptCodeGen() ) { return null; ErrorManager.error(ErrorManager.MSG_BAD_AST_STRUCTURE, re); if ( ErrorManager.getErrorState().errors > 0 ) { return null; ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, ioe);
public void range() { // must be char range numElementsInAlt++; try { out.writeByte('-'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
if ( ErrorManager.doNotAttemptAnalysis() ) { return null; if ( ErrorManager.doNotAttemptCodeGen() ) { return null; ErrorManager.error(ErrorManager.MSG_BAD_AST_STRUCTURE, re); ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, getVocabFileName(), ioe);
public static boolean doNotAttemptCodeGen() { return doNotAttemptAnalysis() || !getErrorState().errorMsgIDs.and(ERRORS_FORCING_NO_CODEGEN).isNil(); }
public static String getMessageType(int msgID) { if (getErrorState().warningMsgIDs.member(msgID)) { return messages.getInstanceOf("warning").toString(); } else if (getErrorState().errorMsgIDs.member(msgID)) { return messages.getInstanceOf("error").toString(); } assertTrue(false, "Assertion failed! Message ID " + msgID + " created but is not present in errorMsgIDs or warningMsgIDs."); return ""; }