less 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/less.gemspec +1 -1
- data/lib/less/engine/less.tt +3 -3
- data/lib/less/engine/parser.rb +140 -73
- data/spec/css/css-1.0.css +1 -0
- data/spec/css/whitespace-1.0.css +4 -0
- data/spec/less/css-1.0.less +4 -0
- data/spec/less/whitespace-1.0.less +4 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
data/less.gemspec
CHANGED
data/lib/less/engine/less.tt
CHANGED
@@ -176,7 +176,7 @@ grammar Less
|
|
176
176
|
# [type="text"]
|
177
177
|
#
|
178
178
|
rule attribute
|
179
|
-
'['
|
179
|
+
'[' tag ([|~]? '=') (tag / string) ']' / '[' (tag / string) ']'
|
180
180
|
end
|
181
181
|
|
182
182
|
rule class
|
@@ -192,7 +192,7 @@ grammar Less
|
|
192
192
|
end
|
193
193
|
|
194
194
|
rule select
|
195
|
-
(s [
|
195
|
+
(s [+>] s / s ':' / S)?
|
196
196
|
end
|
197
197
|
|
198
198
|
# TODO: Merge this with attribute rule
|
@@ -369,6 +369,6 @@ grammar Less
|
|
369
369
|
|
370
370
|
# Non-space char
|
371
371
|
rule ns
|
372
|
-
![
|
372
|
+
![ ;\n] .
|
373
373
|
end
|
374
374
|
end
|
data/lib/less/engine/parser.rb
CHANGED
@@ -1875,6 +1875,13 @@ module Less
|
|
1875
1875
|
end
|
1876
1876
|
|
1877
1877
|
module Attribute1
|
1878
|
+
def tag
|
1879
|
+
elements[1]
|
1880
|
+
end
|
1881
|
+
|
1882
|
+
end
|
1883
|
+
|
1884
|
+
module Attribute2
|
1878
1885
|
end
|
1879
1886
|
|
1880
1887
|
def _nt_attribute
|
@@ -1885,108 +1892,137 @@ module Less
|
|
1885
1892
|
return cached
|
1886
1893
|
end
|
1887
1894
|
|
1888
|
-
i0
|
1895
|
+
i0 = index
|
1896
|
+
i1, s1 = index, []
|
1889
1897
|
if has_terminal?('[', false, index)
|
1890
|
-
|
1898
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1891
1899
|
@index += 1
|
1892
1900
|
else
|
1893
1901
|
terminal_parse_failure('[')
|
1894
|
-
|
1902
|
+
r2 = nil
|
1895
1903
|
end
|
1896
|
-
|
1897
|
-
if
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
@index += 1
|
1903
|
-
else
|
1904
|
-
r3 = nil
|
1905
|
-
end
|
1906
|
-
if r3
|
1907
|
-
s2 << r3
|
1908
|
-
else
|
1909
|
-
break
|
1910
|
-
end
|
1911
|
-
end
|
1912
|
-
if s2.empty?
|
1913
|
-
@index = i2
|
1914
|
-
r2 = nil
|
1915
|
-
else
|
1916
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1917
|
-
end
|
1918
|
-
s0 << r2
|
1919
|
-
if r2
|
1920
|
-
i5, s5 = index, []
|
1904
|
+
s1 << r2
|
1905
|
+
if r2
|
1906
|
+
r3 = _nt_tag
|
1907
|
+
s1 << r3
|
1908
|
+
if r3
|
1909
|
+
i4, s4 = index, []
|
1921
1910
|
if has_terminal?('[|~]', true, index)
|
1922
|
-
|
1911
|
+
r6 = true
|
1923
1912
|
@index += 1
|
1924
1913
|
else
|
1925
|
-
|
1914
|
+
r6 = nil
|
1926
1915
|
end
|
1927
|
-
if
|
1928
|
-
|
1916
|
+
if r6
|
1917
|
+
r5 = r6
|
1929
1918
|
else
|
1930
|
-
|
1919
|
+
r5 = instantiate_node(SyntaxNode,input, index...index)
|
1931
1920
|
end
|
1932
|
-
|
1933
|
-
if
|
1921
|
+
s4 << r5
|
1922
|
+
if r5
|
1934
1923
|
if has_terminal?('=', false, index)
|
1935
|
-
|
1924
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1936
1925
|
@index += 1
|
1937
1926
|
else
|
1938
1927
|
terminal_parse_failure('=')
|
1939
|
-
|
1928
|
+
r7 = nil
|
1940
1929
|
end
|
1941
|
-
|
1942
|
-
end
|
1943
|
-
if s5.last
|
1944
|
-
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1945
|
-
r5.extend(Attribute0)
|
1946
|
-
else
|
1947
|
-
@index = i5
|
1948
|
-
r5 = nil
|
1930
|
+
s4 << r7
|
1949
1931
|
end
|
1950
|
-
if
|
1951
|
-
r4 =
|
1932
|
+
if s4.last
|
1933
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1934
|
+
r4.extend(Attribute0)
|
1952
1935
|
else
|
1953
|
-
|
1936
|
+
@index = i4
|
1937
|
+
r4 = nil
|
1954
1938
|
end
|
1955
|
-
|
1939
|
+
s1 << r4
|
1956
1940
|
if r4
|
1957
|
-
|
1958
|
-
|
1959
|
-
if
|
1960
|
-
|
1941
|
+
i8 = index
|
1942
|
+
r9 = _nt_tag
|
1943
|
+
if r9
|
1944
|
+
r8 = r9
|
1961
1945
|
else
|
1962
|
-
|
1963
|
-
if
|
1964
|
-
|
1946
|
+
r10 = _nt_string
|
1947
|
+
if r10
|
1948
|
+
r8 = r10
|
1965
1949
|
else
|
1966
|
-
@index =
|
1967
|
-
|
1950
|
+
@index = i8
|
1951
|
+
r8 = nil
|
1968
1952
|
end
|
1969
1953
|
end
|
1970
|
-
|
1971
|
-
if
|
1954
|
+
s1 << r8
|
1955
|
+
if r8
|
1972
1956
|
if has_terminal?(']', false, index)
|
1973
|
-
|
1957
|
+
r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1974
1958
|
@index += 1
|
1975
1959
|
else
|
1976
1960
|
terminal_parse_failure(']')
|
1977
|
-
|
1961
|
+
r11 = nil
|
1978
1962
|
end
|
1979
|
-
|
1963
|
+
s1 << r11
|
1980
1964
|
end
|
1981
1965
|
end
|
1982
1966
|
end
|
1983
1967
|
end
|
1984
|
-
if
|
1985
|
-
|
1986
|
-
|
1968
|
+
if s1.last
|
1969
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1970
|
+
r1.extend(Attribute1)
|
1987
1971
|
else
|
1988
|
-
@index =
|
1989
|
-
|
1972
|
+
@index = i1
|
1973
|
+
r1 = nil
|
1974
|
+
end
|
1975
|
+
if r1
|
1976
|
+
r0 = r1
|
1977
|
+
else
|
1978
|
+
i12, s12 = index, []
|
1979
|
+
if has_terminal?('[', false, index)
|
1980
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1981
|
+
@index += 1
|
1982
|
+
else
|
1983
|
+
terminal_parse_failure('[')
|
1984
|
+
r13 = nil
|
1985
|
+
end
|
1986
|
+
s12 << r13
|
1987
|
+
if r13
|
1988
|
+
i14 = index
|
1989
|
+
r15 = _nt_tag
|
1990
|
+
if r15
|
1991
|
+
r14 = r15
|
1992
|
+
else
|
1993
|
+
r16 = _nt_string
|
1994
|
+
if r16
|
1995
|
+
r14 = r16
|
1996
|
+
else
|
1997
|
+
@index = i14
|
1998
|
+
r14 = nil
|
1999
|
+
end
|
2000
|
+
end
|
2001
|
+
s12 << r14
|
2002
|
+
if r14
|
2003
|
+
if has_terminal?(']', false, index)
|
2004
|
+
r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2005
|
+
@index += 1
|
2006
|
+
else
|
2007
|
+
terminal_parse_failure(']')
|
2008
|
+
r17 = nil
|
2009
|
+
end
|
2010
|
+
s12 << r17
|
2011
|
+
end
|
2012
|
+
end
|
2013
|
+
if s12.last
|
2014
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
2015
|
+
r12.extend(Attribute2)
|
2016
|
+
else
|
2017
|
+
@index = i12
|
2018
|
+
r12 = nil
|
2019
|
+
end
|
2020
|
+
if r12
|
2021
|
+
r0 = r12
|
2022
|
+
else
|
2023
|
+
@index = i0
|
2024
|
+
r0 = nil
|
2025
|
+
end
|
1990
2026
|
end
|
1991
2027
|
|
1992
2028
|
node_cache[:attribute][start_index] = r0
|
@@ -2206,6 +2242,13 @@ module Less
|
|
2206
2242
|
end
|
2207
2243
|
end
|
2208
2244
|
|
2245
|
+
module Select1
|
2246
|
+
def s
|
2247
|
+
elements[0]
|
2248
|
+
end
|
2249
|
+
|
2250
|
+
end
|
2251
|
+
|
2209
2252
|
def _nt_select
|
2210
2253
|
start_index = index
|
2211
2254
|
if node_cache[:select].has_key?(index)
|
@@ -2219,7 +2262,7 @@ module Less
|
|
2219
2262
|
r3 = _nt_s
|
2220
2263
|
s2 << r3
|
2221
2264
|
if r3
|
2222
|
-
if has_terminal?('[
|
2265
|
+
if has_terminal?('[+>]', true, index)
|
2223
2266
|
r4 = true
|
2224
2267
|
@index += 1
|
2225
2268
|
else
|
@@ -2241,12 +2284,36 @@ module Less
|
|
2241
2284
|
if r2
|
2242
2285
|
r1 = r2
|
2243
2286
|
else
|
2244
|
-
|
2287
|
+
i6, s6 = index, []
|
2288
|
+
r7 = _nt_s
|
2289
|
+
s6 << r7
|
2290
|
+
if r7
|
2291
|
+
if has_terminal?(':', false, index)
|
2292
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2293
|
+
@index += 1
|
2294
|
+
else
|
2295
|
+
terminal_parse_failure(':')
|
2296
|
+
r8 = nil
|
2297
|
+
end
|
2298
|
+
s6 << r8
|
2299
|
+
end
|
2300
|
+
if s6.last
|
2301
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
2302
|
+
r6.extend(Select1)
|
2303
|
+
else
|
2304
|
+
@index = i6
|
2305
|
+
r6 = nil
|
2306
|
+
end
|
2245
2307
|
if r6
|
2246
2308
|
r1 = r6
|
2247
2309
|
else
|
2248
|
-
|
2249
|
-
|
2310
|
+
r9 = _nt_S
|
2311
|
+
if r9
|
2312
|
+
r1 = r9
|
2313
|
+
else
|
2314
|
+
@index = i1
|
2315
|
+
r1 = nil
|
2316
|
+
end
|
2250
2317
|
end
|
2251
2318
|
end
|
2252
2319
|
if r1
|
@@ -3816,7 +3883,7 @@ module Less
|
|
3816
3883
|
|
3817
3884
|
i0, s0 = index, []
|
3818
3885
|
i1 = index
|
3819
|
-
if has_terminal?('[
|
3886
|
+
if has_terminal?('[ ;\\n]', true, index)
|
3820
3887
|
r2 = true
|
3821
3888
|
@index += 1
|
3822
3889
|
else
|
data/spec/css/css-1.0.css
CHANGED
data/spec/css/whitespace-1.0.css
CHANGED
data/spec/less/css-1.0.less
CHANGED