From 9d501fad571a67c6fe31f97cbdcea51622e7f885 Mon Sep 17 00:00:00 2001 From: meri Date: Tue, 8 Apr 2014 11:56:50 +0200 Subject: [PATCH] Getting ready for #186 - updated grammar. --- .../github/sommeri/less4j/core/parser/Less.g | 14 +++++--------- src/test/resources/minitests/debug1.less | 19 +++++-------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/main/antlr3/com/github/sommeri/less4j/core/parser/Less.g b/src/main/antlr3/com/github/sommeri/less4j/core/parser/Less.g index 1ccbba95..35cfb203 100644 --- a/src/main/antlr3/com/github/sommeri/less4j/core/parser/Less.g +++ b/src/main/antlr3/com/github/sommeri/less4j/core/parser/Less.g @@ -631,11 +631,6 @@ pseudoparameters: | (b+=PLUS | b+=MINUS)? b+=NUMBER) -> ^(NTH ^(TERM $a*) ^(TERM $b*)); -//original -//referenceSeparator: -// GREATER -// | {!predicates.directlyFollows(input.LT(-1), input.LT(1))}?=> -> EMPTY_COMBINATOR; - referenceSeparator: GREATER | -> EMPTY_COMBINATOR; @@ -680,9 +675,6 @@ mixinReferenceArguments | expr (COMMA! variabledeclarationNoSemi (COMMA! variabledeclarationNoSemi)*)? ; -//reusableStructureName -// : a+=cssClassOrId ({predicates.directlyFollows(input.LT(-1), input.LT(1))}?=> a+=cssClassOrId)* -> ^(REUSABLE_STRUCTURE_NAME $a*); - reusableStructureName : a+=cssClassOrId -> ^(REUSABLE_STRUCTURE_NAME $a*); @@ -779,9 +771,13 @@ mathOperatorLowPrior | MINUS ; +detachedRuleset + : general_body + ; + expr @init {enterRule(retval, RULE_EXPRESSION);} - : a=mathExprHighPrior (b+=operator c+=mathExprHighPrior)* -> ^(EXPRESSION $a ($b $c)*) + : (dr+=detachedRuleset | a+=mathExprHighPrior (b+=operator c+=mathExprHighPrior)*) -> ^(EXPRESSION $dr* $a* ($b $c)*) ; finally { leaveRule(); } diff --git a/src/test/resources/minitests/debug1.less b/src/test/resources/minitests/debug1.less index 4c0e76e3..d4125131 100644 --- a/src/test/resources/minitests/debug1.less +++ b/src/test/resources/minitests/debug1.less @@ -1,15 +1,6 @@ -@usedScope: global; -.mixin() { - @usedScope: mixin; - .global when (@usedScope=global) { - guard-used-scope: global; - declaration-used-scope: @usedScope; - } - .mixin when (@usedScope=mixin) { - guard-used-scope: mixin; - declaration-used-scope: @usedScope; - } - @usedScope: mixin; -} +@property: color; -.mixin(); \ No newline at end of file +.widget { + @{property}: #0ee; + background-@{property}: #999; +} \ No newline at end of file