public Set<File> getSourceFiles() { Set<File> files = new HashSet<File>(); for (SClassDefinition def : this) { if (!(def instanceof ACpuClassDefinition || def instanceof ABusClassDefinition)) { files.add(def.getLocation().getFile()); } } return files; }
/** * Added to fix the location on traces * * @param content * @param dialect * @param location */ public LexTokenReader(String content, Dialect dialect, ILexLocation location) { super(content); this.file = location.getFile(); this.dialect = dialect; this.location = location; init(); }
protected StringBuilder stackResponse(ILexLocation location, int level) { StringBuilder sb = new StringBuilder(); sb.append("<stack level=\"" + level + "\""); sb.append(" type=\"file\""); sb.append(" filename=\"" + location.getFile().toURI() + "\""); sb.append(" lineno=\"" + location.getStartLine() + "\""); sb.append(" cmdbegin=\"" + location.getStartLine() + ":" + location.getStartPos() + "\""); sb.append("/>"); return sb; }
public static LexNameList getSpanNames(File filename) { LexNameList list = new LexNameList(); for (LexNameToken name : nameSpans.keySet()) { ILexLocation span = nameSpans.get(name); if (span.getFile().equals(filename)) { list.add(name); } } return list; }
public LexNameList getSpanNames(File filename) { LexNameList list = new LexNameList(); for (LexNameToken name : nameSpans.keySet()) { ILexLocation span = nameSpans.get(name); if (span.getFile().equals(filename)) { list.add(name); } } return list; }
public List<Integer> getMissList(File file) { List<Integer> misses = new Vector<Integer>(); synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getHits() == 0 && l.getFile().equals(file)) { misses.add(l.getStartLine()); } } } return misses; }
public static List<Integer> getMissList(File file) { List<Integer> misses = new Vector<Integer>(); synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getHits() == 0 && l.getFile().equals(file)) { misses.add(l.getStartLine()); } } } return misses; }
/** * Get a line of a source file. * * @param src * @return */ public String getSourceLine(ILexLocation src) { return getSourceLine(src.getFile(), src.getStartLine()); }
@Override public boolean equals(Object other) { if (other instanceof ILexLocation) { ILexLocation lother = (ILexLocation) other; return startPos == lother.getStartPos() && startLine == lother.getStartLine() && module.equals(lother.getModule()) && file.equals(lother.getFile()); } return false; }
@Override public File getDefaultFile() { return defaultClass.getName().getLocation().getFile(); }
/** * @return The current default module's file name. */ @Override public File getDefaultFile() { return defaultModule.getName().getLocation().getFile(); }
@Override public String toString() { return "[Violation in module " + location.getModule() + ": '" + description + "'. Location: line " + location.getStartLine() + " at position: " + location.getStartPos() + " in " + location.getFile().getName() + "]"; }
protected void processCurrentLine(DBGPCommand c) throws DBGPException, IOException { if (status != DBGPStatus.BREAK && status != DBGPStatus.STOPPING || breakpoint == null) { throw new DBGPException(DBGPErrorCode.NOT_AVAILABLE, c.toString()); } OutputStream out = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(out); pw.println(breakpoint.stoppedAtString()); pw.println(interpreter.getSourceLine(breakpoint.location.getFile(), breakpoint.location.getStartLine(), ": ")); pw.close(); cdataResponse(out.toString()); }
public PStm findStatement(AModuleModules m, File file, int lineno) { if (m.getName().getLocation().getFile().equals(file)) { return af.createPDefinitionAssistant().findStatement(m.getDefs(), lineno); } return null; }
public PExp findExpression(AModuleModules m, File file, int lineno) { if (m.getName().getLocation().getFile().equals(file)) { return af.createPDefinitionListAssistant().findExpression(m.getDefs(), lineno); } return null; }
public boolean within(ILexLocation span) { return (startLine > span.getStartLine() || startLine == span.getStartLine() && startPos >= span.getStartPos()) && (startLine <= span.getEndLine() || startLine == span.getEndLine() && startPos < span.getEndPos()) && file.equals(span.getFile()); }
public static void addSpan(LexNameToken name, LexToken upto) { LexLocation span = new LexLocation(name.location.getFile(), name.location.getModule(), name.location.getStartLine(), name.location.getStartPos(), upto.location.getEndLine(), upto.location.getEndPos(), upto.location.getStartOffset(), upto.location.getEndOffset()); nameSpans.put(name, span); }
public static void addSpan(LexNameToken name, LexToken upto) { LexLocation span = new LexLocation(name.location.getFile(), name.location.getModule(), name.location.getStartLine(), name.location.getStartPos(), upto.location.getEndLine(), upto.location.getEndPos(), upto.location.getStartOffset(), upto.location.getEndOffset()); nameSpans.put(name, span); }
private AModuleModules readFlatModule() throws ParserException, LexException { File file = lastToken().location.getFile(); setCurrentModule("DEFAULT"); List<PDefinition> definitions = getDefinitionReader().readDefinitions(); checkFor(VDMToken.EOF, 2318, "Unexpected token after flat definitions"); return AstFactory.newAModuleModules(file, definitions); }
public ILexNameToken getClassName() { // We don't know the class name of the name of a class until we've // read the name. So create a new location with the right module. LexLocation loc = new LexLocation(location.getFile(), name, location.getStartLine(), location.getStartPos(), location.getEndLine(), location.getEndPos(), location.getStartOffset(), location.getEndOffset()); return new LexNameToken("CLASS", name, loc); }