public void setLast(Token last) { lineLast = last.getLine(); colLast = last.getColumn(); }
public void addWarning(String warning, String solution) { Token lt = null; try { lt = LT(1); } catch (TokenStreamException ee) { } if (lt == null) lt = Token.badToken; Map row = new HashMap(); row.put("warning", warning); row.put("solution", solution); row.put("filename", getFilename()); row.put("line", Integer.valueOf(lt.getLine())); row.put("column", Integer.valueOf(lt.getColumn())); // System.out.println(row); warningList.add(row); }
public void initialize(Token t) { super.initialize(t); line = t.getLine(); col = t.getColumn(); if (t instanceof SourceInfo) { SourceInfo info = (SourceInfo) t; lineLast = info.getLineLast(); colLast = info.getColumnLast(); } }
public void requireFailed(String problem, String solution) throws SemanticException { // TODO: Needs more work. Token lt = null; int lineNum = Token.badToken.getLine(), colNum = Token.badToken.getColumn(); try { lt = LT(1); if(lt != null) { lineNum = lt.getLine(); colNum = lt.getColumn(); } } catch (TokenStreamException ee) { if(ee instanceof TokenStreamRecognitionException) { lineNum = ((TokenStreamRecognitionException) ee).recog.getLine(); colNum = ((TokenStreamRecognitionException) ee).recog.getColumn(); } } throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); }
public void matchGenericTypeBracketsFailed(String problem, String solution) throws SemanticException { Token lt = null; int lineNum = Token.badToken.getLine(), colNum = Token.badToken.getColumn(); try { lt = LT(1); if(lt != null) { lineNum = lt.getLine(); colNum = lt.getColumn(); } } catch (TokenStreamException ee) { if(ee instanceof TokenStreamRecognitionException) { lineNum = ((TokenStreamRecognitionException) ee).recog.getLine(); colNum = ((TokenStreamRecognitionException) ee).recog.getColumn(); } } throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); }
public void actionPerformed(ActionEvent ae) { Token token = (Token) ((JComponent) ae.getSource()).getClientProperty("token"); if (token.getType() == Token.EOF_TYPE) { scriptPane.select(0, 0); return; } try { int start = scriptPane.getLineStartOffset(token.getLine() - 1) + token.getColumn() - 1; scriptPane.select(start, start + token.getText().length()); scriptPane.requestFocus(); } catch (BadLocationException ex) { // IGNORE } }
/** * Clones the token */ public Token cloneToken(Token t) { CommonToken clone = new CommonToken(t.getType(),t.getText()); clone.setLine(t.getLine()); clone.setColumn(t.getColumn()); return clone; }
public void setLast(Token last) { lineLast = last.getLine(); colLast = last.getColumn(); }
public void addWarning(String warning, String solution) { Token lt = null; try { lt = LT(1); } catch (TokenStreamException ee) { } if (lt == null) lt = Token.badToken; Map row = new HashMap(); row.put("warning" ,warning); row.put("solution",solution); row.put("filename",getFilename()); row.put("line" ,new Integer(lt.getLine())); row.put("column" ,new Integer(lt.getColumn())); // System.out.println(row); warningList.add(row); }
public void initialize(Token t) { super.initialize(t); line = t.getLine(); col = t.getColumn(); if (t instanceof SourceInfo) { SourceInfo info = (SourceInfo) t; lineLast = info.getLineLast(); colLast = info.getColumnLast(); } }
public void matchGenericTypeBracketsFailed(String problem, String solution) throws SemanticException { Token lt = null; int lineNum = Token.badToken.getLine(), colNum = Token.badToken.getColumn(); try { lt = LT(1); if(lt != null) { lineNum = lt.getLine(); colNum = lt.getColumn(); } } catch (TokenStreamException ee) { if(ee instanceof TokenStreamRecognitionException) { lineNum = ((TokenStreamRecognitionException) ee).recog.getLine(); colNum = ((TokenStreamRecognitionException) ee).recog.getColumn(); } } throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); }
public void requireFailed(String problem, String solution) throws SemanticException { // TODO: Needs more work. Token lt = null; int lineNum = Token.badToken.getLine(), colNum = Token.badToken.getColumn(); try { lt = LT(1); if(lt != null) { lineNum = lt.getLine(); colNum = lt.getColumn(); } } catch (TokenStreamException ee) { if(ee instanceof TokenStreamRecognitionException) { lineNum = ((TokenStreamRecognitionException) ee).recog.getLine(); colNum = ((TokenStreamRecognitionException) ee).recog.getColumn(); } } throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); }
public void actionPerformed(ActionEvent ae){ Token token = (Token) ((JComponent) ae.getSource()).getClientProperty("token"); if(token.getType()==Token.EOF_TYPE){ scriptPane.select(0, 0); return; } try{ int start = scriptPane.getLineStartOffset(token.getLine()-1)+token.getColumn()-1; scriptPane.select(start, start+token.getText().length()); scriptPane.requestFocus(); } catch(BadLocationException ex){ // IGNORE } }
/** * Clones the token */ public Token cloneToken(Token t) { CommonToken clone = new CommonToken(t.getType(),t.getText()); clone.setLine(t.getLine()); clone.setColumn(t.getColumn()); return clone; }
GroovySourceToken gst = (GroovySourceToken) token; if (StringUtils.isNotBlank(text)) { tokens.add(new GroovyToken(token.getLine(), token.getColumn(), gst.getLineLast(), gst.getColumnLast(), getImage(token, text), typeOfText));