Skip to content

Commit 23ed111

Browse files
CSS: Improve handling of generic-at-rules (for example used by tailwind)
Closes: #6860
1 parent 180b3f7 commit 23ed111

6 files changed

Lines changed: 11520 additions & 11733 deletions

File tree

ide/css.lib/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<arg path="src/org/netbeans/modules/css/lib/Css3.g"/>
3434
<classpath>
3535
<pathelement path="${classpath}"/>
36-
<pathelement location="../../ide/libs.antlr3.runtime/external/antlr-complete-3.5.2.jar"/>
36+
<pathelement location="../../ide/libs.antlr3.runtime/external/antlr-complete-3.5.3.jar"/>
3737
</classpath>
3838
</java>
3939

ide/css.lib/src/org/netbeans/modules/css/lib/Css3.g

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,8 @@ atRuleId
713713
;
714714

715715
generic_at_rule
716-
: AT_IDENT ws? ( atRuleId ws? )?
717-
LBRACE
718-
syncTo_RBRACE
719-
RBRACE
720-
;
716+
: AT_IDENT ws ((LBRACE) => braceBlock2 | (componentValue) => componentValue) ((ws (LBRACE | (componentValue) => componentValue)) => (ws ((LBRACE) => braceBlock2 | (componentValue) => componentValue)))*;
717+
721718
moz_document
722719
:
723720
MOZ_DOCUMENT_SYM ws? ( moz_document_function ws?) ( COMMA ws? moz_document_function ws? )*
@@ -899,7 +896,7 @@ declaration
899896
| (cp_mixin_declaration)=>cp_mixin_declaration
900897
| (cp_mixin_call)=> cp_mixin_call (ws? IMPORTANT_SYM)?
901898
| (cp_mixin_call)=> {isScssSource()}? cp_mixin_call (ws? IMPORTANT_SYM)?
902-
| {isCssPreprocessorSource()}? at_rule
899+
| at_rule
903900
| {isScssSource()}? sass_control
904901
| {isScssSource()}? sass_extend
905902
| {isScssSource()}? sass_debug
@@ -1096,7 +1093,15 @@ preservedToken: ~ (LPAREN | LBRACE | LBRACKET | RPAREN | RBRACE | RBRACKET);
10961093

10971094
preservedTokenTopLevel: ~ (LPAREN | LBRACE | LBRACKET | RPAREN | RBRACE | RBRACKET | SEMI );
10981095

1099-
braceBlock: LBRACE componentValue+ RBRACE;
1096+
// {} block
1097+
braceBlock2:
1098+
LBRACE ws?
1099+
declarations?
1100+
RBRACE
1101+
;
1102+
1103+
// simple brace block
1104+
braceBlock: LBRACE componentValue* RBRACE;
11001105

11011106
bracketBlock: LBRACKET componentValue+ RBRACKET;
11021107

0 commit comments

Comments
 (0)