diff --git a/lesscpy/lessc/parser.py b/lesscpy/lessc/parser.py index caf1e95..ff8fce4 100644 --- a/lesscpy/lessc/parser.py +++ b/lesscpy/lessc/parser.py @@ -165,7 +165,7 @@ class LessParser(object): self.scope.update(recurse.scope) else: err = "Cannot import '%s', file not found" % filename - self.handle_error(err, p, 'W') + self.handle_error(err, p.lineno(1), 'W') p[0] = None except ImportError as e: self.handle_error(e, p) @@ -248,13 +248,19 @@ class LessParser(object): self.handle_error(e, p.lineno(2)) else: self.handle_error('Call unknown mixin `%s`' % p[1], p.lineno(2)) + + def p_mixin_args_arguments(self, p): + """ mixin_args : less_arguments + """ + p[0] = [p[1]] def p_mixin_args_aux(self, p): """ mixin_args : mixin_args ',' argument | mixin_args ',' mixin_kwarg + | mixin_args argument + | mixin_args mixin_kwarg """ - p[1].append(p[2]) - p[1].append(p[3]) + p[1].extend(list(p)[2:]) p[0] = p[1] def p_mixin_args(self, p): @@ -349,6 +355,7 @@ class LessParser(object): def p_style_list_aux(self, p): """ style_list : style_list style | style_list ',' style + | style_list t_ws style """ p[1].extend(list(p)[2:]) p[0] = p[1] @@ -495,7 +502,7 @@ class LessParser(object): p[0] = p[1] def p_argument_list(self, p): - """ argument_list : argument + """ argument_list : argument """ p[0] = [p[1]] diff --git a/lesscpy/scripts/compiler.py b/lesscpy/scripts/compiler.py index 2019c8e..14ea7e0 100644 --- a/lesscpy/scripts/compiler.py +++ b/lesscpy/scripts/compiler.py @@ -44,7 +44,7 @@ def ldirectory(inpath, outpath, args, scope): lex_optimize=True, yacc_optimize=True, scope=scope, - yacctab=yacctab, + tabfile=yacctab, verbose=args.verbose) p.parse(filename=lf, debuglevel=0) css = f.format(p, args.minify, args.xminify) @@ -115,7 +115,7 @@ def run(): yacc_debug=False, lex_optimize=True, yacc_optimize=True, - yacctab=yacctab, + tabfile=yacctab, verbose=args.verbose) p.parse(filename=u, debuglevel=0) if not scope: diff --git a/lesscpy/test/css/elements.css b/lesscpy/test/css/elements.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lesscpy/test/css/elements.css @@ -0,0 +1 @@ + diff --git a/lesscpy/test/css/elements.min.css b/lesscpy/test/css/elements.min.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lesscpy/test/css/elements.min.css @@ -0,0 +1 @@ + diff --git a/lesscpy/test/css/mixin-args.css b/lesscpy/test/css/mixin-args.css index 1bcf2e3..9515b8f 100644 --- a/lesscpy/test/css/mixin-args.css +++ b/lesscpy/test/css/mixin-args.css @@ -53,3 +53,6 @@ .arguments3 { border: 1px solid red; } +.arguments4 { + border: 1px solid red; +} diff --git a/lesscpy/test/css/mixin-args.min.css b/lesscpy/test/css/mixin-args.min.css index 8762006..aa4aaec 100644 --- a/lesscpy/test/css/mixin-args.min.css +++ b/lesscpy/test/css/mixin-args.min.css @@ -13,3 +13,4 @@ .arguments2{border:1px;} .arguments3{border:0px;} .arguments3{border:1px solid red;} +.arguments4{border:1px solid red;} diff --git a/lesscpy/test/less/elements.less b/lesscpy/test/less/elements.less new file mode 100644 index 0000000..e0a3fb5 --- /dev/null +++ b/lesscpy/test/less/elements.less @@ -0,0 +1,136 @@ +/*--------------------------------------------------- + LESS Elements 0.6 + --------------------------------------------------- + A set of useful LESS mixins by Dmitry Fadeyev + Special thanks for mixin suggestions to: + Kris Van Herzeele, + Benoit Adam, + Portenart Emile-Victor, + Ryan Faerman + + More info at: http://lesselements.com +-----------------------------------------------------*/ + +.gradient(@color: #F5F5F5, @start: #EEE, @stop: #FFF) { + background: @color; + background: -webkit-gradient(linear, + left bottom, + left top, + color-stop(0, @start), + color-stop(1, @stop)); + background: -ms-linear-gradient(bottom, + @start, + @stop); + background: -moz-linear-gradient(center bottom, + @start 0%, + @stop 100%); +} +.bw-gradient(@color: #F5F5F5, @start: 0, @stop: 255) { + background: @color; + background: -webkit-gradient(linear, + left bottom, + left top, + color-stop(0, rgb(@start,@start,@start)), + color-stop(1, rgb(@stop,@stop,@stop))); + background: -ms-linear-gradient(bottom, + rgb(@start,@start,@start) 0%, + rgb(@start,@start,@start) 100%); + background: -moz-linear-gradient(center bottom, + rgb(@start,@start,@start) 0%, + rgb(@stop,@stop,@stop) 100%); +} +.bordered(@top-color: #EEE, @right-color: #EEE, @bottom-color: #EEE, @left-color: #EEE) { + border-top: solid 1px @top-color; + border-left: solid 1px @left-color; + border-right: solid 1px @right-color; + border-bottom: solid 1px @bottom-color; +} +.drop-shadow(@x-axis: 0, @y-axis: 1px, @blur: 2px, @alpha: 0.1) { + -webkit-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha); + -moz-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha); + box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha); +} +.rounded(@radius: 2px) { + -webkit-border-radius: @radius; + -moz-border-radius: @radius; + border-radius: @radius; + -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; +} +.border-radius(@topright: 0, @bottomright: 0, @bottomleft: 0, @topleft: 0) { + -webkit-border-top-right-radius: @topright; + -webkit-border-bottom-right-radius: @bottomright; + -webkit-border-bottom-left-radius: @bottomleft; + -webkit-border-top-left-radius: @topleft; + -moz-border-radius-topright: @topright; + -moz-border-radius-bottomright: @bottomright; + -moz-border-radius-bottomleft: @bottomleft; + -moz-border-radius-topleft: @topleft; + border-top-right-radius: @topright; + border-bottom-right-radius: @bottomright; + border-bottom-left-radius: @bottomleft; + border-top-left-radius: @topleft; + -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; +} +.opacity(@opacity: 0.5) { + -moz-opacity: @opacity; + -khtml-opacity: @opacity; + -webkit-opacity: @opacity; + opacity: @opacity; +} +.transition-duration(@duration: 0.2s) { + -moz-transition-duration: @duration; + -webkit-transition-duration: @duration; + transition-duration: @duration; +} +.rotation(@deg:5deg){ + -webkit-transform: rotate(@deg); + -moz-transform: rotate(@deg); + transform: rotate(@deg); +} +.scale(@ratio:1.5){ + -webkit-transform:scale(@ratio); + -moz-transform:scale(@ratio); + transform:scale(@ratio); +} +.transition(@duration:0.2s, @ease:ease-out) { + -webkit-transition: all @duration @ease; + -moz-transition: all @duration @ease; + transition: all @duration @ease; +} +.inner-shadow(@horizontal:0, @vertical:1px, @blur:2px, @alpha: 0.4) { + -webkit-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha); + -moz-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha); + box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha); +} +.box-shadow(@arguments) { + -webkit-box-shadow: @arguments; + -moz-box-shadow: @arguments; + box-shadow: @arguments; +} +.columns(@colwidth: 250px, @colcount: 0, @colgap: 50px, @columnRuleColor: #EEE, @columnRuleStyle: solid, @columnRuleWidth: 1px) { + -moz-column-width: @colwidth; + -moz-column-count: @colcount; + -moz-column-gap: @colgap; + -moz-column-rule-color: @columnRuleColor; + -moz-column-rule-style: @columnRuleStyle; + -moz-column-rule-width: @columnRuleWidth; + -webkit-column-width: @colwidth; + -webkit-column-count: @colcount; + -webkit-column-gap: @colgap; + -webkit-column-rule-color: @columnRuleColor; + -webkit-column-rule-style: @columnRuleStyle; + -webkit-column-rule-width: @columnRuleWidth; + column-width: @colwidth; + column-count: @colcount; + column-gap: @colgap; + column-rule-color: @columnRuleColor; + column-rule-style: @columnRuleStyle; + column-rule-width: @columnRuleWidth; +} +.translate(@x:0, @y:0) { + -moz-transform: translate(@x, @y); + -webkit-transform: translate(@x, @y); + -o-transform: translate(@x, @y); + -ms-transform: translate(@x, @y); + transform: translate(@x, @y); +} diff --git a/lesscpy/test/less/imports.less b/lesscpy/test/less/imports.less index baf734e..84004b5 100644 --- a/lesscpy/test/less/imports.less +++ b/lesscpy/test/less/imports.less @@ -18,4 +18,4 @@ .mixin; .mixf(6px); height: @imported; -} \ No newline at end of file +} diff --git a/lesscpy/test/less/mixin-args.less b/lesscpy/test/less/mixin-args.less index 2905398..e40b83f 100644 --- a/lesscpy/test/less/mixin-args.less +++ b/lesscpy/test/less/mixin-args.less @@ -103,4 +103,7 @@ } .arguments3 { .arguments_empty(1px, solid, red); +} +.arguments4 { + .arguments_empty(1px solid red); } \ No newline at end of file