From 37f8c22bb9aefd9970e2cde5050e8dda12c95f05 Mon Sep 17 00:00:00 2001 From: Mike Wiedenbauer Date: Tue, 25 Jan 2022 17:53:38 +0100 Subject: [PATCH] #84 parse deprecated (ie6/7) property an throw exception --- ph-css/src/main/jjtree/ParserCSS30.jjt | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ph-css/src/main/jjtree/ParserCSS30.jjt b/ph-css/src/main/jjtree/ParserCSS30.jjt index 14bb1a04..f2502e3b 100644 --- a/ph-css/src/main/jjtree/ParserCSS30.jjt +++ b/ph-css/src/main/jjtree/ParserCSS30.jjt @@ -204,6 +204,7 @@ TOKEN : | < DASH: "|" > | < GREATER: ">" > | < TILDE: "~" > +| < DOLLAR: "$" > | < HASH: "#" > | < INCLUDES: "~=" > | < DASHMATCH: "|=" > @@ -344,6 +345,12 @@ SPECIAL_TOKEN : } } +JAVACODE +private void errorDeprecated(final Token tok, final int... aKinds) throws ParseException #void { + int expectedSeq[][] = { aKinds }; + throw new ParseException(tok, expectedSeq, tokenImage); +} + JAVACODE private void errorUnexpectedRule(final String sRule, final String sMsg) #void { @@ -1125,10 +1132,17 @@ void selector() : {} )* } -void property() : {} +void property() : { - { jjtThis.setText (token.image); } - ( )* + Token save; +} +{ + ( { jjtThis.setText (token.image); } + ( )* + ) + | LOOKAHEAD(2, ( | ) ) + { save = token; } + ( | ) { errorDeprecated(save, IDENT); } } void important() : {}