亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? scanner.java

?? JAVA在編譯原理上的應用。
?? JAVA
字號:
package lolo;import java.io.Serializable;import java.io.IOException;import java.util.Map;import java.util.HashMap;import java.util.Iterator;import lolo.Scan.State;/** A <tt>Scanner</tt> collects <tt>Scan</tt> objects to maintain a lexical scanner. * The characters are read from an <tt>Input</tt> object. * <p>A <tt>Scanner</tt> can be serialized to be reused. * * @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>) * @see lolo.Mux * @see lolo.Scan * @see lolo.Input * @see lolo.Scanner#scan(Input) */public class Scanner implements Serializable {    /** Array of all <tt>Scan</tt> objects.     *     * @see lolo.Scan     */    protected Scan[] scans = new Scan[1];    /** Indexes in <tt>scans</tt>. */    protected int next, max = scans.length;        /** Constructs an empty <tt>Scanner</tt>. */    public Scanner() {}    /** Constructs a <tt>Scanner</tt> managing one <tt>Scan</tt> instance.     *     * @see lolo.Scan     */    public Scanner(Scan scan) {        add(scan);    }    /** Constructs a <tt>Scanner</tt> managing many <tt>Scan</tt> instances.     *     * @see lolo.Scan     */    public Scanner(Scan [] scans) {        if (scans == null)            throw new IllegalArgumentException("scans is null");        for (int i = 0; i < scans.length; i++)             add(scans[i]);    }    /** Marks if this <tt>Scanner</tt> is packed.     *     * @see lolo.Scanner#pack()     */    protected boolean packed;        /** Adds a <tt>Scan</tt> instance to this <tt>Scanner</tt>.     *     * @param scan the added recognizer.     * @throws IllegalArgumentException if the argument is <tt>null</tt>.     * @see lolo.Scan     */    public boolean add(Scan scan) throws IllegalArgumentException {        if (scan == null)            throw new IllegalArgumentException("scan is null");        if (contains(scan)) return false;        if (max == next) {            Scan [] help = new Scan[max*=2];            System.arraycopy(scans, 0, help, 0, max/2);            scans = help;        }        scans[next++] = scan;        packed = false;        return true;    }    /** Adds all elements of a <tt>Scan</tt> array to this <tt>Scanner</tt>.     *     * @param scans the added recognizers.     * @throws IllegalArgumentException if the argument or the elements of the argument are <tt>null</tt>.     * @see lolo.Scan     */    public boolean add(Scan [] scans) throws IllegalArgumentException {        if (scans == null)            throw new IllegalArgumentException("scan is null");        boolean b = false;        for (int i = 0; i < scans.length; i++)             b |= add(scans[i]);        return b;    }    /** Removes a <tt>Scan</tt> instance to this <tt>Scanner</tt>.     *     * @see lolo.Scan     */	public boolean remove(Scan scan) {        for (int i = 0; i < next; i++)            if (scans[i].equals(scan)) {                if(i <= next-1)                    System.arraycopy(scans, i+1, scans, i, next-(i+1));                next--;                packed = false;                return true;            }        return false;	}    /** Returns if this <tt>Scanner</tt> contains the <tt>Scan</tt> instance. The check is done by using     * <tt>equals()</tt>.     *     * @return if this <tt>Scanner</tt> contains the <tt>Scan</tt> instance.     * @see lolo.Scan     */	public boolean contains(Scan scan) {        for (int i = 0; i < next; i++)            if (scans[i].equals(scan))                return true;        return false;	}    /** Returns if this <tt>Scanner</tt> is packed.     *     * @return if this <tt>Scanner</tt> is packed.     */    public boolean packed() {        return packed;    }        /** Array holding for every character-index a <tt>Scan</tt> or <tt>Mux</tt> object.     *     * @see lolo.Mux     * @see lolo.Scan     */    public transient Scan[] table;        /** Packs the <tt>table</tt> with <tt>Scan</tt> or <tt>Mux</tt> objects.     *     * @see lolo.Mux     * @see lolo.Scan     */    public void pack() {        if (packed) return;        	    if (debug)            System.err.println("start packing...");                table = new Scan[unicode ? Character.MAX_VALUE+1 : 128];        for (int ch = 0; ch <= (unicode ? Character.MAX_VALUE : 127); ch++) {            for (int i = 0; i < next; i++) {                Scan scan = scans[i];                scan.reset();                State state = scan.nextChar((char) ch);                if (state.more || state.found)                    enter(ch, scan);            }            if (debug && ch > 0 && (ch % 5000 == 00))                System.err.println("packing up to "+ch+" done...");        }	    if (debug)            System.err.println("replacing Mux objects...");        // replace equal Mux by one Mux and reset all recognizers        Map muxs = new HashMap();        int countMux = 0;        for (int ch = 0; ch <= (unicode ? Character.MAX_VALUE : 127); ch++) {            Scan scan = table[ch];            if (scan instanceof Mux) {                Mux mux = (Mux) scan;                if (muxs.containsKey(mux)) {                    table[ch] = (Mux) muxs.get(mux);                } else {                    muxs.put(mux, mux);  // better use a Set collection....                    countMux++;                }            }        }        	    if (debug)            System.err.println(countMux+" Mux objects...");        // reset all scans and all mux objects        Iterator iterator = muxs.keySet().iterator();        while (iterator.hasNext())            ((Scan) iterator.next()).reset();        for (int i = 0; i < next; i++)            scans[i].reset();        packed = true;        	    if (debug)            System.err.println("packing done...");    }        /** Enters <tt>scan</tt> at index <tt>index</tt> into the table.     * This may creates a <tt>Mux</tt> object.    *     * @see lolo.Mux     * @see lolo.Scan     * @param index index into the table for <tt>scan</tt>.     * @param scan the new <tt>Scan</tt> object for table index <tt>index</tt>.     */    protected void enter(int index, Scan scan) {        if (table[index] != null)            if (table[index] instanceof Mux)                ((Mux) table[index]).add(scan);            else                table[index] = new Mux(table[index], scan);        else            table[index] = scan;    }        /** debug mode? */    public boolean debug = false;        /** Finds and returns the next winning <tt>Scan</tt> object or <tt>null</tt> at EOF.     *     * @return the winning <tt>Scan</tt> object or <tt>null</tt> at EOF.     * @param the character input source.     * @throws IllegalCharacterException if no symbol was found.     * @throws IOException if an I/O error occured.     */    public Scan scan(Input input) throws IllegalCharacterException, IOException {        if (!packed) pack();        while (true) {            input.setStartSymbol();            int first = input.next();            int symbolLength = -1, length = 1;                        if(!unicode && 127 < first)                 throw new IllegalCharacterException((char) first, input.toString());                            int ch = first;            if (ch < 0)                return null;            Scan scan = table[ch];            if (scan == null)                throw new IllegalCharacterException((char) first, input.toString());            scan.reset();                        boolean found = false;            input.mark();             while (true) {                if(!unicode && 127 < ch)                     throw new IllegalCharacterException((char) ch, input.toString());                State state = scan.nextChar((char) ch);                if (state.found) {                    input.mark();                    found = true;                    symbolLength = length;                }                if (!state.more)                    break;                ch = input.next();                length++;                if (ch < 0) break;            }                        if (!found)                throw new IllegalCharacterException((char) first, input.toString());                            input.pushBackToMarked();            input.unmark();                        Scan winner = scan instanceof Mux ? ((Mux) scan).winner() : scan;            winner.action(input.buffer, input.startOfSymbol, symbolLength);            if (!winner.getIgnore())                return winner ;        }    }        /** Unicode (or ASCII) mode? */    protected boolean unicode;        /** Set Unicode (or ASCII) mode mode.     *     * @param the new mode.     */    public void setUnicode(boolean unicode) {        packed = this.unicode == unicode;        this.unicode = unicode;    }    /** Returns if the current mode is Unicode.      *     * @return if the current mode is Unicode.     */    public boolean getUnicode() {        return unicode;    }        /** Deserializes the object. */	private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {        stream.defaultReadObject();        int length = stream.readInt();        table = new Scan[length];        int pairs = stream.readInt();        int n = 0;        while (pairs > 0) {            Scan s = (Scan) stream.readObject();            String string = (String) stream.readObject();            pairs--;            for (int i = 0 ; i < string.length(); i++) {                table[(int) string.charAt(i)] = s;                n++;            }        }    }    /** Serializes the object. */	private void writeObject(java.io.ObjectOutputStream stream) throws IOException {        stream.defaultWriteObject();        Map map = new HashMap();        for (int i = 0; i < this.table.length; i++) {            Scan s = (Scan) this.table[i];            if (s != null)                if (map.containsKey(s))                    ((StringBuffer) map.get(s)).append((char) i);                else                    map.put(s, new StringBuffer().append((char) i));        }        stream.writeInt(table.length);        stream.writeInt(map.size());        Iterator keys = map.keySet().iterator();        while (keys.hasNext()) {            Scan s = (Scan) keys.next();            String string = ((StringBuffer) map.get(s)).toString();            stream.writeObject(s);            stream.writeObject(string);        }    }    	/** An <tt>IllegalCharacterException</tt> is thrown, when no <tt>Scan</tt> instance matches     * the current character.     *     * @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 static class IllegalCharacterException extends Exception {        /** The illegal character. */        protected char ch;        /** Constructs an <tt>IllegalCharacterException</tt>.         *         * @param ch the illegal character.         * @param message the message.         */        public IllegalCharacterException(char ch, String message) {            super(message);            this.ch = ch;        }        /** Return the illegal character.         *         * @return the illegal character.         */        public char getChar() { return ch; }        /** Returns <tt>"IllegalCharacterException["+ch+","+getMessage()+"]"</tt>         *         * @return <tt>"IllegalCharacterException["+ch+","+getMessage()+"]"</tt>         */        public String toString() {            return "IllegalCharacterException["+ch+","+getMessage()+"]";        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
看电影不卡的网站| 欧美午夜精品一区二区蜜桃| 91麻豆精品视频| 欧美一区二区免费| 亚洲欧美激情一区二区| 麻豆精品视频在线观看| 一本色道a无线码一区v| 久久久久99精品一区| 性做久久久久久| 99re亚洲国产精品| 国产香蕉久久精品综合网| 日本不卡不码高清免费观看| 色噜噜久久综合| 国产精品欧美综合在线| 极品少妇一区二区| 日韩一区二区精品在线观看| 亚洲夂夂婷婷色拍ww47| 91亚洲永久精品| 国产精品色婷婷久久58| 国产精品资源在线看| 日韩一区二区免费在线电影 | 亚洲成人777| 97久久精品人人爽人人爽蜜臀| 久久久美女艺术照精彩视频福利播放| 日本最新不卡在线| 555夜色666亚洲国产免| 亚洲成人在线免费| 欧美美女bb生活片| 五月激情六月综合| 欧美色爱综合网| 亚洲一区二区影院| 欧美日韩一区二区三区四区五区| 亚洲精品综合在线| 欧美三级蜜桃2在线观看| 亚洲精品福利视频网站| 欧美日韩综合在线免费观看| 一区二区不卡在线播放| 欧美日韩在线一区二区| 亚洲1区2区3区4区| 欧美一卡2卡三卡4卡5免费| 欧美a级理论片| xfplay精品久久| 国产精品影视在线| 亚洲色图丝袜美腿| 精品污污网站免费看| 三级欧美在线一区| 日韩欧美国产综合一区 | 中文字幕一区二| 99视频国产精品| 国产精品素人一区二区| 91小视频免费看| 亚洲欧美经典视频| 欧美日韩另类国产亚洲欧美一级| 亚洲成av人在线观看| 欧美tickling网站挠脚心| 韩国精品主播一区二区在线观看| 亚洲国产精品传媒在线观看| 91视视频在线直接观看在线看网页在线看 | 久久精品亚洲一区二区三区浴池| 国产精品77777竹菊影视小说| 国产精品国产三级国产a| 欧美自拍丝袜亚洲| 日本伊人午夜精品| 国产欧美日韩激情| 欧美日韩国产小视频在线观看| 男女视频一区二区| 日韩毛片在线免费观看| 日韩欧美在线一区二区三区| 成人性生交大合| 国产福利精品一区| 亚洲成人av电影| 国产精品久久看| 91麻豆精品国产自产在线观看一区| 国产在线精品一区在线观看麻豆| 亚洲欧洲日韩综合一区二区| 91精品国模一区二区三区| 国产不卡免费视频| 日韩国产成人精品| 亚洲欧美激情小说另类| 久久亚洲精精品中文字幕早川悠里| 91猫先生在线| 国产精品一区二区在线观看网站| 一级女性全黄久久生活片免费| 精品久久99ma| 欧美日韩成人在线| 91美女片黄在线观看91美女| 久久99国产乱子伦精品免费| 亚洲国产乱码最新视频| 国产精品不卡一区| 国产人久久人人人人爽| 欧美一区午夜视频在线观看| 91电影在线观看| 成人app在线观看| 国产一区免费电影| 看电视剧不卡顿的网站| 国产成人av一区二区三区在线观看| 亚洲自拍偷拍综合| 亚洲免费在线播放| 欧美国产激情二区三区| 精品日韩一区二区| 日韩美一区二区三区| 91论坛在线播放| 亚洲女性喷水在线观看一区| 亚洲国产成人在线| 国产午夜一区二区三区| 精品国产一区二区国模嫣然| 欧美日韩一区二区三区在线看| 欧美自拍丝袜亚洲| 色爱区综合激月婷婷| eeuss鲁片一区二区三区| 国产传媒久久文化传媒| 国产尤物一区二区| 国产伦精品一区二区三区免费| 免费视频最近日韩| 日韩高清在线电影| 蜜臀av性久久久久蜜臀aⅴ流畅| 五月天欧美精品| 亚洲成人av在线电影| 亚洲1区2区3区4区| 免费人成精品欧美精品| 免费xxxx性欧美18vr| 免费人成精品欧美精品| 精品一区二区影视| 韩国成人精品a∨在线观看| 国产一区二区剧情av在线| 国产专区欧美精品| 成人少妇影院yyyy| 精品精品国产高清a毛片牛牛| 久久综合色之久久综合| 日本一区二区高清| 亚洲欧洲日韩一区二区三区| 国产精品国产自产拍高清av| 亚洲色图在线播放| 日韩有码一区二区三区| 韩日精品视频一区| 成人开心网精品视频| 欧美三级电影网| 精品国产乱码久久久久久闺蜜| 日本一区二区三区国色天香| 亚洲视频图片小说| 日日摸夜夜添夜夜添精品视频 | 日韩专区一卡二卡| 精品一区二区三区免费视频| 国产91丝袜在线播放| 日本韩国精品在线| 欧美成人福利视频| 国产精品久久久久久久岛一牛影视| 亚洲三级电影网站| 捆绑紧缚一区二区三区视频| 成人精品在线视频观看| 欧美日韩在线精品一区二区三区激情| 欧美一区二区免费观在线| 国产精品国产自产拍高清av| 日韩成人免费电影| 丁香婷婷综合色啪| 欧美老女人在线| 中文字幕巨乱亚洲| 奇米亚洲午夜久久精品| 国产成人精品三级| 在线播放亚洲一区| 国产精品久久二区二区| 日韩高清一区二区| 91论坛在线播放| 国产日韩欧美精品电影三级在线| 亚洲精品视频在线观看免费| 国内外成人在线| 欧美日韩成人在线一区| 亚洲欧洲日本在线| 国产伦精品一区二区三区免费迷 | 日韩精品一二三四| 成人av电影在线观看| 欧美一级欧美三级在线观看| 亚洲欧美电影一区二区| 国产在线精品一区在线观看麻豆| 在线亚洲一区二区| 国产精品久久夜| 韩国一区二区三区| 在线播放中文字幕一区| 一区二区三区在线观看欧美| 国产99久久久国产精品免费看| 欧美一区二区三区喷汁尤物| 亚洲制服丝袜一区| 91免费视频大全| 国产精品私人影院| 国产成人av电影在线播放| 日韩一区二区不卡| 日本亚洲天堂网| 欧美三级电影在线观看| 亚洲裸体在线观看| 成人激情视频网站| 久久精品人人做人人爽人人| 另类小说图片综合网| 91精品国产免费久久综合| 亚洲国产欧美在线人成| 欧美中文字幕一二三区视频| 国产精品女人毛片| 成人免费高清视频在线观看| 国产精品婷婷午夜在线观看| 成人激情免费电影网址| 亚洲国产成人午夜在线一区 |