⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpleidentifier.java

📁 JAVA在编译原理上的应用。
💻 JAVA
字号:
package lolo.scans;/** Instances of this class scan for <tt>[_a-zA-Z][_a-zA-Z0-9]*</tt>. * * @author <a href="http://www.inf.uos.de/bernd" target="_blank">Bernd K&uuml;hl</a>           (<a href="mailto:bernd@informatik.uni-osnabrueck.de">bernd@informatik.uni-osnabrueck.de</a>) */public class SimpleIdentifier extends Scan {    /** Marks if the first character is checked. */    protected transient boolean start = true;        public void reset() {        start = true;    }        /** Tests the first character.     *     * @return <tt>true</tt> if the character is a legal first character.     * @param ch the first charatcer of the symbol.     */    protected boolean testStart(char ch) {        return ch == '_' || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z' );    }        /** Tests the characters.     * @return <tt>true</tt> if the characters are a legal characters.     * @param ch the next charatcer of the symbol.     */    protected boolean testPart(char ch) {        return ch == '_' || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z' ) || (ch >= '0' && ch <= '9' );    }        public State nextChar(char ch) {        boolean b = start? testStart(ch) : testPart(ch);        start = false;        return stateObject.set (            b,	// more            b	// found        );    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -