Search in sources :

Example 6 with Locator

use of com.gargoylesoftware.css.parser.Locator in project LoboEvolution by LoboEvolution.

the class CSS3Parser method mediaRule.

// 
// media
// : MEDIA_SYM S* medium [ COMMA S* medium ]* '{' S* ruleset* '}' S*
// ;
// 
public final void mediaRule() throws ParseException {
    boolean start = false;
    MediaQueryList ml = new MediaQueryList();
    Locator locator;
    try {
        jj_consume_token(MEDIA_SYM);
        locator = createLocator(token);
        label_9: while (true) {
            switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case S:
                    {
                        ;
                        break;
                    }
                default:
                    jj_la1[17] = jj_gen;
                    break label_9;
            }
            jj_consume_token(S);
        }
        mediaList(ml);
        start = true;
        handleStartMedia(ml, locator);
        jj_consume_token(LBRACE);
        label_10: while (true) {
            switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case S:
                    {
                        ;
                        break;
                    }
                default:
                    jj_la1[18] = jj_gen;
                    break label_10;
            }
            jj_consume_token(S);
        }
        switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case IDENT:
            case DOT:
            case COLON:
            case ASTERISK:
            case LSQUARE:
            case HASH:
            case IMPORT_SYM:
            case PAGE_SYM:
            case MEDIA_SYM:
            case ATKEYWORD:
                {
                    mediaRuleList();
                    break;
                }
            default:
                jj_la1[19] = jj_gen;
                ;
        }
        jj_consume_token(RBRACE);
    } catch (CSSParseException e) {
        getErrorHandler().error(e);
        error_skipblock("ignoringRule", e);
    } catch (ParseException e) {
        CSSParseException cpe = toCSSParseException("invalidMediaRule", e);
        getErrorHandler().error(cpe);
        error_skipblock("ignoringRule", cpe);
    } finally {
        if (start) {
            handleEndMedia(ml);
        }
    }
}
Also used : Locator(com.gargoylesoftware.css.parser.Locator) CSSParseException(com.gargoylesoftware.css.parser.CSSParseException) MediaQueryList(com.gargoylesoftware.css.parser.media.MediaQueryList) CSSParseException(com.gargoylesoftware.css.parser.CSSParseException)

Example 7 with Locator

use of com.gargoylesoftware.css.parser.Locator in project LoboEvolution by LoboEvolution.

the class CSS3Parser method charsetRule.

public final void charsetRule() throws ParseException {
    Token t;
    Locator locator;
    try {
        jj_consume_token(CHARSET_SYM);
        locator = createLocator(token);
        jj_consume_token(S);
        t = jj_consume_token(STRING);
        jj_consume_token(SEMICOLON);
        handleCharset(t.toString(), locator);
    } catch (ParseException e) {
        getErrorHandler().error(toCSSParseException("invalidCharsetRule", e));
    }
}
Also used : Locator(com.gargoylesoftware.css.parser.Locator) CSSParseException(com.gargoylesoftware.css.parser.CSSParseException)

Example 8 with Locator

use of com.gargoylesoftware.css.parser.Locator in project LoboEvolution by LoboEvolution.

the class CSS3Parser method unknownAtRule.

public final void unknownAtRule() throws ParseException {
    String s;
    Locator locator;
    try {
        jj_consume_token(ATKEYWORD);
        locator = createLocator(token);
        s = skip();
        handleIgnorableAtRule(s, locator);
    } catch (ParseException e) {
        getErrorHandler().error(toCSSParseException("invalidUnknownRule", generateParseException()));
    }
}
Also used : Locator(com.gargoylesoftware.css.parser.Locator) CSSParseException(com.gargoylesoftware.css.parser.CSSParseException)

Example 9 with Locator

use of com.gargoylesoftware.css.parser.Locator in project LoboEvolution by LoboEvolution.

the class CSS3Parser method importRule.

