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

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

?? 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);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品对白交换视频| 日本高清视频一区二区| 亚洲高清中文字幕| 欧美激情综合五月色丁香小说| 欧美三级视频在线观看| 成人精品电影在线观看| 视频一区欧美日韩| 亚洲影院在线观看| 亚洲丝袜自拍清纯另类| 成人高清免费观看| 国产精品一区2区| 国产露脸91国语对白| 日韩精品色哟哟| 亚洲成人三级小说| 日韩黄色在线观看| 三级精品在线观看| 日韩精品一二三四| 日本一不卡视频| 亚洲一区视频在线| 亚洲午夜在线观看视频在线| 一区二区三区四区亚洲| 国产网红主播福利一区二区| 久久亚洲捆绑美女| 国产精品色在线观看| 日韩亚洲欧美中文三级| 精品久久久久久久人人人人传媒| 欧美电影免费观看完整版| 精品国产伦一区二区三区免费| 日韩精品一区二区三区老鸭窝| 欧美精品一卡二卡| 欧美tickling网站挠脚心| 2020国产精品自拍| 欧美成人一区二区三区在线观看| 精品久久久久久久久久久久包黑料| 精品国产第一区二区三区观看体验| 精品久久久久久最新网址| 久久精品视频在线免费观看| 国产精品女人毛片| 亚洲狠狠丁香婷婷综合久久久| 日韩一区精品字幕| 93久久精品日日躁夜夜躁欧美| 日韩丝袜美女视频| 亚洲精品大片www| 国产精品夜夜嗨| 日韩欧美在线观看一区二区三区| 国产精品国产三级国产aⅴ原创| 天天综合天天做天天综合| 国产精品亚洲一区二区三区在线| 欧美日本国产视频| 亚洲美腿欧美偷拍| 国产盗摄视频一区二区三区| 精品视频1区2区| 亚洲精品乱码久久久久久久久| 久久精品国产精品青草| 欧美老肥妇做.爰bbww视频| 亚洲欧美日本韩国| 99久久婷婷国产| 国产精品久久久久四虎| 国产一区二区三区在线观看免费| 欧美日韩一区二区三区四区| 国产精品蜜臀av| 国产69精品久久777的优势| 欧美成人精品1314www| 午夜精品久久久久影视| 欧美亚洲一区二区三区四区| 国产精品国产a| 成人福利在线看| 中文字幕第一区第二区| 懂色av一区二区三区蜜臀| 久久久综合视频| 国产精品资源站在线| 精品国产免费一区二区三区四区 | 亚洲一区在线看| 一本一道久久a久久精品| 国产精品免费网站在线观看| 粉嫩绯色av一区二区在线观看| 久久这里都是精品| 国产91精品久久久久久久网曝门| 欧美精品一区二区久久久| 激情五月播播久久久精品| 欧美r级电影在线观看| 狠狠色丁香久久婷婷综| 国产日韩欧美综合在线| 成人免费毛片a| 亚洲精品视频免费看| 欧美性生活一区| 日本午夜一本久久久综合| 欧美大白屁股肥臀xxxxxx| 国产精一品亚洲二区在线视频| 久久你懂得1024| 91麻豆免费观看| 日本特黄久久久高潮| 久久色视频免费观看| voyeur盗摄精品| 亚洲最大色网站| 日韩精品中文字幕在线不卡尤物 | 91蜜桃传媒精品久久久一区二区| 亚洲少妇30p| 日韩视频在线永久播放| 成人综合婷婷国产精品久久蜜臀 | 国产不卡高清在线观看视频| 日韩一区欧美一区| 91.麻豆视频| 懂色av一区二区在线播放| 亚洲精品国产成人久久av盗摄 | 欧美日韩性生活| 精品亚洲aⅴ乱码一区二区三区| 国产偷国产偷亚洲高清人白洁| 色综合天天综合色综合av| 日韩成人精品在线| 国产精品二三区| 日韩欧美国产综合在线一区二区三区| 国产成人自拍网| 天天综合色天天| 亚洲欧美综合网| 日韩欧美激情在线| 欧洲精品在线观看| 国产成人免费视频一区| 五月婷婷欧美视频| 国产精品美女久久久久aⅴ国产馆| 欧美精品久久一区| 色综合久久中文字幕综合网| 精品一区二区在线播放| 亚洲国产精品嫩草影院| 国产精品久久国产精麻豆99网站| 欧美电影一区二区| 日本久久一区二区三区| 国产成人免费av在线| 久久精品国产在热久久| 亚洲一区二区三区四区五区中文| 国产精品乱码一区二三区小蝌蚪| 日韩一区二区三区视频| 欧美三区在线观看| 91天堂素人约啪| 岛国av在线一区| 国产精品综合一区二区三区| 免费在线看一区| 舔着乳尖日韩一区| 国产麻豆视频一区二区| 三级久久三级久久久| 亚洲在线一区二区三区| 亚洲三级在线看| 亚洲欧洲成人av每日更新| 久久婷婷成人综合色| 精品裸体舞一区二区三区| 欧美一级二级三级乱码| 欧美日韩免费高清一区色橹橹| 91丨国产丨九色丨pron| 99r国产精品| 色综合天天性综合| 成人动漫一区二区三区| 波多野洁衣一区| www.亚洲色图.com| 色综合久久天天| 色老头久久综合| 欧美亚洲免费在线一区| 欧美日韩国产美| 欧美一区二区三区在线观看视频| 欧美精品色一区二区三区| 欧美精品精品一区| 日韩欧美中文字幕一区| 日韩视频中午一区| 国产农村妇女毛片精品久久麻豆| 欧美经典三级视频一区二区三区| 中国av一区二区三区| 国产精品国产自产拍高清av| 亚洲乱码国产乱码精品精小说| 亚洲视频 欧洲视频| 天堂在线亚洲视频| 国内精品久久久久影院色| eeuss国产一区二区三区| 欧美最猛性xxxxx直播| 在线成人免费观看| 欧美精品一区二区不卡| 国产精品福利av| 视频一区国产视频| 成人综合婷婷国产精品久久蜜臀 | 欧美高清性hdvideosex| 国产精品国产三级国产三级人妇| 国产精品女人毛片| 波多野结衣亚洲| 一区二区三区高清不卡| 色综合久久综合中文综合网| 欧美国产国产综合| 99re这里都是精品| 久久亚洲免费视频| 久久er精品视频| 欧美日韩mp4| 亚洲图片欧美色图| 欧美午夜一区二区三区| 亚洲精品国产高清久久伦理二区| 99久久99久久综合| 亚洲女人的天堂| 色综合久久中文综合久久97| 亚洲色大成网站www久久九九| 成人网男人的天堂| 国产精品久线在线观看| 成人免费黄色在线| 中文字幕一区二区三区不卡在线| 成人免费黄色在线|