csspool 0.2.5 → 0.2.6

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/CHANGELOG.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.2.6
2
+
3
+ * Fix comment greediness. [Seth Rasmussen]
4
+
1
5
  == 0.2.5
2
6
 
3
7
  * Accepting spaces after error rules.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "lib")
7
7
  GENERATED_PARSER = "lib/css/sac/generated_parser.rb"
8
8
  GENERATED_PROPERTY_PARSER = "lib/css/sac/generated_property_parser.rb"
9
9
 
10
- Hoe.new('csspool', "0.2.5") do |p|
10
+ Hoe.new('csspool', "0.2.6") do |p|
11
11
  p.rubyforge_name = 'csspool'
12
12
  p.author = 'Aaron Patterson'
13
13
  p.email = 'aaronp@rubyforge.org'
@@ -17,10 +17,10 @@ module CSS
17
17
 
18
18
  class GeneratedParser < Racc::Parser
19
19
 
20
- module_eval <<'..end lib/parser.y modeval..idf748a5688a', 'lib/parser.y', 307
20
+ module_eval <<'..end lib/parser.y modeval..id1128ccb808', 'lib/parser.y', 307
21
21
  include CSS::SAC::Conditions
22
22
  include CSS::SAC::Selectors
23
- ..end lib/parser.y modeval..idf748a5688a
23
+ ..end lib/parser.y modeval..id1128ccb808
24
24
 
25
25
  ##### racc 1.4.5 generates ###
26
26
 
@@ -14,7 +14,7 @@ module CSS
14
14
  module SAC
15
15
  class Parser < CSS::SAC::GeneratedParser
16
16
  # The version of CSSPool you're using
17
- VERSION = '0.2.5'
17
+ VERSION = '0.2.6'
18
18
 
19
19
  TOKENIZER = Tokenizer.new
20
20
 
@@ -119,8 +119,9 @@ module CSS
119
119
  tokens = []
120
120
  pos = 0
121
121
 
122
- comments = input_data.scan(/\/\*.*\*\//m)
123
- non_comments = input_data.split(/\/\*.*\*\//m)
122
+ comment_pattern = /\/\*.*?\*\//m
123
+ comments = input_data.scan(comment_pattern)
124
+ non_comments = input_data.split(comment_pattern)
124
125
 
125
126
  # Handle a small edge case, if our CSS is *only* comments,
126
127
  # the split, zip, scan trick won't work
@@ -117,4 +117,11 @@ class TokenizerTest < Test::Unit::TestCase
117
117
  count += 1
118
118
  end
119
119
  end
120
+
121
+ def test_comments_pattern_is_lazy
122
+ text = "/* * HAI * */ a {display:block} /* * BAI * */ em {font-style:normal}"
123
+ assert_tokens text,
124
+ :COMMENT, :IDENT, :LBRACE, :IDENT, :delim, [:IDENT, "block"], :delim,
125
+ :COMMENT, :IDENT, :LBRACE, :IDENT, :delim, [:IDENT, "normal"], :delim
126
+ end
120
127
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csspool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-09 00:00:00 -07:00
12
+ date: 2008-04-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  requirements: []
134
134
 
135
135
  rubyforge_project: csspool
136
- rubygems_version: 1.1.0
136
+ rubygems_version: 1.0.1
137
137
  signing_key:
138
138
  specification_version: 2
139
139
  summary: Parses CSS