/** * Obtains the current lexer state from current token */ private cz.vutbr.web.csskit.antlr.CSSLexerState getCurrentLexerState(Token t) { if (t instanceof cz.vutbr.web.csskit.antlr.CSSToken) return ((cz.vutbr.web.csskit.antlr.CSSToken) t).getLexerState(); else return null; }
/** * Obtains the current lexer state from current token */ private LexerState getCurrentLexerState(Token t) { if (t instanceof CSSToken) return ((CSSToken) t).getLexerState(); else return null; }
/** * Consumes token until lexer state is balanced and * token from follow is matched. Matched token is also consumed */ private void consumeUntilGreedy(TokenStream input, BitSet follow) { CSSToken t = null; do{ Token next = input.LT(1); if (next instanceof CSSToken) t= (CSSToken) input.LT(1); else break; /* not a CSSToken, probably EOF */ log.trace("Skipped greedy: {} follow: {}", t, follow); // consume token even if it will match input.consume(); }while(!(t.getLexerState().isBalanced() && follow.member(t.getType()))); }
/** * Consumes token until lexer state is function-balanced and * token from follow is matched. Matched token is also consumed */ private void consumeUntilGreedy(TokenStream input, BitSet follow, LexerState.RecoveryMode mode, LexerState ls) { CSSToken t = null; do{ Token next = input.LT(1); if (next instanceof CSSToken) t= (CSSToken) input.LT(1); else break; /* not a CSSToken, probably EOF */ log.trace("Skipped greedy: {}", t); // consume token even if it will match input.consume(); }while(!(t.getLexerState().isBalanced(mode, ls) && follow.member(t.getType()))); }
/** * Consumes token until lexer state is balanced and * token from follow is matched. Matched token is also consumed */ private void consumeUntilGreedy(TokenStream input, BitSet follow) { CSSToken t = null; do{ Token next = input.LT(1); if (next instanceof CSSToken) t= (CSSToken) input.LT(1); else break; /* not a CSSToken, probably EOF */ log.trace("Skipped greedy: {} follow: {}", t, follow); // consume token even if it will match input.consume(); }while(!(t.getLexerState().isBalanced() && follow.member(t.getType()))); }
/** * Consumes token until lexer state is function-balanced and * token from follow is matched. Matched token is also consumed */ private void consumeUntilGreedy(TokenStream input, BitSet follow, CSSLexerState.RecoveryMode mode, CSSLexerState ls) { CSSToken t = null; do{ Token next = input.LT(1); if (next instanceof CSSToken) t= (CSSToken) input.LT(1); else break; /* not a CSSToken, probably EOF */ log.trace("Skipped greedy: {}", t); // consume token even if it will match input.consume(); }while(!(t.getLexerState().isBalanced(mode, ls, t) && follow.member(t.getType()))); }
/** * Consumes token until lexer state is function-balanced and * token from follow is matched. */ private void consumeUntil(TokenStream input, BitSet follow, LexerState.RecoveryMode mode, LexerState ls) { CSSToken t = null; boolean finish = false; do{ Token next = input.LT(1); if (next instanceof CSSToken) t= (CSSToken) input.LT(1); else break; /* not a CSSToken, probably EOF */ // consume token if does not match finish = (t.getLexerState().isBalanced(mode, ls) && follow.member(t.getType())); if (!finish) { log.trace("Skipped: {}", t); input.consume(); } }while(!finish); }
/** * Consumes token until lexer state is function-balanced and * token from follow is matched. */ private void consumeUntil(TokenStream input, BitSet follow, CSSLexerState.RecoveryMode mode, CSSLexerState ls) { CSSToken t = null; boolean finish = false; do{ Token next = input.LT(1); if (next instanceof CSSToken) t= (CSSToken) input.LT(1); else break; /* not a CSSToken, probably EOF */ // consume token if does not match finish = (t.getLexerState().isBalanced(mode, ls, t) && follow.member(t.getType())); if (!finish) { log.trace("Skipped: {}", t); input.consume(); } }while(!finish); } }