@Override public String toString() { return String.format( "Unexpected token %s at %d:%d. Expected: %s", unexpected.getText(), unexpected.getLine(), unexpected.getCharPositionInLine(), joiner.join(expected)); }
/** * Returns text position of the given tree node. * * @param tree the source tree node. * @return the text position. */ public static Position getTextPosition(final Tree tree) { return new Position(tree.getLine(), tree.getCharPositionInLine()); }
@Override public int getCharPositionInLine(){ int col=0; if ( token!=null ) { col = token.getCharPositionInLine(); } if ( col==0 ) { Tree child = getChild(0); if ( child!=null ) { col = child.getCharPositionInLine(); } } return col; }
@Override public int getCharPositionInLine(){ int col=0; if ( token!=null ) { col = token.getCharPositionInLine(); } if ( col==0 ) { Tree child = getChild(0); if ( child!=null ) { col = child.getCharPositionInLine(); } } return col; }
private String getDefaultFieldText(Tree tree) throws QueryParseException { String val = tree.getChild(0).toString(); if (val.startsWith("\"") && val.endsWith("\"") && val.length() >= 2) { val = val.substring(1, val.length() - 1); } if (!isValidExpression(val)) { throw new QueryParseException("Invalid query at " + tree.getCharPositionInLine() + ": " + tree.getText()); } return Query.sanitizeValue(val); }
public Component getTreeCellRendererComponent(JTree arg0, Object arg1, boolean selected, boolean expanded, boolean leaf, int row, boolean arg6) { JLabel label = new JLabel(); Tree ast = (Tree) arg1; if (selected){ label.setOpaque(true); label.setBackground(SystemColor.activeCaption); label.setForeground(SystemColor.activeCaptionText); } label.setIcon(new ImageIcon(V3TreeCellRenderer.class.getResource("node.gif"))); label.setText("<html>" + getText(ast) + " (" + v3Resolver.getField(ast.getType()) + "-" + ast.getType() + ")" + "<font color='#C0C0C0'>" + " (Line:" + ast.getLine() + ",Col:" + ast.getCharPositionInLine() //+ ", Props: " //+ toString(((EolAst) ast).getProperties()) //+ (ast instanceof FileAst ? ((FileAst) ast).getFile().getAbsolutePath() : "") + ")" //+ StringUtil.toString(ast.getNextSibling()) + "</font>" + "</html>"); return label; }
child.setAttribute("column", String.valueOf(childNode.getCharPositionInLine())); child.setAttribute("class", ""); child.setAttribute("method", "");
private void putAlias(BaseQuery<?> q, Tree aliasedDef, final Aliased aliased, final AbstractFrom<?, ?> from) { Map<String, AbstractFrom<?, ?>> aliasMap = this.aliasMap.get(q); if (aliasMap == null) { aliasMap = Maps.newHashMap(); this.aliasMap.put(q, aliasMap); } String alias = aliased.getAlias(); if (alias == null) { alias = aliased.getQualified().getSegments().getLast(); from.alias(alias); } if (aliasMap.containsKey(alias)) { throw new PersistenceException("Alias already exists: " + alias + ", line " + aliasedDef.getLine() + ":" + aliasedDef.getCharPositionInLine()); } aliasMap.put(aliased.getAlias(), from); } }
private void putAlias(BaseQuery<?> q, Tree aliasedDef, final Aliased aliased, final AbstractFrom<?, ?> from) { Map<String, AbstractFrom<?, ?>> aliasMap = this.aliasMap.get(q); if (aliasMap == null) { aliasMap = Maps.newHashMap(); this.aliasMap.put(q, aliasMap); } String alias = aliased.getAlias(); if (alias == null) { alias = aliased.getQualified().getSegments().getLast(); from.alias(alias); } if (aliasMap.containsKey(alias)) { throw new PersistenceException("Alias already exists: " + alias + ", line " + aliasedDef.getLine() + ":" + aliasedDef.getCharPositionInLine()); } aliasMap.put(aliased.getAlias(), from); } }
/** * @return a Delphi statement */ public StatementInterface createStatement() { StatementInterface statement = new DelphiStatement(lastStatementText, checkedNode.getLine(), checkedNode.getCharPositionInLine(), delphiProjectHelper); statement.setComplexity(isComplex); return statement; }
private String getFunctionName(CommonTree functionNode) { Tree nameNode = functionNode.getFirstChildWithType(LexerMetrics.FUNCTION_NAME.toMetrics()); if (nameNode == null) { return ""; } functionLine = nameNode.getLine(); functionCharPosition = nameNode.getCharPositionInLine(); StringBuilder str = new StringBuilder(); for (int i = 0; i < nameNode.getChildCount(); ++i) { Tree child = nameNode.getChild(i); str.append(child.getText()); } return str.toString(); }
public int getCharPositionInLine() { if ( token==null || token.getCharPositionInLine()==-1 ) { if ( getChildCount()>0 ) { return getChild(0).getCharPositionInLine(); } return 0; } return token.getCharPositionInLine(); }
@Override public int getCharPositionInLine() { if ( token==null || token.getCharPositionInLine()==-1 ) { if ( getChildCount()>0 ) { return getChild(0).getCharPositionInLine(); } return 0; } return token.getCharPositionInLine(); }
@Override public int getCharPositionInLine() { if ( token==null || token.getCharPositionInLine()==-1 ) { if ( getChildCount()>0 ) { return getChild(0).getCharPositionInLine(); } return 0; } return token.getCharPositionInLine(); }
@Override public int getCharPositionInLine() { if ( token==null || token.getCharPositionInLine()==-1 ) { if ( getChildCount()>0 ) { return getChild(0).getCharPositionInLine(); } return 0; } return token.getCharPositionInLine(); }
@Override public int getCharPositionInLine() { if ( token==null || token.getCharPositionInLine()==-1 ) { if ( getChildCount()>0 ) { return getChild(0).getCharPositionInLine(); } return 0; } return token.getCharPositionInLine(); }
@Override public int getCharPositionInLine() { if ( token==null || token.getCharPositionInLine()==-1 ) { if ( getChildCount()>0 ) { return getChild(0).getCharPositionInLine(); } return 0; } return token.getCharPositionInLine(); }
throw new PersistenceException("Cannot load class: " + className + ", line " + selectDef.getLine() + ":" + selectDef.getCharPositionInLine());
throw new PersistenceException("Cannot load class: " + className + ", line " + selectDef.getLine() + ":" + selectDef.getCharPositionInLine());
this.charPositionInLine = ((Tree)this.node).getCharPositionInLine(); if ( this.node instanceof CommonTree) { this.token = ((CommonTree)this.node).token;