我目前正在逐个读取文件令牌,我想先读取整行,然后将其拆分为令牌。这是我通过令牌阅读的代码的一部分:
public void getNextToken(){
String temp = input.next();
if(temp.equals("$")){
nextToken = Symbols.ENDOFFILE;
}
else if(temp.equals("a")){
nextToken = Symbols.IDENT;
}
else if(temp.equals(";")){
nextToken = Symbols.SEMICOLON;
}
else if(temp.equals("const")){
nextToken = Symbols.CONSTANT;