Ctags.java revision bfb054a567cb4af250de4c052934c9541b1cd7fa
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/**
* Provides Ctags by having a running instance of ctags
*
* @author Chandan
*/
public class Ctags {
private OutputStreamWriter ctagsIn;
private BufferedReader ctagsOut;
//default: setCtags(System.getProperty("org.opensolaris.opengrok.analysis.Ctags", "ctags"));
private ProcessBuilder processBuilder;
}
public void close() throws IOException {
}
}
private void initialize() throws IOException {
if (processBuilder == null) {
// Workaround for bug #14924: Don't get local variables in Java
// code since that creates many false positives. Uncomment the next
// line when the bug has been fixed.
// command.add("--java-kinds=+l");
command.add("--regex-Asm=/^[ \\t]*(ENTRY|ENTRY2|ALTENTRY)[ \\t]*\\(([a-zA-Z0-9_]+)/\\2/f,function/"); // for assmebly definitions
}
public void run() {
try {
String s;
}
} catch (IOException exp) {
} finally {
}
}
}
});
}
boolean ctagsRunning = false;
try {
ctagsRunning = false;
// ctags is dead! we must restart!!!
} catch (IllegalThreadStateException exp) {
ctagsRunning = true;
// ctags is still running :)
}
}
if (!ctagsRunning) {
initialize();
}
//log.fine("doing >" + file + "<");
ret = new Definitions();
}
return ret;
}
try {
do {
//log.fine("Tagline:-->" + tagLine+"<----ONELINE");
try {
} catch (Exception e) {
}
return;
}
return;
}
//fix for bug #16334
log.log(Level.WARNING, "ctags encountered a problem while generating tags for the file. The index will be incomplete.");
return;
}
if (p <= 0) {
//log.fine("SKIPPING LINE - NO TAB");
continue;
}
//log.fine(" p = " + p + " lp = " + lp);
//log.fine("FIELD===" + fld);
lp = p;
break;
} else {
}
}
} else {
continue;
}
//TODO if some languages use different character for separating arguments, below needs to be adjusted
//log.fine("Param = "+ arg);
int space = arg.lastIndexOf(' ');//TODO this is not the best way, but works to find the last string(name) in the argument, hence skipping type
//FIXME this will not work for typeless languages such as python or assignments inside signature ... but since ctags doesn't provide signatures for python yet and assigning stuff in signature is not the case for c or java, we don't care ...
String[] names=afters.split("[\\W]"); //this should just parse out variables, we assume first non empty text is the argument name
//log.fine("Param Def = "+ string);
break;
}
}
}
}
}
//log.fine("Read = " + def + " : " + lnum + " = " + kind + " IS " + inher + " M " + match);
} while (true);
} catch (Exception e) {
}
}
}