Permalink
Browse files

less syntaxes bug fixed

  • Loading branch information...
cellfusion committed Oct 8, 2010
1 parent b4124a3 commit 27318f07007cb70ce053bdcfc342d5318c5f161d
Showing with 120 additions and 54 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 PlaceholderThemes/LESS.css
  3. +37 −28 Syntaxes/LESS.xml
  4. +81 −25 test.less
View
@@ -0,0 +1 @@
+.DS_Store
@@ -43,5 +43,5 @@ mixin.definition.less {
}
mixin.less, mixin.less > punctuation {
- color: #d4430d;
+ color: #d6cb58;
}
View
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<syntax name="styling.less">
<zones>
- <include collection="variables"/>
- <include collection="mixin-def"/>
+ <include collection="variable-def"/>
+ <!--<include collection="mixin-def"/>-->
<zone name="itemize.group-start.comment.block.less">
<starts-with>/\*\s+@group\s</starts-with>
<ends-with>\*/</ends-with>
@@ -96,26 +96,30 @@
</subzones>
</zone>
- <include collection="selector"/>
-
- <zone name="property-list.block.less">
- <starts-with>
- <expression>\{</expression>
- <capture number="0" name="punctuation.begin"/>
- </starts-with>
- <ends-with>
- <expression>\}</expression>
- <capture number="0" name="punctuation.end"/>
- </ends-with>
- <subzones>
- <include collection="comments"/>
- <include collection="mixin"/>
- <include collection="properties"/>
- <include collection="variables"/>
- </subzones>
- </zone>
+ <include collection="block"/>
</zones>
<library>
+
+ <collection name="block">
+ <zone name="property-list.block.less">
+ <starts-with>
+ <expression>(.+)\{</expression>
+ <capture number="0" name="punctuation.begin"/>
+ <capture number="1" name="punctuation.definition.mixin.less"/>
+ </starts-with>
+ <ends-with>
+ <expression>\}</expression>
+ <capture number="0" name="punctuation.end"/>
+ </ends-with>
+ <subzones>
+ <include collection="comments"/>
+ <include collection="mixin"/>
+ <include collection="variable-def"/>
+ <include collection="properties"/>
+ <include collection="block" />
+ </subzones>
+ </zone>
+ </collection>
<collection name="selector">
<zone name="selector.less">
@@ -130,11 +134,12 @@
<collection name="properties">
<include collection="property-name"/>
<include collection="property-value"/>
+ <include collection="variables"/>
</collection>
<collection name="property-name">
<zone name="property-name">
<starts-with>
- <expression>(?=[a-zA-Z-])</expression>
+ <expression>(?=[a-zA-Z\-])</expression>
</starts-with>
<ends-with>
<expression>(?=\s*:)</expression>
@@ -255,6 +260,12 @@
<!-- LESS Only Stuff -->
<collection name="variables">
+ <zone name="variable.style.less">
+ <expression>(@)(?!important)([a-zA-Z0-9_-]+)</expression>
+ </zone>
+ </collection>
+
+ <collection name="variable-def">
<zone name="variable.definition.style.less">
<starts-with>
<expression>(@)([a-zA-Z0-9_-]+(:))</expression>
@@ -269,19 +280,16 @@
<include collection="property-value"/>
</subzones>
</zone>
- <zone name="variable.style.less">
- <expression>(@)(?!important)([a-zA-Z0-9_-]+)</expression>
- <capture number="1" name="punctuation.definition.variable.sass"/>
- <capture number="2" name="variable.property-name.sass"/>
- </zone>
</collection>
<collection name="mixin">
<zone name="mixin.less">
<starts-with>
- <expression>(\.)([a-zA-Z0-9_-]+)</expression>
+ <expression>([\.\#][a-zA-Z0-9_\-\>]+)</expression>
+ <!--
<capture number="1" name="punctuation.definition.mixin.less"/>
<capture number="2" name="mixin.name.less"/>
+ -->
<capture number="3" name="punctuation.definition.begin"/>
</starts-with>
<ends-with>
@@ -303,10 +311,11 @@
</subzones>
</zone>
</collection>
+
<collection name="mixin-def">
<zone name="mixin.definition.style.less">
<starts-with>
- <expression>(^\.)([a-zA-Z0-9_-]+)</expression>
+ <expression>(^\.\#)([a-zA-Z0-9_-]+)</expression>
</starts-with>
<ends-with>(?=\{)</ends-with>
<subzones>
View
106 test.less
@@ -1,45 +1,101 @@
-@brand_color: #4D926F;
+/* Variables */
+@nice-blue: #5B83AD;
+@light-blue: @nice-blue + #111;
-#header {
- color: @brand_color;
+#header { color: @light-blue; }
+
+/* Mixins */
+.bordered {
+ border-top: dotted 1px black;
+ border-bottom: solid 2px black;
}
-h2 {
- color: @brand_color;
+#menu a {
+ color: #111;
+ .bordered;
}
-@the-border: 1px;
-@base-color: #111;
+.post a {
+ color: red;
+ .bordered;
+}
+/* Nested rules */
#header {
- color: @base-color * 3;
- border-left: @the-border;
- border-right: @the-border * 2;
+ color: black;
+
+ .navigation {
+ font-size: 12px;
+ }
+ .logo {
+ width: 300px;
+ :hover { text-decoration: none }
+ }
}
-#footer {
- color: (@base-color + #111) * 1.5;
+/* Operations */
+@base: 5%;
+@filler: @base * 2;
+@other: @base + @filler;
+
+.operations {
+ color: #888 / 4;
+ background-color: @base-color + #111;
+ height: 100% / 2 + @filler;
+}
+
+/* Namespaces & Accessors */
+#bundle {
+ .button {
+ display: block;
+ border: 1px solid black;
+ background-color: grey;
+ :hover { background-color: white }
+ }
+ .tab {
+ float: left;
+ }
+ .citation {
+ display: none;
+ }
}
-.rounded_corners (@radius: 5px) {
- -moz-border-radius: @radius;
- -webkit-border-radius: @radius;
- border-radius: @radius;
+#header a {
+ color: orange;
+ #bundle > .button;
}
-#header {
- .rounded_corners;
+#defaults {
+ @width: 960px;
+ @color: black;
}
-#footer {
- .rounded_corners(10px);
+.article { color: #294366; }
+
+.comment {
+ width: #defaults[@width];
+ color: .article['color'];
}
-#header {
- color: red;
- a {
- font-weight: bold;
- text-decoration: none;
+/* Scope */
+@var: red;
+
+#page {
+ @var: white;
+ #header {
+ color: @var; // white
}
}
+
+/* Comments */
+/* One hell of a comment */
+@var: red;
+
+// Get in line!
+@var: white;
+
+
+/* Importing */
+@import "library";
+@import "typo.css";

0 comments on commit 27318f0

Please sign in to comment.