📄 keyanalyse.java
字号:
package accidenceAnalyse;
import java.util.ArrayList;
public class KeyAnalyse //extends IdentifierAnalyse
{
/* 关键字的词法分析*/
public boolean keyAnalyse(String str ,ArrayList<TokenTable> list , ArrayList<String> errorList , int textLine){
for(String ss : keyStr){
if (ss.equals(str)){
this.name = str;
this.ID = 1;
list.add(new TokenTable(this.ID,this.name));
return true;
}
}
return false;
}
// c++的关键字:
final static String[] keyStr = { "and" , "and_eq" , "asm" , "auto" , "bitand" , "bitor",
"bool" , "break" , "case" , "catch" , "char" , "class",
"compl" , "const" , "const_cast" , "continue" , "defalt" , "delete",
"do" , "doule" , "dynamic_cast" , "else" , "enum" , "explicit",
"export" , "extern" , "false" , "float" , "for" , "friend",
"goto" , "if" , "inline" , "int" , "long" , "mutable",
"namespace" , "new" , "not" , "not_eq" , "operator" , "or",
"or_eq" , "privat" , "protected" , "public" , "register" , "reinterpret_cast",
"return" , "short" , "signed" , "sizeof" , "static" , "static_cast",
"struct" , "switch" , "template" , "this" , "throw" , "ture",
"try" , "typedef" , "typeid" , "typename" , "union" , "unsigned",
"using" , "virtual" , "void" , "volatile" , "wchar_t" , "while",
"xor" , "xor_eq"};
private int ID = 0;
private String name = "";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -