java netbeans中变量的标记化
如何标记变量, 常量、类、方法名称作为java中的特殊标记“$”java netbeans中变量的标记化,java,jsp,netbeans-8,Java,Jsp,Netbeans 8,如何标记变量, 常量、类、方法名称作为java中的特殊标记“$” try { int ch; boolean slashCommentFound = false; boolean starCommentFound = false; boolean firstSlashFound = false; boolean startOfComment = false; boolean endOfComment = false; boolean sta
try {
int ch;
boolean slashCommentFound = false;
boolean starCommentFound = false;
boolean firstSlashFound = false;
boolean startOfComment = false;
boolean endOfComment = false;
boolean startDoubleQuoteFound = false;
StringBuilder javaDoc = new StringBuilder();
StringBuffer buffer = new StringBuffer();
BufferedReader reader = new BufferedReader(new FileReader(
"D://abc.txt"));
BufferedWriter writer = new BufferedWriter(new FileWriter(
"D:\\abc1.txt"));
while ((ch = reader.read()) != -1) {
javaDoc.append((char) ch);
if (ch == '\"')
startDoubleQuoteFound = !startDoubleQuoteFound;
if (startDoubleQuoteFound
&& (starCommentFound == true || slashCommentFound == true))
continue;
if (ch == '/') {
if (starCommentFound == true && endOfComment == false)
continue;
if (endOfComment && starCommentFound == true) {
starCommentFound = false;
endOfComment = false;
startOfComment = false;
continue;
}
else if (firstSlashFound && slashCommentFound == false
&& starCommentFound == false) {
slashCommentFound = true;
firstSlashFound = false;
continue;
}
else if (slashCommentFound == false
&& starCommentFound == false
&& startDoubleQuoteFound == false) {
firstSlashFound = true;
continue;
}
}
if (ch == '*') {
if (starCommentFound) {
endOfComment = true;
continue;
}
if (firstSlashFound && starCommentFound == false) {
starCommentFound = true;
firstSlashFound = false;
continue;
}
else if (startOfComment == false
&& starCommentFound == true) {
startOfComment = true;
continue;
}
}
if (ch == '\n') {
if (slashCommentFound) {
slashCommentFound = false;
startOfComment = false;
firstSlashFound = false;
starCommentFound = false;
out.print((char) ch);
continue;
}
}
if (starCommentFound == true && endOfComment == false)
continue;
String doc = javaDoc.toString();
if (doc.trim().startsWith("/**") && doc.trim().endsWith("*/")) {
// out.print(javaDoc.toString());
javaDoc = new StringBuilder();
}
if (ch != '/' && ch != '*') {
if (endOfComment)
System.out.print((char) ch);
endOfComment = false;
firstSlashFound = false;
startOfComment = false;
endOfComment = false;
}
if (slashCommentFound == false && starCommentFound == false) {
javaDoc = new StringBuilder();
// out.print( ( char ) ch );
}
buffer.append((char) ch);
writer.write((char) ch);
}
fileOutput = buffer.toString();
reader.close();
writer.close();
} catch (FileNotFoundException ex) {
} catch (Exception ex) {
ex.printStackTrace();
}
输入是文件,我想用$intaa,b,c标记这个文件;c=aa+b;请用java向我发送代码