java词法分析器
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
package JAccidenceAnalyse;
import .*;
import .*;
import .*;
public class AccidenceAnalyser {
private SourceFile;
private ReserveFile;
private ClassFile;
private OutputFile;
public Pretreatment pretreatment;
public KeyWordTable keyWordTable;
public ClassIdentity classIdentity;
public Scaner scaner;
public ConcreteScanBufferFactory csbFactory;
/**
* 2)词法分析器主程序
* @roseuid 3D9BB93303D0
*/
public AccidenceAnalyser() {
"[INFOR]已经建立词法分析器!");
}
/**
* @roseuid 3D9BAEF9029F
*/
public void initAA() {
getBytes());
( ("etBytes());
("etBytes());
(" getBytes());
(" getBytes());
("词法分析结果如下:\n".getBytes());
;
import .*;
public class ClassIdentity {
private Hashtable ClassHash;
private File ClassFile;
private FileReader classFileReader; rim();
"[INFOR]读取类型种别码: [KEY: " + classCounter +
"][VALUE: " + classWord + "]");
classWord);
}
;
import .*;
public class KeyWordTable {
private Hashtable KWHash;
private File ReserveFile;
private FileReader resFileReader; rim();
"[INFOR]读取关键字: [INDEX: " + resCounter +
"][VALUE: " + resWord + "]");
resWord);
}
tem(0).
getFirstChild().getNodeValue().trim();
/******************/
cfgString[1] = ("ClassFileName").item(0).
getFirstChild().getNodeValue().trim();
/******************/
cfgString[2] = ("SourceFileName").item(0).
getFirstChild().getNodeValue().trim();
/******************/
cfgString[3] = ("OutputFileName").item(0).
getFirstChild().getNodeValue().trim();
/******************/
}
}
catch (Exception e) {
();
throw new Exception("[ERROR]加载配置文件 " + name + " 错误!");
}
;
import .*;
public class Pretreatment {
private String tmpString;
private String outputString;
private int BUFFER_SIZE = 100;
private AccidenceAnalyser aa;
public InputBuffer inputBuffer; .................begin row " + + ".......................");
rim();
return filtratedString;
}
/**
* @roseuid 3D9BB9350315
*/
public void startPretreatment() {
();
}
}
package JAccidenceAnalyse;
import .*;
public class Scaner {
public ScanBuffer scanBuffer; :
.................end row " + +
".........................");
;
public class InputBuffer
implements Buffer {
public char[] Data;
/**