private void reportWarning(Tree curNode, String message) { if (modelMarkerHandler != null) { modelMarkerHandler.createModelMarker(message, org.eclipse.core.resources.IMarker.SEVERITY_WARNING, curNode.getLine()); } Logger.logWarning(message + " (at line " + curNode.getLine() + ((featureModelFile != null) ? IN_FILE + featureModelFile.getName() : "") + ": \"" + curNode.getText() + "\")"); }
private void reportWarning(Tree curNode, String message) { if (modelMarkerHandler != null) { modelMarkerHandler.createModelMarker(message, org.eclipse.core.resources.IMarker.SEVERITY_WARNING, curNode.getLine()); } Logger.logWarning(message + " (at line " + curNode.getLine() + ((featureModelFile != null) ? IN_FILE + featureModelFile.getName() : "") + ": \"" + curNode.getText() + "\")"); }
@Override public String toString() { return String.format( "Unexpected token %s at %d:%d. Expected: %s", unexpected.getText(), unexpected.getLine(), unexpected.getCharPositionInLine(), joiner.join(expected)); }
private void reportWarning(Tree curNode, String message) { Logger.logWarning(message + " (at line " + curNode.getLine() + ((featureModelFile != null) ? IN_FILE + featureModelFile.getFileName() : "") + ": \"" + curNode.getText() + "\")"); }
/** * 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 getLine() { int line=0; if ( token!=null ) { line = token.getLine(); } if ( line==0 ) { Tree child = getChild(0); if ( child!=null ) { line = child.getLine(); } } return line; }
@Override public int getLine() { int line=0; if ( token!=null ) { line = token.getLine(); } if ( line==0 ) { Tree child = getChild(0); if ( child!=null ) { line = child.getLine(); } } return line; }
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; }
protected int getLastLine(Tree node) { int line = -1; for (int i = 0; i < node.getChildCount(); ++i) { Tree child = node.getChild(i); if (child.getLine() > line) { line = child.getLine(); } if (child.getType() == DelphiLexer.BEGIN) { line = getLastLine(child); } else if (child.getType() == DelphiLexer.END) { return line; } } return line; } }
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 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(); }
@Override public int getLine() { if ( token==null || token.getLine()==0 ) { if ( getChildCount()>0 ) { return getChild(0).getLine(); } return 0; } return token.getLine(); }
@Override public int getLine() { if ( token==null || token.getLine()==0 ) { if ( getChildCount()>0 ) { return getChild(0).getLine(); } return 0; } return token.getLine(); }
public int getLine() { if ( token==null || token.getLine()==0 ) { if ( getChildCount()>0 ) { return getChild(0).getLine(); } return 0; } return token.getLine(); }
@Override public int getLine() { if ( token==null || token.getLine()==0 ) { if ( getChildCount()>0 ) { return getChild(0).getLine(); } return 0; } return token.getLine(); }
@Override public int getLine() { if ( token==null || token.getLine()==0 ) { if ( getChildCount()>0 ) { return getChild(0).getLine(); } return 0; } return token.getLine(); }
@Override public int getLine() { if ( token==null || token.getLine()==0 ) { if ( getChildCount()>0 ) { return getChild(0).getLine(); } return 0; } return token.getLine(); }
private UnitInterface createUnit(Tree currentNode, String fileName) { UnitInterface activeUnit = new DelphiUnit(); activeUnit.setPath(fileName); activeUnit.setName(getUnitName(currentNode)); activeUnit.setLine(currentNode.getLine()); return activeUnit; }
private int extractLine(Tree currentCodeNode) { Tree parent = currentCodeNode.getParent(); for (int i = currentCodeNode.getChildIndex() - 1; i >= 0; i--) { Tree child = parent.getChild(i); if (child.getType() == DelphiLexer.FUNCTION || child.getType() == DelphiLexer.PROCEDURE || child.getType() == DelphiLexer.CONSTRUCTOR || child.getType() == DelphiLexer.DESTRUCTOR || child.getType() == DelphiLexer.OPERATOR) { return child.getLine(); } } return -1; }