// 
// import
// : IMPORT_SYM S*
// [STRING|URI] S* [ medium [ COMMA S* medium]* ]? ';' S*
// ;
// 
public final void importRule(final boolean nonImportRuleFoundBefore) throws ParseException {
    Token t;
    MediaQueryList ml = new MediaQueryList();
    Locator locator;
    try {
        ParseException e = null;
        if (nonImportRuleFoundBefore) {
            e = generateParseException();
        }
        jj_consume_token(IMPORT_SYM);
        locator = createLocator(token);
        label_7: while (true) {
            switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case S:
                    {
                        ;
                        break;
                    }
                default:
                    jj_la1[13] = jj_gen;
                    break label_7;
            }
            jj_consume_token(S);
        }
        switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case STRING:
                {
                    t = jj_consume_token(STRING);
                    break;
                }
            case URI:
                {
                    t = jj_consume_token(URI);
                    break;
                }
            default:
                jj_la1[14] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
        }
        label_8: while (true) {
            switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case S:
                    {
                        ;
                        break;
                    }
                default:
                    jj_la1[15] = jj_gen;
                    break label_8;
            }
            jj_consume_token(S);
        }
        switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case NOT:
            case ONLY:
            case IDENT:
            case LROUND:
                {
                    mediaList(ml);
                    break;
                }
            default:
                jj_la1[16] = jj_gen;
                ;
        }
        jj_consume_token(SEMICOLON);
        if (nonImportRuleFoundBefore) {
            getErrorHandler().error(toCSSParseException("invalidImportRuleIgnored2", e));
        } else {
            handleImportStyle(unescape(t.image, false), ml, null, locator);
        }
    } catch (CSSParseException e) {
        getErrorHandler().error(e);
        error_skipAtRule();
    } catch (ParseException e) {
        getErrorHandler().error(toCSSParseException("invalidImportRule", e));
        error_skipAtRule();
    }
}
Also used : Locator(com.gargoylesoftware.css.parser.Locator) CSSParseException(com.gargoylesoftware.css.parser.CSSParseException) MediaQueryList(com.gargoylesoftware.css.parser.media.MediaQueryList) CSSParseException(com.gargoylesoftware.css.parser.CSSParseException)

Example 10 with Locator

use of com.gargoylesoftware.css.parser.Locator in project LoboEvolution by LoboEvolution.

the class CSS3Parser method _class.

// 
// class
// : '.' IDENT
// ;
// 
public final Condition _class(boolean pseudoElementFound) throws ParseException {
    Token t;
    Locator locator;
    ParseException pe = null;
    try {
        if (pseudoElementFound) {
            pe = generateParseException();
        }
        jj_consume_token(DOT);
        locator = createLocator(token);
        t = jj_consume_token(IDENT);
        if (pseudoElementFound) {
            throw pe;
        }
        return new ClassCondition(unescape(t.image, false), locator);
    } catch (ParseException e) {
        throw toCSSParseException("invalidClassSelector", e);
    }
}
Also used : Locator(com.gargoylesoftware.css.parser.Locator) PseudoClassCondition(com.gargoylesoftware.css.parser.condition.PseudoClassCondition) ClassCondition(com.gargoylesoftware.css.parser.condition.ClassCondition) CSSParseException(com.gargoylesoftware.css.parser.CSSParseException)

Aggregations

CSSParseException (com.gargoylesoftware.css.parser.CSSParseException)11 Locator (com.gargoylesoftware.css.parser.Locator)11 PseudoClassCondition (com.gargoylesoftware.css.parser.condition.PseudoClassCondition)3 LexicalUnit (com.gargoylesoftware.css.parser.LexicalUnit)2 ClassCondition (com.gargoylesoftware.css.parser.condition.ClassCondition)2 LangCondition (com.gargoylesoftware.css.parser.condition.LangCondition)2 MediaQueryList (com.gargoylesoftware.css.parser.media.MediaQueryList)2 LexicalUnitImpl (com.gargoylesoftware.css.parser.LexicalUnitImpl)1 AttributeCondition (com.gargoylesoftware.css.parser.condition.AttributeCondition)1 BeginHyphenAttributeCondition (com.gargoylesoftware.css.parser.condition.BeginHyphenAttributeCondition)1 Condition (com.gargoylesoftware.css.parser.condition.Condition)1 IdCondition (com.gargoylesoftware.css.parser.condition.IdCondition)1 OneOfAttributeCondition (com.gargoylesoftware.css.parser.condition.OneOfAttributeCondition)1 PrefixAttributeCondition (com.gargoylesoftware.css.parser.condition.PrefixAttributeCondition)1 SubstringAttributeCondition (com.gargoylesoftware.css.parser.condition.SubstringAttributeCondition)1 SuffixAttributeCondition (com.gargoylesoftware.css.parser.condition.SuffixAttributeCondition)1 PseudoElementSelector (com.gargoylesoftware.css.parser.selector.PseudoElementSelector)1