cloudhead-less 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/less.gemspec +92 -2
- data/lib/less.rb +6 -4
- data/lib/less/engine.rb +1 -1
- data/lib/less/engine/less.tt +4 -4
- data/lib/less/engine/nodes/element.rb +3 -1
- data/lib/less/engine/nodes/entity.rb +18 -4
- data/lib/less/engine/nodes/function.rb +24 -3
- data/lib/less/engine/nodes/literal.rb +4 -1
- data/lib/less/engine/parser.rb +39 -43
- data/lib/vendor/treetop/.gitignore +7 -0
- data/lib/vendor/treetop/LICENSE +19 -0
- data/lib/vendor/treetop/README +164 -0
- data/lib/vendor/treetop/Rakefile +19 -0
- data/lib/vendor/treetop/benchmark/seqpar.gnuplot +15 -0
- data/lib/vendor/treetop/benchmark/seqpar.treetop +16 -0
- data/lib/vendor/treetop/benchmark/seqpar_benchmark.rb +107 -0
- data/lib/vendor/treetop/bin/tt +28 -0
- data/lib/vendor/treetop/lib/treetop.rb +11 -0
- data/lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb +45 -0
- data/lib/vendor/treetop/lib/treetop/compiler.rb +6 -0
- data/lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb +42 -0
- data/lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb +17 -0
- data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb +3097 -0
- data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop +408 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes.rb +19 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb +18 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb +14 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb +23 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb +31 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb +24 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb +28 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb +27 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb +13 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb +19 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb +9 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb +146 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb +55 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb +45 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb +55 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb +68 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb +20 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb +9 -0
- data/lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb +9 -0
- data/lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb +113 -0
- data/lib/vendor/treetop/lib/treetop/ruby_extensions.rb +2 -0
- data/lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb +42 -0
- data/lib/vendor/treetop/lib/treetop/runtime.rb +5 -0
- data/lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb +109 -0
- data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb +4 -0
- data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb +15 -0
- data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +200 -0
- data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb +164 -0
- data/lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb +86 -0
- data/lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb +16 -0
- data/lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb +17 -0
- data/lib/vendor/treetop/lib/treetop/version.rb +9 -0
- data/lib/vendor/treetop/spec/compiler/and_predicate_spec.rb +36 -0
- data/lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb +44 -0
- data/lib/vendor/treetop/spec/compiler/character_class_spec.rb +239 -0
- data/lib/vendor/treetop/spec/compiler/choice_spec.rb +80 -0
- data/lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb +28 -0
- data/lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb +21 -0
- data/lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb +84 -0
- data/lib/vendor/treetop/spec/compiler/grammar_spec.rb +41 -0
- data/lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb +40 -0
- data/lib/vendor/treetop/spec/compiler/not_predicate_spec.rb +38 -0
- data/lib/vendor/treetop/spec/compiler/one_or_more_spec.rb +35 -0
- data/lib/vendor/treetop/spec/compiler/optional_spec.rb +37 -0
- data/lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb +19 -0
- data/lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb +32 -0
- data/lib/vendor/treetop/spec/compiler/sequence_spec.rb +115 -0
- data/lib/vendor/treetop/spec/compiler/terminal_spec.rb +81 -0
- data/lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb +37 -0
- data/lib/vendor/treetop/spec/compiler/test_grammar.treetop +7 -0
- data/lib/vendor/treetop/spec/compiler/test_grammar.tt +7 -0
- data/lib/vendor/treetop/spec/compiler/test_grammar_do.treetop +7 -0
- data/lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb +56 -0
- data/lib/vendor/treetop/spec/composition/a.treetop +11 -0
- data/lib/vendor/treetop/spec/composition/b.treetop +11 -0
- data/lib/vendor/treetop/spec/composition/c.treetop +10 -0
- data/lib/vendor/treetop/spec/composition/d.treetop +10 -0
- data/lib/vendor/treetop/spec/composition/f.treetop +17 -0
- data/lib/vendor/treetop/spec/composition/grammar_composition_spec.rb +40 -0
- data/lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop +15 -0
- data/lib/vendor/treetop/spec/ruby_extensions/string_spec.rb +32 -0
- data/lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb +101 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb +147 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb +349 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb +385 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb +660 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +6175 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +58 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb +23 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +164 -0
- data/lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb +84 -0
- data/lib/vendor/treetop/spec/runtime/syntax_node_spec.rb +68 -0
- data/lib/vendor/treetop/spec/spec_helper.rb +106 -0
- data/lib/vendor/treetop/spec/spec_suite.rb +4 -0
- data/lib/vendor/treetop/treetop.gemspec +18 -0
- data/spec/less/variables-1.0.less +1 -1
- metadata +92 -2
data/Rakefile
CHANGED
|
@@ -64,7 +64,7 @@ begin
|
|
|
64
64
|
require 'lib/less'
|
|
65
65
|
|
|
66
66
|
task :compile do
|
|
67
|
-
puts "compiling #{Less::GRAMMAR}..."
|
|
67
|
+
puts "compiling #{Less::GRAMMAR.split('/').last}..."
|
|
68
68
|
File.open(Less::PARSER, 'w') {|f| f.write Treetop::Compiler::GrammarCompiler.new.ruby_source(Less::GRAMMAR) }
|
|
69
69
|
end
|
|
70
70
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.1
|
data/less.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{less}
|
|
5
|
-
s.version = "1.0.
|
|
5
|
+
s.version = "1.0.1"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["cloudhead"]
|
|
9
|
-
s.date = %q{2009-07-
|
|
9
|
+
s.date = %q{2009-07-09}
|
|
10
10
|
s.default_executable = %q{lessc}
|
|
11
11
|
s.description = %q{LESS is leaner CSS}
|
|
12
12
|
s.email = %q{self@cloudhead.net}
|
|
@@ -36,6 +36,96 @@ Gem::Specification.new do |s|
|
|
|
36
36
|
"lib/less/engine/nodes/property.rb",
|
|
37
37
|
"lib/less/engine/nodes/selector.rb",
|
|
38
38
|
"lib/less/engine/parser.rb",
|
|
39
|
+
"lib/vendor/treetop/.gitignore",
|
|
40
|
+
"lib/vendor/treetop/LICENSE",
|
|
41
|
+
"lib/vendor/treetop/README",
|
|
42
|
+
"lib/vendor/treetop/Rakefile",
|
|
43
|
+
"lib/vendor/treetop/benchmark/seqpar.gnuplot",
|
|
44
|
+
"lib/vendor/treetop/benchmark/seqpar.treetop",
|
|
45
|
+
"lib/vendor/treetop/benchmark/seqpar_benchmark.rb",
|
|
46
|
+
"lib/vendor/treetop/bin/tt",
|
|
47
|
+
"lib/vendor/treetop/lib/treetop.rb",
|
|
48
|
+
"lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb",
|
|
49
|
+
"lib/vendor/treetop/lib/treetop/compiler.rb",
|
|
50
|
+
"lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb",
|
|
51
|
+
"lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb",
|
|
52
|
+
"lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb",
|
|
53
|
+
"lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop",
|
|
54
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes.rb",
|
|
55
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb",
|
|
56
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb",
|
|
57
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb",
|
|
58
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb",
|
|
59
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb",
|
|
60
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb",
|
|
61
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb",
|
|
62
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb",
|
|
63
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb",
|
|
64
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb",
|
|
65
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb",
|
|
66
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb",
|
|
67
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb",
|
|
68
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb",
|
|
69
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb",
|
|
70
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb",
|
|
71
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb",
|
|
72
|
+
"lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb",
|
|
73
|
+
"lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb",
|
|
74
|
+
"lib/vendor/treetop/lib/treetop/ruby_extensions.rb",
|
|
75
|
+
"lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb",
|
|
76
|
+
"lib/vendor/treetop/lib/treetop/runtime.rb",
|
|
77
|
+
"lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb",
|
|
78
|
+
"lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb",
|
|
79
|
+
"lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb",
|
|
80
|
+
"lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb",
|
|
81
|
+
"lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb",
|
|
82
|
+
"lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb",
|
|
83
|
+
"lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb",
|
|
84
|
+
"lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb",
|
|
85
|
+
"lib/vendor/treetop/lib/treetop/version.rb",
|
|
86
|
+
"lib/vendor/treetop/spec/compiler/and_predicate_spec.rb",
|
|
87
|
+
"lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb",
|
|
88
|
+
"lib/vendor/treetop/spec/compiler/character_class_spec.rb",
|
|
89
|
+
"lib/vendor/treetop/spec/compiler/choice_spec.rb",
|
|
90
|
+
"lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb",
|
|
91
|
+
"lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb",
|
|
92
|
+
"lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb",
|
|
93
|
+
"lib/vendor/treetop/spec/compiler/grammar_spec.rb",
|
|
94
|
+
"lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb",
|
|
95
|
+
"lib/vendor/treetop/spec/compiler/not_predicate_spec.rb",
|
|
96
|
+
"lib/vendor/treetop/spec/compiler/one_or_more_spec.rb",
|
|
97
|
+
"lib/vendor/treetop/spec/compiler/optional_spec.rb",
|
|
98
|
+
"lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb",
|
|
99
|
+
"lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb",
|
|
100
|
+
"lib/vendor/treetop/spec/compiler/sequence_spec.rb",
|
|
101
|
+
"lib/vendor/treetop/spec/compiler/terminal_spec.rb",
|
|
102
|
+
"lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb",
|
|
103
|
+
"lib/vendor/treetop/spec/compiler/test_grammar.treetop",
|
|
104
|
+
"lib/vendor/treetop/spec/compiler/test_grammar.tt",
|
|
105
|
+
"lib/vendor/treetop/spec/compiler/test_grammar_do.treetop",
|
|
106
|
+
"lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb",
|
|
107
|
+
"lib/vendor/treetop/spec/composition/a.treetop",
|
|
108
|
+
"lib/vendor/treetop/spec/composition/b.treetop",
|
|
109
|
+
"lib/vendor/treetop/spec/composition/c.treetop",
|
|
110
|
+
"lib/vendor/treetop/spec/composition/d.treetop",
|
|
111
|
+
"lib/vendor/treetop/spec/composition/f.treetop",
|
|
112
|
+
"lib/vendor/treetop/spec/composition/grammar_composition_spec.rb",
|
|
113
|
+
"lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop",
|
|
114
|
+
"lib/vendor/treetop/spec/ruby_extensions/string_spec.rb",
|
|
115
|
+
"lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb",
|
|
116
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb",
|
|
117
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb",
|
|
118
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb",
|
|
119
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb",
|
|
120
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle",
|
|
121
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb",
|
|
122
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb",
|
|
123
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb",
|
|
124
|
+
"lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb",
|
|
125
|
+
"lib/vendor/treetop/spec/runtime/syntax_node_spec.rb",
|
|
126
|
+
"lib/vendor/treetop/spec/spec_helper.rb",
|
|
127
|
+
"lib/vendor/treetop/spec/spec_suite.rb",
|
|
128
|
+
"lib/vendor/treetop/treetop.gemspec",
|
|
39
129
|
"spec/command_spec.rb",
|
|
40
130
|
"spec/css/accessors-1.0.css",
|
|
41
131
|
"spec/css/big-1.0.css",
|
data/lib/less.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
$:.unshift File.dirname(__FILE__),
|
|
1
|
+
$:.unshift File.dirname(__FILE__),
|
|
2
|
+
File.join(File.dirname(__FILE__), 'vendor', 'treetop', 'lib')
|
|
2
3
|
|
|
3
4
|
require 'rubygems'
|
|
4
5
|
require 'cgi'
|
|
@@ -9,8 +10,9 @@ require 'less/command'
|
|
|
9
10
|
require 'less/engine'
|
|
10
11
|
|
|
11
12
|
module Less
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
ROOT = File.expand_path(File.dirname(__FILE__))
|
|
14
|
+
PARSER = File.join(ROOT, 'less', 'engine', 'parser.rb')
|
|
15
|
+
GRAMMAR = File.join(ROOT, 'less', 'engine', 'less.tt')
|
|
14
16
|
|
|
15
17
|
MixedUnitsError = Class.new(Exception)
|
|
16
18
|
PathError = Class.new(Exception)
|
|
@@ -63,7 +65,7 @@ class Object
|
|
|
63
65
|
def log(s = '') puts "* #{s}" if $verbose end
|
|
64
66
|
def log!(s = '') puts "* #{s}" end
|
|
65
67
|
def error(s) $stderr.puts s end
|
|
66
|
-
def error!(s) raise
|
|
68
|
+
def error!(s) raise Exception, s end
|
|
67
69
|
end
|
|
68
70
|
|
|
69
71
|
class Class
|
data/lib/less/engine.rb
CHANGED
data/lib/less/engine/less.tt
CHANGED
|
@@ -210,9 +210,9 @@ grammar Less
|
|
|
210
210
|
end
|
|
211
211
|
|
|
212
212
|
rule operator
|
|
213
|
-
S
|
|
213
|
+
S [-+*/] S {
|
|
214
214
|
def build env
|
|
215
|
-
env.identifiers.last << Node::Operator.new(
|
|
215
|
+
env.identifiers.last << Node::Operator.new(text_value.strip)
|
|
216
216
|
end
|
|
217
217
|
} / [-+*/] {
|
|
218
218
|
def build env
|
|
@@ -270,11 +270,11 @@ grammar Less
|
|
|
270
270
|
rule string
|
|
271
271
|
"'" content:(!"'" . )* "'" {
|
|
272
272
|
def value
|
|
273
|
-
|
|
273
|
+
text_value[1...-1]
|
|
274
274
|
end
|
|
275
275
|
} / ["] content:(!["] . )* ["] {
|
|
276
276
|
def value
|
|
277
|
-
|
|
277
|
+
text_value[1...-1]
|
|
278
278
|
end
|
|
279
279
|
}
|
|
280
280
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module Less
|
|
2
2
|
#
|
|
3
3
|
# Node::Entity
|
|
4
|
+
#
|
|
5
|
+
# Everything in the tree is an Entity
|
|
4
6
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# Class hierarchy
|
|
7
|
+
# Mixin/Class hierarchy
|
|
8
8
|
#
|
|
9
9
|
# - Entity
|
|
10
10
|
# - Element
|
|
@@ -19,6 +19,8 @@ module Less
|
|
|
19
19
|
# - Property
|
|
20
20
|
# - Variable
|
|
21
21
|
#
|
|
22
|
+
# TODO: Use delegate class -> @rules
|
|
23
|
+
#
|
|
22
24
|
module Node
|
|
23
25
|
module Entity
|
|
24
26
|
attr_accessor :parent
|
|
@@ -27,7 +29,12 @@ module Less
|
|
|
27
29
|
super value
|
|
28
30
|
@parent = parent
|
|
29
31
|
end
|
|
30
|
-
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
# Returns the path from any given node, to the root
|
|
35
|
+
#
|
|
36
|
+
# ex: ['color', 'p', '#header', 'body', '*']
|
|
37
|
+
#
|
|
31
38
|
def path node = self
|
|
32
39
|
path = []
|
|
33
40
|
while node do
|
|
@@ -46,10 +53,17 @@ module Less
|
|
|
46
53
|
def to_s; super end
|
|
47
54
|
end
|
|
48
55
|
|
|
56
|
+
#
|
|
57
|
+
# An anonymous node, for all the 'other' stuff
|
|
58
|
+
# which doesn't need any specific functionality.
|
|
59
|
+
#
|
|
49
60
|
class Anonymous < ::String
|
|
50
61
|
include Entity
|
|
51
62
|
end
|
|
52
63
|
|
|
64
|
+
#
|
|
65
|
+
# + * - /
|
|
66
|
+
#
|
|
53
67
|
class Operator < ::String
|
|
54
68
|
def to_ruby
|
|
55
69
|
self
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
module Less
|
|
2
|
+
#
|
|
3
|
+
# Functions useable from within the style-sheet go here
|
|
4
|
+
#
|
|
2
5
|
module Functions
|
|
3
6
|
def rgb *rgb
|
|
4
7
|
rgba rgb, 1.0
|
|
@@ -8,6 +11,9 @@ module Less
|
|
|
8
11
|
hsla args, 1.0
|
|
9
12
|
end
|
|
10
13
|
|
|
14
|
+
#
|
|
15
|
+
# RGBA to Node::Color
|
|
16
|
+
#
|
|
11
17
|
def rgba *rgba
|
|
12
18
|
r, g, b, a = rgba.flatten
|
|
13
19
|
hex = [r, g, b].inject("") do |str, c|
|
|
@@ -17,7 +23,10 @@ module Less
|
|
|
17
23
|
end
|
|
18
24
|
Node::Color.new hex, a
|
|
19
25
|
end
|
|
20
|
-
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
# HSLA to RGBA
|
|
29
|
+
#
|
|
21
30
|
def hsla h, s, l, a = 1.0
|
|
22
31
|
m2 = ( l <= 0.5 ) ? l * ( s + 1 ) : l + s - l * s
|
|
23
32
|
m1 = l * 2 - m2;
|
|
@@ -36,6 +45,11 @@ module Less
|
|
|
36
45
|
end
|
|
37
46
|
|
|
38
47
|
module Node
|
|
48
|
+
#
|
|
49
|
+
# A CSS function, like rgb() or url()
|
|
50
|
+
#
|
|
51
|
+
# it calls functions from the Functions module
|
|
52
|
+
#
|
|
39
53
|
class Function < ::String
|
|
40
54
|
include Functions
|
|
41
55
|
include Entity
|
|
@@ -48,11 +62,18 @@ module Less
|
|
|
48
62
|
def to_css
|
|
49
63
|
self.evaluate.to_css
|
|
50
64
|
end
|
|
51
|
-
|
|
65
|
+
|
|
66
|
+
#
|
|
67
|
+
# Call the function
|
|
68
|
+
#
|
|
52
69
|
def evaluate
|
|
53
70
|
send self.to_sym, *@args
|
|
54
71
|
end
|
|
55
|
-
|
|
72
|
+
|
|
73
|
+
#
|
|
74
|
+
# If the function isn't found, we just print it out,
|
|
75
|
+
# this is the case for url(), for example,
|
|
76
|
+
#
|
|
56
77
|
def method_missing meth, *args
|
|
57
78
|
Node::Anonymous.new("#{meth}(#{args.map(&:to_css) * ', '})")
|
|
58
79
|
end
|
|
@@ -84,6 +84,7 @@ module Less
|
|
|
84
84
|
|
|
85
85
|
attr_reader :quotes, :content
|
|
86
86
|
|
|
87
|
+
# Strip quotes if necessary, and save them in @quotes
|
|
87
88
|
def initialize str
|
|
88
89
|
@quotes, @content = unless str.nil? or str.empty?
|
|
89
90
|
str.match(/('|")(.*?)(\1)/).captures rescue [nil, str]
|
|
@@ -115,7 +116,9 @@ module Less
|
|
|
115
116
|
end
|
|
116
117
|
|
|
117
118
|
#
|
|
118
|
-
#
|
|
119
|
+
# Any un-quoted word
|
|
120
|
+
#
|
|
121
|
+
# ex: red, small, border-collapse
|
|
119
122
|
#
|
|
120
123
|
class Keyword < ::String
|
|
121
124
|
include Entity
|
data/lib/less/engine/parser.rb
CHANGED
|
@@ -627,7 +627,7 @@ module Less
|
|
|
627
627
|
s4, i4 = [], index
|
|
628
628
|
loop do
|
|
629
629
|
if has_terminal?('[-a-zA-Z0-9_%$/.&=:;#+?]', true, index)
|
|
630
|
-
r5 =
|
|
630
|
+
r5 = true
|
|
631
631
|
@index += 1
|
|
632
632
|
else
|
|
633
633
|
r5 = nil
|
|
@@ -703,7 +703,7 @@ module Less
|
|
|
703
703
|
s1, i1 = [], index
|
|
704
704
|
loop do
|
|
705
705
|
if has_terminal?('[-a-z]', true, index)
|
|
706
|
-
r2 =
|
|
706
|
+
r2 = true
|
|
707
707
|
@index += 1
|
|
708
708
|
else
|
|
709
709
|
r2 = nil
|
|
@@ -743,7 +743,7 @@ module Less
|
|
|
743
743
|
s8, i8 = [], index
|
|
744
744
|
loop do
|
|
745
745
|
if has_terminal?('[a-z]', true, index)
|
|
746
|
-
r9 =
|
|
746
|
+
r9 = true
|
|
747
747
|
@index += 1
|
|
748
748
|
else
|
|
749
749
|
r9 = nil
|
|
@@ -1485,7 +1485,7 @@ module Less
|
|
|
1485
1485
|
i0 = index
|
|
1486
1486
|
i1, s1 = index, []
|
|
1487
1487
|
if has_terminal?('[a-zA-Z]', true, index)
|
|
1488
|
-
r2 =
|
|
1488
|
+
r2 = true
|
|
1489
1489
|
@index += 1
|
|
1490
1490
|
else
|
|
1491
1491
|
r2 = nil
|
|
@@ -1495,7 +1495,7 @@ module Less
|
|
|
1495
1495
|
s3, i3 = [], index
|
|
1496
1496
|
loop do
|
|
1497
1497
|
if has_terminal?('[-a-zA-Z0-9]', true, index)
|
|
1498
|
-
r4 =
|
|
1498
|
+
r4 = true
|
|
1499
1499
|
@index += 1
|
|
1500
1500
|
else
|
|
1501
1501
|
r4 = nil
|
|
@@ -1564,7 +1564,7 @@ module Less
|
|
|
1564
1564
|
s3, i3 = [], index
|
|
1565
1565
|
loop do
|
|
1566
1566
|
if has_terminal?('[-a-z0-9_]', true, index)
|
|
1567
|
-
r4 =
|
|
1567
|
+
r4 = true
|
|
1568
1568
|
@index += 1
|
|
1569
1569
|
else
|
|
1570
1570
|
r4 = nil
|
|
@@ -1626,7 +1626,7 @@ module Less
|
|
|
1626
1626
|
s2, i2 = [], index
|
|
1627
1627
|
loop do
|
|
1628
1628
|
if has_terminal?('[-a-zA-Z0-9_]', true, index)
|
|
1629
|
-
r3 =
|
|
1629
|
+
r3 = true
|
|
1630
1630
|
@index += 1
|
|
1631
1631
|
else
|
|
1632
1632
|
r3 = nil
|
|
@@ -1898,7 +1898,7 @@ module Less
|
|
|
1898
1898
|
s2, i2 = [], index
|
|
1899
1899
|
loop do
|
|
1900
1900
|
if has_terminal?('[a-z]', true, index)
|
|
1901
|
-
r3 =
|
|
1901
|
+
r3 = true
|
|
1902
1902
|
@index += 1
|
|
1903
1903
|
else
|
|
1904
1904
|
r3 = nil
|
|
@@ -1919,7 +1919,7 @@ module Less
|
|
|
1919
1919
|
if r2
|
|
1920
1920
|
i5, s5 = index, []
|
|
1921
1921
|
if has_terminal?('[|~]', true, index)
|
|
1922
|
-
r7 =
|
|
1922
|
+
r7 = true
|
|
1923
1923
|
@index += 1
|
|
1924
1924
|
else
|
|
1925
1925
|
r7 = nil
|
|
@@ -2016,7 +2016,7 @@ module Less
|
|
|
2016
2016
|
s0 << r1
|
|
2017
2017
|
if r1
|
|
2018
2018
|
if has_terminal?('[_a-z]', true, index)
|
|
2019
|
-
r2 =
|
|
2019
|
+
r2 = true
|
|
2020
2020
|
@index += 1
|
|
2021
2021
|
else
|
|
2022
2022
|
r2 = nil
|
|
@@ -2026,7 +2026,7 @@ module Less
|
|
|
2026
2026
|
s3, i3 = [], index
|
|
2027
2027
|
loop do
|
|
2028
2028
|
if has_terminal?('[-a-zA-Z0-9_]', true, index)
|
|
2029
|
-
r4 =
|
|
2029
|
+
r4 = true
|
|
2030
2030
|
@index += 1
|
|
2031
2031
|
else
|
|
2032
2032
|
r4 = nil
|
|
@@ -2076,7 +2076,7 @@ module Less
|
|
|
2076
2076
|
s0 << r1
|
|
2077
2077
|
if r1
|
|
2078
2078
|
if has_terminal?('[_a-z]', true, index)
|
|
2079
|
-
r2 =
|
|
2079
|
+
r2 = true
|
|
2080
2080
|
@index += 1
|
|
2081
2081
|
else
|
|
2082
2082
|
r2 = nil
|
|
@@ -2086,7 +2086,7 @@ module Less
|
|
|
2086
2086
|
s3, i3 = [], index
|
|
2087
2087
|
loop do
|
|
2088
2088
|
if has_terminal?('[-a-zA-Z0-9_]', true, index)
|
|
2089
|
-
r4 =
|
|
2089
|
+
r4 = true
|
|
2090
2090
|
@index += 1
|
|
2091
2091
|
else
|
|
2092
2092
|
r4 = nil
|
|
@@ -2128,7 +2128,7 @@ module Less
|
|
|
2128
2128
|
i0 = index
|
|
2129
2129
|
i1, s1 = index, []
|
|
2130
2130
|
if has_terminal?('[a-zA-Z]', true, index)
|
|
2131
|
-
r2 =
|
|
2131
|
+
r2 = true
|
|
2132
2132
|
@index += 1
|
|
2133
2133
|
else
|
|
2134
2134
|
r2 = nil
|
|
@@ -2138,7 +2138,7 @@ module Less
|
|
|
2138
2138
|
s3, i3 = [], index
|
|
2139
2139
|
loop do
|
|
2140
2140
|
if has_terminal?('[-a-zA-Z]', true, index)
|
|
2141
|
-
r4 =
|
|
2141
|
+
r4 = true
|
|
2142
2142
|
@index += 1
|
|
2143
2143
|
else
|
|
2144
2144
|
r4 = nil
|
|
@@ -2153,7 +2153,7 @@ module Less
|
|
|
2153
2153
|
s1 << r3
|
|
2154
2154
|
if r3
|
|
2155
2155
|
if has_terminal?('[0-9]', true, index)
|
|
2156
|
-
r6 =
|
|
2156
|
+
r6 = true
|
|
2157
2157
|
@index += 1
|
|
2158
2158
|
else
|
|
2159
2159
|
r6 = nil
|
|
@@ -2220,7 +2220,7 @@ module Less
|
|
|
2220
2220
|
s2 << r3
|
|
2221
2221
|
if r3
|
|
2222
2222
|
if has_terminal?('[:+>]', true, index)
|
|
2223
|
-
r4 =
|
|
2223
|
+
r4 = true
|
|
2224
2224
|
@index += 1
|
|
2225
2225
|
else
|
|
2226
2226
|
r4 = nil
|
|
@@ -2355,10 +2355,6 @@ module Less
|
|
|
2355
2355
|
elements[0]
|
|
2356
2356
|
end
|
|
2357
2357
|
|
|
2358
|
-
def op
|
|
2359
|
-
elements[1]
|
|
2360
|
-
end
|
|
2361
|
-
|
|
2362
2358
|
def S
|
|
2363
2359
|
elements[2]
|
|
2364
2360
|
end
|
|
@@ -2366,7 +2362,7 @@ module Less
|
|
|
2366
2362
|
|
|
2367
2363
|
module Operator1
|
|
2368
2364
|
def build env
|
|
2369
|
-
env.identifiers.last << Node::Operator.new(
|
|
2365
|
+
env.identifiers.last << Node::Operator.new(text_value.strip)
|
|
2370
2366
|
end
|
|
2371
2367
|
end
|
|
2372
2368
|
|
|
@@ -2390,7 +2386,7 @@ module Less
|
|
|
2390
2386
|
s1 << r2
|
|
2391
2387
|
if r2
|
|
2392
2388
|
if has_terminal?('[-+*/]', true, index)
|
|
2393
|
-
r3 =
|
|
2389
|
+
r3 = true
|
|
2394
2390
|
@index += 1
|
|
2395
2391
|
else
|
|
2396
2392
|
r3 = nil
|
|
@@ -2488,7 +2484,7 @@ module Less
|
|
|
2488
2484
|
s5, i5 = [], index
|
|
2489
2485
|
loop do
|
|
2490
2486
|
if has_terminal?('[-a-z]', true, index)
|
|
2491
|
-
r6 =
|
|
2487
|
+
r6 = true
|
|
2492
2488
|
@index += 1
|
|
2493
2489
|
else
|
|
2494
2490
|
r6 = nil
|
|
@@ -2641,7 +2637,7 @@ module Less
|
|
|
2641
2637
|
|
|
2642
2638
|
i0, s0 = index, []
|
|
2643
2639
|
if has_terminal?('[a-zA-Z]', true, index)
|
|
2644
|
-
r1 =
|
|
2640
|
+
r1 = true
|
|
2645
2641
|
@index += 1
|
|
2646
2642
|
else
|
|
2647
2643
|
r1 = nil
|
|
@@ -2651,7 +2647,7 @@ module Less
|
|
|
2651
2647
|
s2, i2 = [], index
|
|
2652
2648
|
loop do
|
|
2653
2649
|
if has_terminal?('[-a-zA-Z]', true, index)
|
|
2654
|
-
r3 =
|
|
2650
|
+
r3 = true
|
|
2655
2651
|
@index += 1
|
|
2656
2652
|
else
|
|
2657
2653
|
r3 = nil
|
|
@@ -2702,7 +2698,7 @@ module Less
|
|
|
2702
2698
|
|
|
2703
2699
|
module String2
|
|
2704
2700
|
def value
|
|
2705
|
-
|
|
2701
|
+
text_value[1...-1]
|
|
2706
2702
|
end
|
|
2707
2703
|
end
|
|
2708
2704
|
|
|
@@ -2718,7 +2714,7 @@ module Less
|
|
|
2718
2714
|
|
|
2719
2715
|
module String5
|
|
2720
2716
|
def value
|
|
2721
|
-
|
|
2717
|
+
text_value[1...-1]
|
|
2722
2718
|
end
|
|
2723
2719
|
end
|
|
2724
2720
|
|
|
@@ -2808,7 +2804,7 @@ module Less
|
|
|
2808
2804
|
else
|
|
2809
2805
|
i9, s9 = index, []
|
|
2810
2806
|
if has_terminal?('["]', true, index)
|
|
2811
|
-
r10 =
|
|
2807
|
+
r10 = true
|
|
2812
2808
|
@index += 1
|
|
2813
2809
|
else
|
|
2814
2810
|
r10 = nil
|
|
@@ -2820,7 +2816,7 @@ module Less
|
|
|
2820
2816
|
i12, s12 = index, []
|
|
2821
2817
|
i13 = index
|
|
2822
2818
|
if has_terminal?('["]', true, index)
|
|
2823
|
-
r14 =
|
|
2819
|
+
r14 = true
|
|
2824
2820
|
@index += 1
|
|
2825
2821
|
else
|
|
2826
2822
|
r14 = nil
|
|
@@ -2859,7 +2855,7 @@ module Less
|
|
|
2859
2855
|
s9 << r11
|
|
2860
2856
|
if r11
|
|
2861
2857
|
if has_terminal?('["]', true, index)
|
|
2862
|
-
r16 =
|
|
2858
|
+
r16 = true
|
|
2863
2859
|
@index += 1
|
|
2864
2860
|
else
|
|
2865
2861
|
r16 = nil
|
|
@@ -2959,7 +2955,7 @@ module Less
|
|
|
2959
2955
|
s4, i4 = [], index
|
|
2960
2956
|
loop do
|
|
2961
2957
|
if has_terminal?('[0-9]', true, index)
|
|
2962
|
-
r5 =
|
|
2958
|
+
r5 = true
|
|
2963
2959
|
@index += 1
|
|
2964
2960
|
else
|
|
2965
2961
|
r5 = nil
|
|
@@ -2985,7 +2981,7 @@ module Less
|
|
|
2985
2981
|
s7, i7 = [], index
|
|
2986
2982
|
loop do
|
|
2987
2983
|
if has_terminal?('[0-9]', true, index)
|
|
2988
|
-
r8 =
|
|
2984
|
+
r8 = true
|
|
2989
2985
|
@index += 1
|
|
2990
2986
|
else
|
|
2991
2987
|
r8 = nil
|
|
@@ -3034,7 +3030,7 @@ module Less
|
|
|
3034
3030
|
s12, i12 = [], index
|
|
3035
3031
|
loop do
|
|
3036
3032
|
if has_terminal?('[0-9]', true, index)
|
|
3037
|
-
r13 =
|
|
3033
|
+
r13 = true
|
|
3038
3034
|
@index += 1
|
|
3039
3035
|
else
|
|
3040
3036
|
r13 = nil
|
|
@@ -3347,7 +3343,7 @@ module Less
|
|
|
3347
3343
|
|
|
3348
3344
|
i0, s0 = index, []
|
|
3349
3345
|
if has_terminal?('[a-fA-F0-9]', true, index)
|
|
3350
|
-
r1 =
|
|
3346
|
+
r1 = true
|
|
3351
3347
|
@index += 1
|
|
3352
3348
|
else
|
|
3353
3349
|
r1 = nil
|
|
@@ -3355,7 +3351,7 @@ module Less
|
|
|
3355
3351
|
s0 << r1
|
|
3356
3352
|
if r1
|
|
3357
3353
|
if has_terminal?('[a-fA-F0-9]', true, index)
|
|
3358
|
-
r2 =
|
|
3354
|
+
r2 = true
|
|
3359
3355
|
@index += 1
|
|
3360
3356
|
else
|
|
3361
3357
|
r2 = nil
|
|
@@ -3365,7 +3361,7 @@ module Less
|
|
|
3365
3361
|
s3, i3 = [], index
|
|
3366
3362
|
loop do
|
|
3367
3363
|
if has_terminal?('[a-fA-F0-9]', true, index)
|
|
3368
|
-
r4 =
|
|
3364
|
+
r4 = true
|
|
3369
3365
|
@index += 1
|
|
3370
3366
|
else
|
|
3371
3367
|
r4 = nil
|
|
@@ -3428,7 +3424,7 @@ module Less
|
|
|
3428
3424
|
s1, i1 = [], index
|
|
3429
3425
|
loop do
|
|
3430
3426
|
if has_terminal?('[-a-zA-Z_]', true, index)
|
|
3431
|
-
r2 =
|
|
3427
|
+
r2 = true
|
|
3432
3428
|
@index += 1
|
|
3433
3429
|
else
|
|
3434
3430
|
r2 = nil
|
|
@@ -3650,7 +3646,7 @@ module Less
|
|
|
3650
3646
|
s7, i7 = [], index
|
|
3651
3647
|
loop do
|
|
3652
3648
|
if has_terminal?('[a-zA-Z]', true, index)
|
|
3653
|
-
r8 =
|
|
3649
|
+
r8 = true
|
|
3654
3650
|
@index += 1
|
|
3655
3651
|
else
|
|
3656
3652
|
r8 = nil
|
|
@@ -3716,7 +3712,7 @@ module Less
|
|
|
3716
3712
|
s0, i0 = [], index
|
|
3717
3713
|
loop do
|
|
3718
3714
|
if has_terminal?('[ ]', true, index)
|
|
3719
|
-
r1 =
|
|
3715
|
+
r1 = true
|
|
3720
3716
|
@index += 1
|
|
3721
3717
|
else
|
|
3722
3718
|
r1 = nil
|
|
@@ -3745,7 +3741,7 @@ module Less
|
|
|
3745
3741
|
s0, i0 = [], index
|
|
3746
3742
|
loop do
|
|
3747
3743
|
if has_terminal?('[ ]', true, index)
|
|
3748
|
-
r1 =
|
|
3744
|
+
r1 = true
|
|
3749
3745
|
@index += 1
|
|
3750
3746
|
else
|
|
3751
3747
|
r1 = nil
|
|
@@ -3779,7 +3775,7 @@ module Less
|
|
|
3779
3775
|
s0, i0 = [], index
|
|
3780
3776
|
loop do
|
|
3781
3777
|
if has_terminal?('[\\n ]', true, index)
|
|
3782
|
-
r1 =
|
|
3778
|
+
r1 = true
|
|
3783
3779
|
@index += 1
|
|
3784
3780
|
else
|
|
3785
3781
|
r1 = nil
|
|
@@ -3811,7 +3807,7 @@ module Less
|
|
|
3811
3807
|
i0, s0 = index, []
|
|
3812
3808
|
i1 = index
|
|
3813
3809
|
if has_terminal?('[ ;]', true, index)
|
|
3814
|
-
r2 =
|
|
3810
|
+
r2 = true
|
|
3815
3811
|
@index += 1
|
|
3816
3812
|
else
|
|
3817
3813
|
r2 = nil
|