?? hashcomment.java
字號:
package lolo.scans;/** A recognizer class to scan for hash comments: all characters from <tt>#</tt> up to EOL. * <p>By default these symbols will be ignored. * * @author <a href="http://www.inf.uos.de/bernd" target="_blank">Bernd Kühl</a> (<a href="mailto:bernd@informatik.uni-osnabrueck.de">bernd@informatik.uni-osnabrueck.de</a>) */public class HashComment extends SlashSlashComment { /** The legal characters. */ // A means ANY protected static final String chars = "A#\r\n"; /** The state table. */ protected static final int newState [][] = { // current state, input => newstate // ANY # \r \n { 3, 1, 3, 3 }, // state 0, find # { 1, 1, 2, 2 } // state 1, okay and need more characters // state 2, comment found // state 3, error }; public State nextChar(char ch) { // is ch a legal input character? int input = chars.indexOf(ch); if (input < 0) input = 0; boolean found = false, more = false; state = newState[state][input]; switch(state) { case 3: break; // error state, parse ends case 0: new RuntimeException("illegal state "+state); // cann't be.. case 1: more = true; break; case 2: found = true; break; default: new RuntimeException("illegal state "+state); // cann't be.. } return stateObject.set(more, found); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -