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

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

?? cssparser.java

?? JAVA的一些源碼 JAVA2 STANDARD EDITION DEVELOPMENT KIT 5.0
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * @(#)CSSParser.java	1.8 03/12/19 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package javax.swing.text.html;import java.io.*;/** * A CSS parser. This works by way of a delegate that implements the * CSSParserCallback interface. The delegate is notified of the following * events: * <ul> *   <li>Import statement: <code>handleImport</code> *   <li>Selectors <code>handleSelector</code>. This is invoked for each *       string. For example if the Reader contained p, bar , a {}, the delegate *       would be notified 4 times, for 'p,' 'bar' ',' and 'a'. *   <li>When a rule starts, <code>startRule</code> *   <li>Properties in the rule via the <code>handleProperty</code>. This *       is invoked one per property/value key, eg font size: foo;, would *       cause the delegate to be notified once with a value of 'font size'. *   <li>Values in the rule via the <code>handleValue</code>, this is notified *       for the total value. *   <li>When a rule ends, <code>endRule</code> * </ul> * This will parse much more than CSS 1, and loosely implements the * recommendation for <i>Forward-compatible parsing</i> in section * 7.1 of the CSS spec found at: * <a href=http://www.w3.org/TR/REC-CSS1>http://www.w3.org/TR/REC-CSS1</a>. * If an error results in parsing, a RuntimeException will be thrown. * <p> * This will preserve case. If the callback wishes to treat certain poritions * case insensitively (such as selectors), it should use toLowerCase, or * something similar. * * @author Scott Violet * @version 1.8 12/19/03 */class CSSParser {    // Parsing something like the following:    // (@rule | ruleset | block)*    //     // @rule       (block | identifier)*; (block with {} ends @rule)    // block       matching [] () {} (that is, [()] is a block, [(){}{[]}]    //                                is a block, ()[] is two blocks)    // identifier  "*" | '*' | anything but a [](){} and whitespace    //     // ruleset     selector decblock    // selector    (identifier | (block, except block '{}') )*     // declblock   declaration* block*    // declaration (identifier* stopping when identifier ends with :)    //             (identifier* stopping when identifier ends with ;)    //    // comments /* */ can appear any where, and are stripped.    // identifier - letters, digits, dashes and escaped characters    // block starts with { ends with matching }, () [] and {} always occur     //   in matching pairs, '' and "" also occur in pairs, except " may be    // Indicates the type of token being parsed.    private static final int   IDENTIFIER = 1;    private static final int   BRACKET_OPEN = 2;    private static final int   BRACKET_CLOSE = 3;    private static final int   BRACE_OPEN = 4;    private static final int   BRACE_CLOSE = 5;    private static final int   PAREN_OPEN = 6;    private static final int   PAREN_CLOSE = 7;    private static final int   END = -1;    private static final char[] charMapping = { 0, 0, '[', ']', '{', '}', '(',					       ')', 0};    /** Set to true if one character has been read ahead. */    private boolean        didPushChar;    /** The read ahead character. */    private int            pushedChar;    /** Temporary place to hold identifiers. */    private StringBuffer   unitBuffer;    /** Used to indicate blocks. */    private int[]          unitStack;    /** Number of valid blocks. */    private int            stackCount;    /** Holds the incoming CSS rules. */    private Reader         reader;    /** Set to true when the first non @ rule is encountered. */    private boolean        encounteredRuleSet;    /** Notified of state. */    private CSSParserCallback callback;    /** nextToken() inserts the string here. */    private char[]         tokenBuffer;    /** Current number of chars in tokenBufferLength. */    private int            tokenBufferLength;    /** Set to true if any whitespace is read. */    private boolean        readWS;    // The delegate interface.    static interface CSSParserCallback {	/** Called when an @import is encountered. */	void handleImport(String importString);	// There is currently no way to distinguish between '"foo,"' and	// 'foo,'. But this generally isn't valid CSS. If it becomes	// a problem, handleSelector will have to be told if the string is	// quoted.	void handleSelector(String selector);	void startRule();	// Property names are mapped to lower case before being passed to	// the delegate.	void handleProperty(String property);	void handleValue(String value);	void endRule();    }    CSSParser() {	unitStack = new int[2];	tokenBuffer = new char[80];	unitBuffer = new StringBuffer();    }    void parse(Reader reader, CSSParserCallback callback,	       boolean inRule) throws IOException {	this.callback = callback;	stackCount = tokenBufferLength = 0;	this.reader = reader;	encounteredRuleSet = false;	try {	    if (inRule) {		parseDeclarationBlock();	    }	    else {		while (getNextStatement());	    }	} finally {	    callback = null;	    reader = null;	}    }    /**     * Gets the next statement, returning false if the end is reached. A     * statement is either an @rule, or a ruleset.     */    private boolean getNextStatement() throws IOException {	unitBuffer.setLength(0);	int token = nextToken((char)0);	switch (token) {	case IDENTIFIER:	    if (tokenBufferLength > 0) {		if (tokenBuffer[0] == '@') {		    parseAtRule();		}		else {		    encounteredRuleSet = true;		    parseRuleSet();			}	    }	    return true;	case BRACKET_OPEN:	case BRACE_OPEN:	case PAREN_OPEN:	    parseTillClosed(token);	    return true;	case BRACKET_CLOSE:	case BRACE_CLOSE:	case PAREN_CLOSE:	    // Shouldn't happen...	    throw new RuntimeException("Unexpected top level block close");	case END:	    return false;	}	return true;    }    /**     * Parses an @ rule, stopping at a matching brace pair, or ;.     */    private void parseAtRule() throws IOException {	// PENDING: make this more effecient.	boolean        done = false;	boolean isImport = (tokenBufferLength == 7 &&			    tokenBuffer[0] == '@' && tokenBuffer[1] == 'i' &&			    tokenBuffer[2] == 'm' && tokenBuffer[3] == 'p' &&			    tokenBuffer[4] == 'o' && tokenBuffer[5] == 'r' &&			    tokenBuffer[6] == 't');	unitBuffer.setLength(0);	while (!done) {	    int       nextToken = nextToken(';');	    switch (nextToken) {	    case IDENTIFIER:		if (tokenBufferLength > 0 &&		    tokenBuffer[tokenBufferLength - 1] == ';') {		    --tokenBufferLength;		    done = true;		}		if (tokenBufferLength > 0) {		    if (unitBuffer.length() > 0 && readWS) {			unitBuffer.append(' ');		    }		    unitBuffer.append(tokenBuffer, 0, tokenBufferLength);		}		break;	    case BRACE_OPEN:			if (unitBuffer.length() > 0 && readWS) {		    unitBuffer.append(' ');		}		unitBuffer.append(charMapping[nextToken]);		parseTillClosed(nextToken);		done = true;		// Skip a tailing ';', not really to spec.		{		    int nextChar = readWS();		    if (nextChar != -1 && nextChar != ';') {			pushChar(nextChar);		    }		}		break;	    case BRACKET_OPEN: case PAREN_OPEN:		unitBuffer.append(charMapping[nextToken]);		parseTillClosed(nextToken);		break;	    case BRACKET_CLOSE: case BRACE_CLOSE: case PAREN_CLOSE:		throw new RuntimeException("Unexpected close in @ rule");	    case END:		done = true;		break;	    }	}	if (isImport && !encounteredRuleSet) {	    callback.handleImport(unitBuffer.toString());	}    }    /**     * Parses the next rule set, which is a selector followed by a     * declaration block.     */    private void parseRuleSet() throws IOException {	if (parseSelectors()) {	    callback.startRule();	    parseDeclarationBlock();	    callback.endRule();	}    }    /**     * Parses a set of selectors, returning false if the end of the stream     * is reached.     */    private boolean parseSelectors() throws IOException {	// Parse the selectors	int       nextToken;	if (tokenBufferLength > 0) {	    callback.handleSelector(new String(tokenBuffer, 0,					       tokenBufferLength));	}	unitBuffer.setLength(0);	for (;;) {	    while ((nextToken = nextToken((char)0)) == IDENTIFIER) {		if (tokenBufferLength > 0) {		    callback.handleSelector(new String(tokenBuffer, 0,						       tokenBufferLength));		}	    }	    switch (nextToken) {	    case BRACE_OPEN:		return true;	    case BRACKET_OPEN: case PAREN_OPEN:		parseTillClosed(nextToken);		// Not too sure about this, how we handle this isn't very		// well spec'd.		unitBuffer.setLength(0);		break;	    case BRACKET_CLOSE: case BRACE_CLOSE: case PAREN_CLOSE:		throw new RuntimeException("Unexpected block close in selector");	    case END:		// Prematurely hit end.		return false;	    }	}    }    /**     * Parses a declaration block. Which a number of declarations followed     * by a })].     */    private void parseDeclarationBlock() throws IOException {	for (;;) {	    int token = parseDeclaration();	    switch (token) {	    case END: case BRACE_CLOSE:		return;	    case BRACKET_CLOSE: case PAREN_CLOSE:		// Bail		throw new RuntimeException("Unexpected close in declaration block");	    case IDENTIFIER:		break;	    }	}    }    /**     * Parses a single declaration, which is an identifier a : and another     * identifier. This returns the last token seen.     */    // identifier+: identifier* ;|}    private int parseDeclaration() throws IOException {	int    token;	if ((token = parseIdentifiers(':', false)) != IDENTIFIER) {	    return token;	}	// Make the property name to lowercase	for (int counter = unitBuffer.length() - 1; counter >= 0; counter--) {	    unitBuffer.setCharAt(counter, Character.toLowerCase				 (unitBuffer.charAt(counter)));	}	callback.handleProperty(unitBuffer.toString());	token = parseIdentifiers(';', true);	callback.handleValue(unitBuffer.toString());	return token;    }    /**     * Parses identifiers until <code>extraChar</code> is encountered,     * returning the ending token, which will be IDENTIFIER if extraChar     * is found.     */    private int parseIdentifiers(char extraChar,				 boolean wantsBlocks) throws IOException {	int   nextToken;	int   ubl;	unitBuffer.setLength(0);	for (;;) {	    nextToken = nextToken(extraChar);	    switch (nextToken) {	    case IDENTIFIER:		if (tokenBufferLength > 0) {		    if (tokenBuffer[tokenBufferLength - 1] == extraChar) {			if (--tokenBufferLength > 0) {			    if (readWS && unitBuffer.length() > 0) {				unitBuffer.append(' ');			    }			    unitBuffer.append(tokenBuffer, 0,					      tokenBufferLength);			}			return IDENTIFIER;		    }		    if (readWS && unitBuffer.length() > 0) {			unitBuffer.append(' ');		    }		    unitBuffer.append(tokenBuffer, 0, tokenBufferLength);		}		break;	    case BRACKET_OPEN:	    case BRACE_OPEN:	    case PAREN_OPEN:		ubl = unitBuffer.length();		if (wantsBlocks) {		    unitBuffer.append(charMapping[nextToken]);		}		parseTillClosed(nextToken);		if (!wantsBlocks) {		    unitBuffer.setLength(ubl);		}		break;	    case BRACE_CLOSE:		// No need to throw for these two, we return token and		// caller can do whatever.	    case BRACKET_CLOSE:	    case PAREN_CLOSE:	    case END:		// Hit the end		return nextToken;	    }	}    }    /**     * Parses till a matching block close is encountered. This is only     * appropriate to be called at the top level (no nesting).     */    private void parseTillClosed(int openToken) throws IOException {	int       nextToken;	boolean   done = false;	startBlock(openToken);	while (!done) {	    nextToken = nextToken((char)0);	    switch (nextToken) {	    case IDENTIFIER:		if (unitBuffer.length() > 0 && readWS) {		    unitBuffer.append(' ');		}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美精品在线观看| 欧美国产成人在线| 成人午夜视频网站| 亚洲嫩草精品久久| 久久午夜电影网| 在线观看一区日韩| 成人中文字幕在线| 免费成人av在线| 亚洲色欲色欲www在线观看| 日韩精品一区二| 99re亚洲国产精品| 国产成人精品综合在线观看| 香港成人在线视频| 亚洲欧美在线视频| 国产日韩精品一区二区三区| 7777精品伊人久久久大香线蕉的| 色综合久久天天| 波多野结衣一区二区三区| 激情综合色丁香一区二区| 亚洲va欧美va人人爽午夜| 亚洲欧美日韩在线不卡| 国产色一区二区| 2022国产精品视频| 日韩欧美国产小视频| 欧美伦理电影网| 欧日韩精品视频| 色噜噜狠狠成人中文综合| 成人美女在线观看| 国产69精品久久久久毛片| 久久国产精品99久久久久久老狼 | 久久综合九色综合欧美就去吻| 欧美色图激情小说| 91黄色免费看| 色综合激情五月| 色综合咪咪久久| 欧洲生活片亚洲生活在线观看| 97精品久久久午夜一区二区三区| 成人精品鲁一区一区二区| 国产精品一二三四五| 国产高清无密码一区二区三区| 美女脱光内衣内裤视频久久影院| 日韩成人dvd| 免费观看在线综合| 免费观看在线色综合| 另类中文字幕网| 韩国成人精品a∨在线观看| 国产一区二区福利| 国产大陆a不卡| 成人国产精品免费观看动漫| 成人av动漫网站| 99riav一区二区三区| 在线视频欧美精品| 欧美日韩国产片| 日韩欧美在线观看一区二区三区| 日韩免费性生活视频播放| 亚洲精品一区二区三区在线观看| 欧美精品一区二区三区很污很色的 | 日本一二三四高清不卡| 国产精品每日更新在线播放网址| 国产精品久久一级| 洋洋成人永久网站入口| 亚洲不卡一区二区三区| 精品一区二区日韩| 国产成人啪免费观看软件| 成人app网站| 欧美曰成人黄网| 91精品国产综合久久福利软件| 日韩精品一区二区三区在线观看 | 狠狠色丁香婷婷综合久久片| 成人精品一区二区三区四区| 色婷婷av一区二区三区软件| 7799精品视频| 国产午夜精品久久| 亚洲自拍偷拍九九九| 久久精品国产第一区二区三区| 国产精品夜夜爽| 欧美性猛交xxxx黑人交| www成人在线观看| 亚洲精品视频免费看| 麻豆一区二区在线| 91欧美一区二区| 欧美一级一区二区| 亚洲欧洲色图综合| 男人的天堂亚洲一区| 成人av在线观| 51精品久久久久久久蜜臀| 国产日本欧美一区二区| 亚洲图片欧美色图| 国产福利精品一区| 欧美日韩精品综合在线| 国产欧美一区二区在线观看| 午夜婷婷国产麻豆精品| 粉嫩aⅴ一区二区三区四区五区| 欧美吻胸吃奶大尺度电影| 久久精品一区二区三区不卡牛牛| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产精品主播直播| 日韩亚洲欧美综合| 一区二区三区四区在线播放| 国产一区欧美一区| 911精品国产一区二区在线| 1024成人网色www| 国产一区在线不卡| 日韩一区二区三区视频| 一区二区三区在线观看视频| 国产成人免费视频网站| 欧美变态凌虐bdsm| 午夜一区二区三区视频| 99免费精品在线| 国产视频一区在线播放| 免费观看在线综合| 欧美日韩成人一区| 一区二区三区在线高清| 91小视频在线| 国产精品天美传媒| 国产一区二区不卡在线| 91精品国产综合久久精品app | 亚洲人精品午夜| 成人综合婷婷国产精品久久| 精品国产乱码久久| 蜜臀av亚洲一区中文字幕| 欧美一级在线免费| 蜜臀av一区二区| 91精品国产高清一区二区三区蜜臀| 一区二区三区四区在线| 色综合久久久久网| 亚洲精品乱码久久久久久日本蜜臀| 成人国产免费视频| 国产精品不卡一区| 成人sese在线| 成人欧美一区二区三区白人| 成人黄色在线视频| 中文字幕亚洲不卡| 99精品国产视频| 亚洲视频中文字幕| 日本久久电影网| 亚洲国产精品久久久男人的天堂| 色一情一乱一乱一91av| 亚洲毛片av在线| 欧美视频中文字幕| 午夜视频在线观看一区二区| 欧美三级资源在线| 婷婷综合另类小说色区| 欧美一区二区三区男人的天堂| 亚洲成av人片在线观看无码| 欧美日韩国产综合一区二区| 爽好多水快深点欧美视频| 欧美一区二区三区免费| 黄页网站大全一区二区| 国产精品视频线看| 色综合久久中文字幕| 午夜精品福利一区二区三区av| 91精品国产91热久久久做人人| 蜜臀久久99精品久久久画质超高清| 久久先锋影音av鲁色资源网| 成人午夜视频免费看| 亚洲精品欧美二区三区中文字幕| 欧美午夜片在线看| 久久99精品国产麻豆婷婷| 亚洲国产精品二十页| 欧美自拍丝袜亚洲| 蜜桃传媒麻豆第一区在线观看| 久久人人97超碰com| 99久久99久久精品免费观看| 一区二区三区四区在线播放| 日韩视频在线永久播放| 国产成人在线视频免费播放| 亚洲摸摸操操av| 日韩欧美黄色影院| 91视频免费看| 首页欧美精品中文字幕| 久久久久久综合| 色久优优欧美色久优优| 男男成人高潮片免费网站| 久久精品在这里| 欧美色图第一页| 国产不卡在线视频| 亚洲国产精品久久不卡毛片| 欧美精品一区二区三区四区| 色狠狠综合天天综合综合| 久草精品在线观看| 怡红院av一区二区三区| 欧美变态口味重另类| 在线视频你懂得一区二区三区| 国产一区二三区好的| 亚洲猫色日本管| 久久午夜色播影院免费高清| 欧美视频一区二区三区| 国产99久久久久| 免费日韩伦理电影| 亚洲婷婷综合色高清在线| 日韩美女一区二区三区四区| 色呦呦一区二区三区| 国产精品影视在线观看| 日韩激情av在线| 亚洲天天做日日做天天谢日日欢| 日韩欧美国产高清| 欧美性大战久久| 成人精品高清在线| 极品少妇一区二区|