private static CommonTokenStream feedLexer(CSSInputStream source) throws CSSException { // we have to unpack runtime exception // because of Java limitation // to change method contract with different type of exception try { CSSLexer lexer = new CSSLexer(source); lexer.init(); return new CommonTokenStream(lexer); } catch (RuntimeException re) { if (re.getCause() instanceof CSSException) { throw (CSSException) re.getCause(); } // this is some other exception else { log.error("LEXER THROWS:", re); throw re; } } }
/** * Adds contextual information about nesting into token. */ @Override public Token emit() { Token t = tf.make(); emit(t); return t; }
mT__99(); mT__100(); mT__101(); mIDENT(); mCHARSET(); mIMPORT(); mMEDIA(); mPAGE(); mMARGIN_AREA(); mVIEWPORT(); mFONTFACE(); mATKEYWORD(); mCLASSKEYWORD(); mSTRING(); mHASH();
mQUOT(); mSTRING_CHAR(); mAPOS(); mQUOT(); mAPOS(); mSTRING_CHAR(); mQUOT(); mAPOS();
match("@import"); mS(); int sStart124 = getCharIndex(); int sStartLine124 = getLine(); int sStartCharPos124 = getCharPositionInLine(); mSTRING_MACR(); s = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, sStart124, getCharIndex()-1); s.setLine(sStartLine124); s.setCharPositionInLine(sStartCharPos124); int sStart137 = getCharIndex(); int sStartLine137 = getLine(); int sStartCharPos137 = getCharPositionInLine(); mURI(); s = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, sStart137, getCharIndex()-1); s.setLine(sStartLine137); s.setCharPositionInLine(sStartCharPos137); mS(); int mStart153 = getCharIndex(); int mStartLine153 = getLine(); int mStartCharPos153 = getCharPositionInLine(); mIDENT_MACR(); m = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, mStart153, getCharIndex()-1); m.setLine(mStartLine153); m.setCharPositionInLine(mStartCharPos153);
match("@charset"); mS(); int sStart81 = getCharIndex(); int sStartLine81 = getLine(); int sStartCharPos81 = getCharPositionInLine(); mSTRING_MACR(); s = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, sStart81, getCharIndex()-1); s.setLine(sStartLine81); s.setCharPositionInLine(sStartCharPos81); mS(); mSEMICOLON();
mTokens(); if ( state.token==null ) { emit(); reportError(re); if ( re instanceof NoViableAltException ) { recover(re); state.token.setLine(state.tokenStartLine); state.token.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(state.token); return state.token;
case CHARSET: final BitSet charsetFollow = BitSet.of((int) '}', (int) ';'); consumeUntilBalanced(charsetFollow); break; case STRING: if(consumeAnyButEOF()) { ls.aposOpen = false; state.token = (Token) new CSSToken(STRING, ls, state.tokenStartCharIndex, getCharIndex() -1); state.token.setText( input.substring(state.tokenStartCharIndex, getCharIndex() -1) + enclosing);
/** * Adds contextual information about n { esting into token. */ @Override public Token emit() { CSSToken t = new CSSToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); t.setBase(((CSSInputStream) input).getBase()); // clone lexer state t.setLexerState(new LexerState(ls)); emit(t); return t; }
match("@charset"); mS(); int sStart209 = getCharIndex(); int sStartLine209 = getLine(); int sStartCharPos209 = getCharPositionInLine(); mSTRING_MACR(); s = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, sStart209, getCharIndex()-1); s.setLine(sStartLine209); s.setCharPositionInLine(sStartCharPos209); mS(); mSEMICOLON();
mQUOT(); mSTRING_CHAR(); mAPOS(); mQUOT(); mAPOS(); mSTRING_CHAR(); mQUOT(); mAPOS();
mIMPORTANT(); mIDENT(); mCHARSET(); mIMPORT(); mNAMESPACE(); mMEDIA(); mPAGE(); mMARGIN_AREA(); mVIEWPORT(); mFONTFACE(); mATKEYWORD(); mCLASSKEYWORD(); mSTRING(); mHASH(); mINDEX();
private static CommonTokenStream feedLexer(CSSInputStream source, StyleSheet stylesheet) throws CSSException { // we have to unpack runtime exception // because of Java limitation // to change method contract with different type of exception try { CSSLexer lexer = new CSSLexer(source); lexer.init(stylesheet); return new CommonTokenStream(lexer); } catch (RuntimeException re) { if (re.getCause() instanceof CSSException) { throw (CSSException) re.getCause(); } // this is some other exception else { log.error("LEXER THROWS:", re); throw re; } } }