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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? parser.java

?? Grammatica is a C# and Java parser generator (compiler compiler). It improves upon simlar tools (lik
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * Parser.java * * This work is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This work is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * As a special exception, the copyright holders of this library give * you permission to link this library with independent modules to * produce an executable, regardless of the license terms of these * independent modules, and to copy and distribute the resulting * executable under terms of your choice, provided that you also meet, * for each linked independent module, the terms and conditions of the * license of that module. An independent module is a module which is * not derived from or based on this library. If you modify this * library, you may extend this exception to your version of the * library, but you are not obligated to do so. If you do not wish to * do so, delete this exception statement from your version. * * Copyright (c) 2003 Per Cederberg. All rights reserved. */package net.percederberg.grammatica.parser;import java.util.ArrayList;import java.util.Collection;import java.util.HashMap;/** * A base parser class. This class provides the standard parser  * interface, as well as token handling. * * @author   Per Cederberg, <per at percederberg dot net> * @version  1.4 */public abstract class Parser {    /**     * The parser initialization flag.     */    private boolean initialized = false;    /**     * The tokenizer to use.     */    private Tokenizer tokenizer;    /**     * The analyzer to use for callbacks.     */    private Analyzer analyzer;    /**     * The list of production patterns.      */    private ArrayList patterns = new ArrayList();    /**     * The map with production patterns and their id:s. This map      * contains the production patterns indexed by their id:s.     */    private HashMap patternIds = new HashMap();    /**     * The list of buffered tokens. This list will contain tokens that     * have been read from the tokenizer, but not yet consumed.     */    private ArrayList tokens = new ArrayList();        /**     * The error log. All parse errors will be added to this log as     * the parser attempts to recover from the error. If the error     * count is higher than zero (0), this log will be thrown as the     * result from the parse() method.      */    private ParserLogException errorLog = new ParserLogException();    /**     * The error recovery counter. This counter is initially set to a     * negative value to indicate that no error requiring recovery      * has been encountered. When a parse error is found, the counter     * is set to three (3), and is then decreased by one for each      * correctly read token until it reaches zero (0).       */    private int errorRecovery = -1;    /**     * Creates a new parser.     *      * @param tokenizer      the tokenizer to use     */    Parser(Tokenizer tokenizer) {        this(tokenizer, null);    }    /**     * Creates a new parser.     *      * @param tokenizer      the tokenizer to use     * @param analyzer       the analyzer callback to use     */    Parser(Tokenizer tokenizer, Analyzer analyzer) {        this.tokenizer = tokenizer;        if (analyzer == null) {            this.analyzer = new Analyzer();        } else {            this.analyzer = analyzer;        }    }    /**     * Returns the tokenizer in use by this parser.     *      * @return the tokenizer in use by this parser     *      * @since 1.4     */    public Tokenizer getTokenizer() {        return tokenizer;    }        /**     * Returns the analyzer in use by this parser.     *      * @return the analyzer in use by this parser     *      * @since 1.4     */    public Analyzer getAnalyzer() {        return analyzer;    }    /**     * Sets the parser initialized flag. Normally this flag is set by     * the prepare() method, but this method allows further      * modifications to it.     *      * @param initialized    the new initialized flag     */    void setInitialized(boolean initialized) {        this.initialized = initialized;    }    /**     * Adds a new production pattern to the parser. The first pattern      * added is assumed to be the starting point in the grammar. The      * patterns added may be validated to some extent.     *      * @param pattern        the pattern to add     *      * @throws ParserCreationException if the pattern couldn't be      *             added correctly to the parser     */    public void addPattern(ProductionPattern pattern)         throws ParserCreationException {        Integer  id = new Integer(pattern.getId());                    if (pattern.getAlternativeCount() <= 0) {            throw new ParserCreationException(                ParserCreationException.INVALID_PRODUCTION_ERROR,                pattern.getName(),                "no production alternatives are present (must have at " +                "least one)");        }        if (patternIds.containsKey(id)) {            throw new ParserCreationException(                ParserCreationException.INVALID_PRODUCTION_ERROR,                pattern.getName(),                "another pattern with the same id (" + id +                 ") has already been added");        }        patterns.add(pattern);        patternIds.put(id, pattern);        setInitialized(false);    }    /**     * Initializes the parser. All the added production patterns will     * be analyzed for ambiguities and errors. This method also      * initializes internal data structures used during the parsing.      *      * @throws ParserCreationException if the parser couldn't be      *             initialized correctly      */    public void prepare() throws ParserCreationException {        if (patterns.size() <= 0) {            throw new ParserCreationException(                ParserCreationException.INVALID_PARSER_ERROR,                "no production patterns have been added");        }        for (int i = 0; i < patterns.size(); i++) {            checkPattern((ProductionPattern) patterns.get(i));        }        setInitialized(true);    }    /**     * Checks a production pattern for completeness. If some rule in      * the pattern referenced an production pattern not added to this      * parser, a parser creation exception will be thrown.       *      * @param pattern        the production pattern to check     *      * @throws ParserCreationException if the pattern referenced a      *             pattern not added to this parser     */    private void checkPattern(ProductionPattern pattern)         throws ParserCreationException {        for (int i = 0; i < pattern.getAlternativeCount(); i++) {            checkRule(pattern.getName(), pattern.getAlternative(i));             }    }    /**     * Checks a production pattern rule for completeness. If some      * element in the rule referenced an production pattern not added     * to this parser, a parser creation exception will be thrown.       *     * @param name           the name of the pattern being checked      * @param rule           the production pattern rule to check     *      * @throws ParserCreationException if the rule referenced a      *             pattern not added to this parser     */    private void checkRule(String name, ProductionPatternAlternative rule)         throws ParserCreationException {        for (int i = 0; i < rule.getElementCount(); i++) {            checkElement(name, rule.getElement(i));        }    }    /**     * Checks a production pattern element for completeness. If the     * element references a production pattern not added to this      * parser, a parser creation exception will be thrown.       *      * @param name           the name of the pattern being checked      * @param elem           the production pattern element to check     *      * @throws ParserCreationException if the element referenced a     *             pattern not added to this parser     */    private void checkElement(String name, ProductionPatternElement elem)         throws ParserCreationException {        if (elem.isProduction() && getPattern(elem.getId()) == null) {            throw new ParserCreationException(                ParserCreationException.INVALID_PRODUCTION_ERROR,                name,                "an undefined production pattern id (" + elem.getId() +                ") is referenced");        }    }    /**     * Parses the token stream and returns a parse tree. This method     * will call prepare() if not previously called. In case of a      * parse error, the parser will attempt to recover and throw all     * the errors found in a parser log exception in the end.     *      * @return the parse tree     *      * @throws ParserCreationException if the parser couldn't be     *             initialized correctly     * @throws ParserLogException if the input couldn't be parsed      *             correctly     *      * @see #prepare     */    public Node parse() throws ParserCreationException, ParserLogException {        Node  root = null;        // Initialize parser        if (!initialized) {            prepare();        }        // Parse input        try {            root = parseStart();        } catch (ParseException e) {            addError(e, true);        }                // Check for errors        if (errorLog.getErrorCount() > 0) {            throw errorLog;        }        return root;    }    /**     * Parses the token stream and returns a parse tree.     *      * @return the parse tree     *      * @throws ParseException if the input couldn't be parsed      *             correctly     */    protected abstract Node parseStart() throws ParseException;    /**     * Adds an error to the error log. If the parser is in error      * recovery mode, the error will not be added to the log. If the     * recovery flag is set, this method will set the error recovery      * counter thus enter error recovery mode. Only lexical or      * syntactical errors require recovery, so this flag shouldn't be     * set otherwise.     *      * @param e              the error to add     * @param recovery       the recover flag      */    void addError(ParseException e, boolean recovery) {        if (errorRecovery <= 0) {            errorLog.addError(e);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品人人做人人爽人人添 | 日韩av在线发布| 国产欧美日韩综合精品一区二区 | 亚洲精品乱码久久久久久久久| 亚洲国产精品99久久久久久久久| 欧美国产欧美综合| 日韩精品五月天| 成人激情图片网| 成人中文字幕电影| 欧美在线免费播放| 亚洲精品写真福利| 99久久免费视频.com| 91麻豆精品91久久久久久清纯 | 这里只有精品视频在线观看| 欧美伊人久久久久久久久影院 | 久久久久久综合| 精品国产第一区二区三区观看体验| 日韩久久久精品| 亚洲欧美欧美一区二区三区| 午夜激情久久久| 国产一区二区女| 欧美三级乱人伦电影| 日韩欧美卡一卡二| 最新高清无码专区| 亚洲va欧美va国产va天堂影院| 日韩国产欧美在线视频| 99久久er热在这里只有精品66| 欧美狂野另类xxxxoooo| 久久亚洲一区二区三区四区| 最新国产精品久久精品| 视频一区视频二区在线观看| 大尺度一区二区| 欧美一区二区网站| 亚洲欧美综合在线精品| 国产一区在线视频| 欧美伦理影视网| 一区二区三区美女视频| 国产乱理伦片在线观看夜一区| 99re这里只有精品首页| 精品国产乱码久久久久久图片| 国产精品看片你懂得| 国产一区二区美女| 51午夜精品国产| 亚洲成人先锋电影| 色婷婷狠狠综合| 国产精品国产三级国产普通话三级| 婷婷一区二区三区| 日本高清不卡aⅴ免费网站| 欧美国产日韩a欧美在线观看 | 国产91丝袜在线播放| 精品1区2区在线观看| 免费的成人av| 久久伊人蜜桃av一区二区| 精品无人码麻豆乱码1区2区| 精品欧美久久久| 国产一区二区三区电影在线观看 | 亚洲综合一二区| 91在线免费看| 天天爽夜夜爽夜夜爽精品视频| 在线免费观看一区| 午夜精品一区二区三区电影天堂 | 色综合视频一区二区三区高清| 国产精品免费丝袜| 欧美午夜宅男影院| 亚洲专区一二三| 欧美精品在欧美一区二区少妇| 欧美另类久久久品| 国产剧情一区二区三区| 中文字幕精品一区| 在线视频国产一区| 狠狠网亚洲精品| 亚洲图片你懂的| 欧美本精品男人aⅴ天堂| 99re这里都是精品| 久久精品日产第一区二区三区高清版| 国产美女在线观看一区| 亚洲日本韩国一区| 精品日韩欧美在线| 亚洲国产日日夜夜| 国产精品你懂的在线欣赏| 精品一区二区三区不卡| 亚洲一区二区三区四区不卡| 久久久国际精品| 国产一区91精品张津瑜| 中文字幕在线一区免费| 国产日韩欧美制服另类| 欧美美女一区二区在线观看| a美女胸又www黄视频久久| 精品嫩草影院久久| 欧美日韩国产美| 亚洲国产日韩一区二区| 亚洲乱码国产乱码精品精98午夜 | 成人av网在线| 亚洲欧美日韩人成在线播放| 国产精品白丝av| 国产无一区二区| 中文字幕一区二区三区乱码在线| 国产91精品一区二区麻豆亚洲| 久久久久久久一区| 国产麻豆一精品一av一免费| 91美女蜜桃在线| 亚洲狠狠爱一区二区三区| 欧美精品乱码久久久久久按摩| 日本不卡在线视频| 久久久久久久久97黄色工厂| 不卡的av网站| 成人三级在线视频| 一区二区日韩电影| 日韩一区二区三| 精品欧美一区二区久久| 国产精品99久久久| 一区二区成人在线观看| 久久视频一区二区| 亚洲午夜av在线| 亚洲永久精品国产| 久久99精品久久只有精品| 亚洲欧美日韩中文播放| 精品一区二区三区欧美| 在线观看视频91| 国产视频一区不卡| 国产无遮挡一区二区三区毛片日本| 亚洲欧美怡红院| 日本一区二区三区免费乱视频 | 国产精品自拍在线| 日韩高清一区二区| 一本久道久久综合中文字幕| 欧美tickling挠脚心丨vk| 日韩一级视频免费观看在线| 成人h动漫精品一区二区| 久久综合色播五月| 精品福利二区三区| 亚洲成人自拍偷拍| 欧美精品一区二区三区蜜桃视频| 欧美日韩情趣电影| 亚洲一区在线观看免费| 欧美日韩在线播放三区四区| 午夜国产精品一区| 天天综合日日夜夜精品| 日本乱人伦aⅴ精品| 在线观看成人免费视频| 亚洲国产精品ⅴa在线观看| 99re这里只有精品视频首页| 国产精品久久久久久亚洲伦| 成人黄色av网站在线| 亚洲一级不卡视频| 欧美三级日韩在线| 国内精品免费在线观看| 26uuu国产一区二区三区| 日本韩国欧美一区| 麻豆久久久久久| 亚洲国产美女搞黄色| 久久色在线观看| 亚洲国产视频一区二区| 成人黄色一级视频| 欧美精品99久久久**| 国产一区日韩二区欧美三区| 911精品国产一区二区在线| 欧美成人精品1314www| 亚洲伊人伊色伊影伊综合网| 欧美激情在线观看视频免费| 久久久久97国产精华液好用吗| 欧美激情综合五月色丁香小说| 亚洲国产视频直播| 丁香亚洲综合激情啪啪综合| 精品无人区卡一卡二卡三乱码免费卡| 久久精品国产一区二区三区免费看 | 欧美高清你懂得| 丝袜亚洲另类欧美综合| 秋霞av亚洲一区二区三| 亚洲精品在线网站| 亚洲色图在线看| 国产精品久99| 国产一区二区三区在线观看免费| 欧美综合亚洲图片综合区| 95精品视频在线| 亚洲国产电影在线观看| 国产高清不卡一区| 91精品国产福利| 一区二区久久久| 久久精品亚洲麻豆av一区二区 | 久久一留热品黄| 国产精品中文字幕一区二区三区| 国产视频一区在线观看| 99精品在线观看视频| 欧美日韩视频不卡| 日韩精品一区二区三区在线播放| 91污片在线观看| 日韩福利视频网| 欧美视频在线播放| 欧美美女一区二区在线观看| 国产精品久久久久永久免费观看 | 国产黄色成人av| 日韩一区二区精品在线观看| 精品国产伦一区二区三区观看方式 | 亚洲视频一二三区| 午夜精品成人在线| 欧美在线观看视频在线| 91精品国产综合久久久久久漫画 | 国产精品电影院| 国产成人亚洲综合a∨婷婷 |