📄 java词法分析器_ - java - java_开发文档.htm
字号:
+<BR>
"\n";</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR> break;</P>
<P> case '(':</P>
<P>
//state11<BR>
this.TOKEN = this.CONTACT(TOKEN,
CHAR);<BR>
this.finalAccidence = this.finalAccidence + "[左括号] "
+<BR>
this.returnAWord(TOKEN) + "[种别码] "
+<BR>
String.valueOf(aa.classIdentity.findKey(String.valueOf(CHAR)))
+<BR>
"\n";</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR> break;</P>
<P> case ')':</P>
<P>
//state12<BR>
this.TOKEN = this.CONTACT(TOKEN,
CHAR);<BR>
this.finalAccidence = this.finalAccidence + "[右括号] "
+<BR>
this.returnAWord(TOKEN) + "[种别码] "
+<BR>
String.valueOf(aa.classIdentity.findKey(String.valueOf(CHAR)))
+<BR>
"\n";</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR> break;</P>
<P> case '{':</P>
<P>
//state13<BR>
this.TOKEN = this.CONTACT(TOKEN,
CHAR);<BR>
this.finalAccidence = this.finalAccidence + "[左大括号] "
+<BR>
this.returnAWord(TOKEN) + "[种别码] "
+<BR>
String.valueOf(aa.classIdentity.findKey(String.valueOf(CHAR)))
+<BR>
"\n";</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR> break;</P>
<P> case '}':</P>
<P>
//state14<BR>
this.TOKEN = this.CONTACT(TOKEN,
CHAR);<BR>
this.finalAccidence = this.finalAccidence + "[右大括号] "
+<BR>
this.returnAWord(TOKEN) + "[种别码] "
+<BR>
String.valueOf(aa.classIdentity.findKey(String.valueOf(CHAR)))
+<BR>
"\n";</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR> break;</P>
<P> case '[':</P>
<P>
//state15<BR>
this.TOKEN = this.CONTACT(TOKEN,
CHAR);<BR>
this.finalAccidence = this.finalAccidence + "[左中括号] "
+<BR>
this.returnAWord(TOKEN) + "[种别码] "
+<BR>
String.valueOf(aa.classIdentity.findKey(String.valueOf(CHAR)))
+<BR>
"\n";</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR> break;</P>
<P> case ']':</P>
<P>
//state16<BR>
this.TOKEN = this.CONTACT(TOKEN,
CHAR);<BR>
this.finalAccidence = this.finalAccidence + "[右中括号] "
+<BR>
this.returnAWord(TOKEN) + "[种别码] "
+<BR>
String.valueOf(aa.classIdentity.findKey(String.valueOf(CHAR)))
+<BR>
"\n";</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR> break;</P>
<P> case '.':</P>
<P>
//state17<BR>
this.TOKEN = this.CONTACT(TOKEN,
CHAR);<BR>
this.finalAccidence = this.finalAccidence + "[点号] "
+<BR>
this.returnAWord(TOKEN) + "[种别码] "
+<BR>
String.valueOf(aa.classIdentity.findKey(String.valueOf(CHAR)))
+<BR>
"\n";</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR> break;</P>
<P> default:</P>
<P>
//state18<BR>
this.TOKEN = this.CONTACT(this.TOKEN, this.CHAR);</P>
<P>
//追加出错信息<BR>
this.finalAccidence = this.finalAccidence + "[ERROR]"
+<BR>
this.WORD_ERROR_INF + "'" + this.TOKEN + "'" +
"\n";<BR>
this.ASTATE = false;</P>
<P> //clear up
token<BR> this.TOKEN
= "";<BR>
break;<BR>
}<BR> if (this.ASTATE == false)
{<BR>
break;<BR> }</P>
<P> }<BR> return
this.finalAccidence;<BR> }</P>
<P> /**<BR> * @roseuid 3D9BB2E70260<BR>
*/<BR> public void controlThread() {<BR>
this.toDelString =
this.readFromBuffer(this.scanBuffer.Data);<BR>
this.aa.outputAccidence(this.scan(this.toDelString));<BR>
//分割符<BR> System.out.println("...................end row
" + aa.pretreatment.fileRow
+<BR>
".........................");<BR>
//结束这一行分析<BR> //clear up the var<BR>
this.index = 0;<BR> this.finalAccidence =
"";<BR> this.ASTATE = true;<BR>
this.toDelString = "";<BR> this.senLength =
0;<BR> this.TOKEN = "";<BR> }</P>
<P> /**<BR> * @param tmpString<BR> * @return
String<BR> * @roseuid 3D9BB3FB037F<BR>
*/<BR> public String returnAWord(String TOKEN)
{<BR> return TOKEN;<BR> }</P>
<P> /**<BR> * @roseuid 3D9BB55502B4<BR>
*/<BR> public void initBuffer() {<BR>
this.scanBuffer = aa.csbFactory.createScanBuffer(BUFFER_SIZE);<BR>
}</P>
<P>//以下为字符的处理方法<BR>/////////////////////////////////////////////////////<BR>//////////////字符方法开始///////////////////////////<BR>/////////////////////////////////////////////////////<BR>
/**<BR> * @roseuid 3D9BB0B40383<BR> */<BR>
public char GETBC(char[] sentenceChar) {<BR> try
{<BR> while ( (sentenceChar[this.index]) ==
' ') {<BR>
this.index++;<BR>
}<BR> this.index++;<BR>
}<BR> catch (java.lang.ArrayIndexOutOfBoundsException e)
{<BR> return ';';
//表示此行已经结束<BR> }<BR> return
sentenceChar[index - 1];<BR> }</P>
<P> /**<BR> * @roseuid 3D9BB0B40383<BR>
*/<BR> public char GETCHAR(char[] sentenceChar)
{<BR> next();<BR> return
sentenceChar[this.index - 1];<BR> }</P>
<P> /**<BR> * @roseuid 3D9BB0B40383<BR>
*/<BR> public void next() {<BR>
this.index++;<BR> }</P>
<P> /**<BR> * @roseuid 3D9BB0B40383<BR>
*/<BR> public boolean ISLETTER(char letter) {<BR>
return java.lang.Character.isLetter(letter);<BR> }</P>
<P> /**<BR> * @roseuid 3D9BB0B40383<BR>
*/<BR> public boolean ISDIGIT(char letter) {<BR>
return java.lang.Character.isDigit(letter);<BR> }</P>
<P> /**<BR> * @roseuid 3D9BB0B40383<BR>
*/<BR> public String CONTACT(String TOKEN, char CHAR)
{<BR> String tmpS = TOKEN +
String.valueOf(CHAR);<BR> TOKEN =
tmpS;<BR> return TOKEN;<BR> }</P>
<P> /**<BR> * @roseuid 3D9BB0B40383<BR>
*/<BR> public boolean ISRESERVE(String TOKEN)
{<BR> return aa.keyWordTable.isKeyWord(TOKEN);<BR>
}</P>
<P> /**<BR> * @roseuid 3D9BB0B40383<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -