File f = new File(System.getProperty("test.src", "."), "input.txt");
int slashIsCommentStart = 1; int slashSlashComment = 2; int slashStarComment = 4;
for (int i = 0; i < 8 ; i++) {
FileReader reader = new FileReader(f); try {
StreamTokenizer st = new StreamTokenizer(reader);
/* decide the state of this run */ boolean slashCommentFlag = ((i & slashIsCommentStart) != 0); boolean slashSlashCommentFlag = ((i & slashSlashComment) != 0); boolean slashStarCommentFlag = ((i & slashStarComment) != 0);
/* set the initial state of the tokenizer */ if (!slashCommentFlag) {
st.ordinaryChar('/');
}
st.slashSlashComments(slashSlashCommentFlag);
st.slashStarComments(slashStarCommentFlag);
/* now go throgh the input file */ while(st.nextToken() != StreamTokenizer.TT_EOF)
{
String token = st.sval; if (token == null) { continue;
} else { if ((token.compareTo("Error1") == 0) && slashStarCommentFlag) { thrownew Exception("Failed to pass one line C comments!");
} if ((token.compareTo("Error2") == 0) && slashStarCommentFlag) { thrownew Exception("Failed to pass multi line C comments!");
} if ((token.compareTo("Error3") == 0) && slashSlashCommentFlag) { thrownew Exception("Failed to pass C++ comments!");
} if ((token.compareTo("Error4") == 0) && slashCommentFlag) { thrownew Exception("Failed to pass / comments!");
}
}
}
} finally {
reader.close();
}
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.