public String toString(Recognizer r) { String channelStr = ""; if ( channel>0 ) { channelStr=",channel="+channel; } String txt = getText(); if ( txt!=null ) { txt = txt.replace("\n","\\n"); txt = txt.replace("\r","\\r"); txt = txt.replace("\t","\\t"); } else { txt = "<no text>"; } String typeString = String.valueOf(type); if ( r!=null ) { typeString = r.getVocabulary().getDisplayName(type); } return "[@"+getTokenIndex()+","+start+":"+stop+"='"+txt+"',<"+typeString+">"+channelStr+","+line+":"+getCharPositionInLine()+"]"; } }
@Override public int getCharPositionInLine() { if(token.isEmpty()) { return eofToken.getCharPositionInLine(); } else { return token.get(0).getCharPositionInLine(); } }
@Override public String toString() { String channelStr = ""; if ( channel>0 ) { channelStr=",channel="+channel; } String txt = getText(); if ( txt!=null ) { txt = txt.replace("\n","\\n"); txt = txt.replace("\r","\\r"); txt = txt.replace("\t","\\t"); } else { txt = "<no text>"; } return "[@"+getTokenIndex()+","+start+":"+stop+"='"+txt+"',<"+type+">"+channelStr+","+line+":"+getCharPositionInLine()+"]"; } }
@Override public String toString() { String channelStr = ""; if ( channel>0 ) { channelStr=",channel="+channel; } String txt = getText(); if ( txt!=null ) { txt = txt.replace("\n","\\n"); txt = txt.replace("\r","\\r"); txt = txt.replace("\t","\\t"); } else { txt = "<no text>"; } return "[@"+getTokenIndex()+","+start+":"+stop+"='"+txt+"',<"+type+">"+channelStr+","+line+":"+getCharPositionInLine()+"]"; } }
public static void printOriginalFilePiece(InputDocument doc, CommonToken originalCurToken) { System.out.println(doc.getLine(originalCurToken.getLine()-1)); System.out.println(doc.getLine(originalCurToken.getLine())); System.out.print(Tool.spaces(originalCurToken.getCharPositionInLine())); System.out.println("^"); }
private void initMissing(Recognizer<?, ?> recognizer,CommonToken commonToken){ try{ this.startLine = 1; this.startCharPositionInLine = 0; this.stopLine = commonToken.getLine(); this.stopCharPositionInLine = commonToken.getCharPositionInLine(); String text = commonToken.getTokenSource().getInputStream().toString(); if (text != null) { reader = new InnerScriptReader(text); } }catch (Exception e) { throw new RuntimeException(e); } }
public String toString(Recognizer r) { String channelStr = ""; if ( channel>0 ) { channelStr=",channel="+channel; } String txt = getText(); if ( txt!=null ) { txt = txt.replace("\n","\\n"); txt = txt.replace("\r","\\r"); txt = txt.replace("\t","\\t"); } else { txt = "<no text>"; } String typeString = String.valueOf(type); if ( r!=null ) { typeString = r.getVocabulary().getDisplayName(type); } return "[@"+getTokenIndex()+","+start+":"+stop+"='"+txt+"',<"+typeString+">"+channelStr+","+line+":"+getCharPositionInLine()+"]"; } }
public String toString(@Nullable Recognizer<?, ?> r) { String channelStr = ""; if ( channel>0 ) { channelStr=",channel="+channel; } String txt = getText(); if ( txt!=null ) { txt = txt.replace("\n","\\n"); txt = txt.replace("\r","\\r"); txt = txt.replace("\t","\\t"); } else { txt = "<no text>"; } String typeString = String.valueOf(type); if ( r!=null ) { typeString = r.getVocabulary().getDisplayName(type); } return "[@"+getTokenIndex()+","+start+":"+stop+"='"+txt+"',<"+typeString+">"+channelStr+","+line+":"+getCharPositionInLine()+"]"; } }
ErrorNodeImpl eni = (ErrorNodeImpl) child; CommonToken offendingToken = (CommonToken) eni.getSymbol(); int offendingStart = offendingToken.getCharPositionInLine(); int offendingStop = -1; String offendingSource = "";
ErrorNodeImpl eni = (ErrorNodeImpl) child; CommonToken offendingToken = (CommonToken) eni.getSymbol(); int offendingStart = offendingToken.getCharPositionInLine(); int offendingStop = -1; String offendingSource = "";