oga 1.2.3-java → 1.3.0-java

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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/doc/css_selectors.md +1 -1
  3. data/lib/liboga.jar +0 -0
  4. data/lib/oga.rb +6 -1
  5. data/lib/oga/blacklist.rb +0 -10
  6. data/lib/oga/css/lexer.rb +530 -255
  7. data/lib/oga/css/parser.rb +232 -230
  8. data/lib/oga/entity_decoder.rb +0 -4
  9. data/lib/oga/html/entities.rb +0 -4
  10. data/lib/oga/html/parser.rb +0 -4
  11. data/lib/oga/html/sax_parser.rb +0 -4
  12. data/lib/oga/lru.rb +0 -26
  13. data/lib/oga/oga.rb +0 -8
  14. data/lib/oga/ruby/generator.rb +225 -0
  15. data/lib/oga/ruby/node.rb +189 -0
  16. data/lib/oga/version.rb +1 -1
  17. data/lib/oga/whitelist.rb +0 -6
  18. data/lib/oga/xml/attribute.rb +13 -20
  19. data/lib/oga/xml/cdata.rb +0 -4
  20. data/lib/oga/xml/character_node.rb +0 -8
  21. data/lib/oga/xml/comment.rb +0 -4
  22. data/lib/oga/xml/default_namespace.rb +0 -2
  23. data/lib/oga/xml/doctype.rb +0 -8
  24. data/lib/oga/xml/document.rb +10 -14
  25. data/lib/oga/xml/element.rb +1 -52
  26. data/lib/oga/xml/entities.rb +0 -26
  27. data/lib/oga/xml/expanded_name.rb +12 -0
  28. data/lib/oga/xml/html_void_elements.rb +0 -2
  29. data/lib/oga/xml/lexer.rb +0 -86
  30. data/lib/oga/xml/namespace.rb +0 -10
  31. data/lib/oga/xml/node.rb +18 -34
  32. data/lib/oga/xml/node_set.rb +0 -50
  33. data/lib/oga/xml/parser.rb +13 -50
  34. data/lib/oga/xml/processing_instruction.rb +0 -8
  35. data/lib/oga/xml/pull_parser.rb +0 -18
  36. data/lib/oga/xml/querying.rb +58 -19
  37. data/lib/oga/xml/sax_parser.rb +0 -18
  38. data/lib/oga/xml/text.rb +0 -12
  39. data/lib/oga/xml/traversal.rb +0 -4
  40. data/lib/oga/xml/xml_declaration.rb +0 -8
  41. data/lib/oga/xpath/compiler.rb +1568 -0
  42. data/lib/oga/xpath/conversion.rb +102 -0
  43. data/lib/oga/xpath/lexer.rb +1844 -1238
  44. data/lib/oga/xpath/parser.rb +182 -153
  45. metadata +7 -3
  46. data/lib/oga/xpath/evaluator.rb +0 -1800
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecc2ee704871348245514551a7d0438c6b9df1a3
4
- data.tar.gz: 13b7226f94f4a49f5dea21a5d65d7a22bf14ab7d
3
+ metadata.gz: b02ebf4182fe4de0d8b0fe875352a7f87300c19c
4
+ data.tar.gz: b190fec4be054b8acb23ba2b4e8b3d212a066ad7
5
5
  SHA512:
6
- metadata.gz: 43c266a0b1fcac304f462e8cbe9f347badcd463a2024366cf2369573ce2807f633a1e9ca0494bf63bfd46092b682842568e7321c7a66802a9aed48b824626960
7
- data.tar.gz: b67b963872f590d85bf1c3a1582b809d043bd318d304d771e436bd8fcc34553a7fef39a7b53d67a8128c61cd60c51295429bcd3e9248b43df98fd07df385b63c
6
+ metadata.gz: 096867f90ece07e4e6aa55d92074a3f5bcfe6626fb652b0f43f5955b0712dd27a7636630b3c003336222f61a5105b3e49a2538ec403be4f23927593895d96d0f
7
+ data.tar.gz: 939678d51de4fe44eda8dada5d8b6e48a6cddb5b5f76b796501eb0c3dc643bae8a664b8cfe5a85c16194517cde982f22160995e79532f59a5a96ee92e7ae4d66
@@ -364,7 +364,7 @@ numbers="1 2 3" />` but _not_ the element `<foo numbers="2 3 1" />`.
364
364
  The corresponding XPath expression is quite complex due to a lack of a
365
365
  `ends-with` function in XPath. Instead one has to resort to using the
366
366
  `substring()` function. As such the corresponding XPath expression for
367
- `foo[bar="baz"]` is as following:
367
+ `foo[bar$="baz"]` is as following:
368
368
 
369
369
  foo[substring(@bar, string-length(@bar) - string-length("baz") + 1, string-length("baz")) = "baz"]
370
370
 
Binary file
data/lib/oga.rb CHANGED
@@ -27,6 +27,7 @@ require 'oga/xml/html_void_elements'
27
27
  require 'oga/xml/entities'
28
28
  require 'oga/xml/querying'
29
29
  require 'oga/xml/traversal'
30
+ require 'oga/xml/expanded_name'
30
31
  require 'oga/xml/node'
31
32
  require 'oga/xml/document'
32
33
  require 'oga/xml/character_node'
@@ -49,9 +50,13 @@ require 'oga/html/parser'
49
50
  require 'oga/html/sax_parser'
50
51
  require 'oga/html/entities'
51
52
 
53
+ require 'oga/ruby/node'
54
+ require 'oga/ruby/generator'
55
+
52
56
  require 'oga/xpath/lexer'
53
57
  require 'oga/xpath/parser'
54
- require 'oga/xpath/evaluator'
58
+ require 'oga/xpath/compiler'
59
+ require 'oga/xpath/conversion'
55
60
 
56
61
  require 'oga/css/lexer'
57
62
  require 'oga/css/parser'
@@ -1,38 +1,28 @@
1
1
  module Oga
2
- ##
3
2
  # @api private
4
- #
5
3
  class Blacklist
6
4
  # @return [Set]
7
5
  attr_reader :names
8
6
 
9
- ##
10
7
  # @param [Array] names
11
- #
12
8
  def initialize(names)
13
9
  @names = Set.new(names + names.map(&:upcase))
14
10
  end
15
11
 
16
- ##
17
12
  # @yieldparam [String]
18
- #
19
13
  def each
20
14
  names.each do |value|
21
15
  yield value
22
16
  end
23
17
  end
24
18
 
25
- ##
26
19
  # @return [TrueClass|FalseClass]
27
- #
28
20
  def allow?(name)
29
21
  !names.include?(name)
30
22
  end
31
23
 
32
- ##
33
24
  # @param [Oga::Blacklist] other
34
25
  # @return [Oga::Blacklist]
35
- #
36
26
  def +(other)
37
27
  self.class.new(names + other.names)
38
28
  end
@@ -4,7 +4,6 @@
4
4
  # line 3 "lib/oga/css/lexer.rl"
5
5
  module Oga
6
6
  module CSS
7
- ##
8
7
  # Lexer for turning CSS expressions into a sequence of tokens. Tokens are
9
8
  # returned as arrays with every array having two values:
10
9
  #
@@ -19,28 +18,30 @@ module Oga
19
18
  # instances in threads just fine.
20
19
  #
21
20
  # @api private
22
- #
23
21
  class Lexer
24
22
 
25
- # line 26 "lib/oga/css/lexer.rb"
23
+ # line 24 "lib/oga/css/lexer.rb"
26
24
  class << self
27
25
  attr_accessor :_css_lexer_trans_keys
28
26
  private :_css_lexer_trans_keys, :_css_lexer_trans_keys=
29
27
  end
30
28
  self._css_lexer_trans_keys = [
31
- 0, 0, 43, 57, 118, 118,
32
- 101, 101, 110, 110, 100,
33
- 100, 100, 100, 34, 34,
34
- 61, 61, 39, 39, 61, 61,
35
- 61, 61, 61, 61, 9,
36
- 126, 9, 44, 9, 32,
37
- 0, 0, 9, 32, 0, 0,
38
- 0, 0, 9, 32, 45,
39
- 122, 9, 32, 9, 122,
40
- 9, 32, 48, 57, 43, 57,
41
- 45, 122, 9, 126, 9,
42
- 32, 61, 61, 45, 122,
43
- 0
29
+ 0, 0, 46, 46, 46, 46,
30
+ 43, 57, 118, 118, 101,
31
+ 101, 110, 110, 100, 100,
32
+ 100, 100, 46, 46, 34, 34,
33
+ 61, 61, 39, 39, 61,
34
+ 61, 61, 61, 61, 61,
35
+ 0, 127, 0, 127, 0, 127,
36
+ 9, 126, 9, 32, 9,
37
+ 32, 9, 32, 9, 32,
38
+ 0, 0, 0, 0, 0, 0,
39
+ 0, 127, 0, 127, 0,
40
+ 127, 9, 32, 0, 0,
41
+ 48, 57, 43, 57, 0, 0,
42
+ 0, 0, 0, 127, 0,
43
+ 127, 0, 127, 9, 32,
44
+ 61, 61, 0
44
45
  ]
45
46
 
46
47
  class << self
@@ -48,10 +49,12 @@ class << self
48
49
  private :_css_lexer_key_spans, :_css_lexer_key_spans=
49
50
  end
50
51
  self._css_lexer_key_spans = [
51
- 0, 15, 1, 1, 1, 1, 1, 1,
52
- 1, 1, 1, 1, 1, 118, 36, 24,
53
- 0, 24, 0, 0, 24, 78, 24, 114,
54
- 24, 10, 15, 78, 118, 24, 1, 78
52
+ 0, 1, 1, 15, 1, 1, 1, 1,
53
+ 1, 1, 1, 1, 1, 1, 1, 1,
54
+ 128, 128, 128, 118, 24, 24, 24, 24,
55
+ 0, 0, 0, 128, 128, 128, 24, 0,
56
+ 10, 15, 0, 0, 128, 128, 128, 24,
57
+ 1
55
58
  ]
56
59
 
57
60
  class << self
@@ -59,10 +62,12 @@ class << self
59
62
  private :_css_lexer_index_offsets, :_css_lexer_index_offsets=
60
63
  end
61
64
  self._css_lexer_index_offsets = [
62
- 0, 0, 16, 18, 20, 22, 24, 26,
63
- 28, 30, 32, 34, 36, 38, 157, 194,
64
- 219, 220, 245, 246, 247, 272, 351, 376,
65
- 491, 516, 527, 543, 622, 741, 766, 768
65
+ 0, 0, 2, 4, 20, 22, 24, 26,
66
+ 28, 30, 32, 34, 36, 38, 40, 42,
67
+ 44, 173, 302, 431, 550, 575, 600, 625,
68
+ 650, 651, 652, 653, 782, 911, 1040, 1065,
69
+ 1066, 1077, 1093, 1094, 1095, 1224, 1353, 1482,
70
+ 1507
66
71
  ]
67
72
 
68
73
  class << self
@@ -70,112 +75,195 @@ class << self
70
75
  private :_css_lexer_indicies, :_css_lexer_indicies=
71
76
  end
72
77
  self._css_lexer_indicies = [
73
- 1, 0, 1, 0, 0, 2, 2, 2,
74
- 2, 2, 2, 2, 2, 2, 2, 0,
75
- 3, 4, 5, 4, 6, 4, 7, 4,
76
- 8, 4, 10, 9, 11, 4, 10, 12,
77
- 13, 4, 14, 4, 15, 4, 17, 16,
78
- 16, 16, 16, 16, 16, 16, 16, 16,
79
- 16, 16, 16, 16, 16, 16, 16, 16,
80
- 16, 16, 16, 16, 16, 17, 16, 16,
81
- 18, 16, 16, 16, 16, 19, 16, 20,
82
- 21, 22, 16, 23, 16, 16, 16, 16,
83
- 16, 16, 16, 16, 16, 16, 16, 24,
84
- 16, 16, 16, 25, 16, 16, 26, 26,
85
- 26, 26, 26, 26, 26, 26, 26, 26,
86
- 26, 26, 26, 26, 26, 26, 26, 26,
87
- 26, 26, 26, 26, 26, 26, 26, 26,
88
- 27, 16, 16, 16, 26, 16, 26, 26,
89
- 26, 26, 26, 26, 26, 26, 26, 26,
90
- 26, 26, 26, 26, 26, 26, 26, 26,
91
- 26, 26, 26, 26, 26, 26, 26, 26,
92
- 16, 28, 16, 29, 16, 17, 30, 30,
93
- 30, 30, 30, 30, 30, 30, 30, 30,
94
- 30, 30, 30, 30, 30, 30, 30, 30,
95
- 30, 30, 30, 30, 17, 30, 30, 30,
96
- 30, 30, 30, 30, 30, 30, 30, 30,
97
- 22, 30, 22, 31, 31, 31, 31, 31,
98
- 31, 31, 31, 31, 31, 31, 31, 31,
99
- 31, 31, 31, 31, 31, 31, 31, 31,
100
- 31, 22, 31, 32, 21, 33, 33, 33,
101
- 33, 33, 33, 33, 33, 33, 33, 33,
102
- 33, 33, 33, 33, 33, 33, 33, 33,
103
- 33, 33, 33, 21, 33, 34, 35, 25,
78
+ 1, 0, 3, 2, 5, 4, 5, 4,
79
+ 4, 6, 6, 6, 6, 6, 6, 6,
80
+ 6, 6, 6, 4, 7, 8, 9, 8,
81
+ 10, 8, 11, 8, 12, 8, 14, 13,
82
+ 16, 15, 17, 8, 16, 18, 19, 8,
83
+ 20, 8, 21, 8, 23, 23, 23, 23,
84
+ 23, 23, 23, 23, 23, 24, 23, 23,
85
+ 23, 23, 23, 23, 23, 23, 23, 23,
86
+ 23, 23, 23, 23, 23, 23, 23, 23,
87
+ 23, 23, 23, 23, 24, 23, 23, 25,
88
+ 23, 23, 23, 23, 26, 23, 27, 28,
89
+ 29, 23, 30, 23, 23, 23, 23, 23,
90
+ 23, 23, 23, 23, 23, 23, 31, 23,
91
+ 23, 23, 32, 23, 23, 22, 22, 22,
92
+ 22, 22, 22, 22, 22, 22, 22, 22,
93
+ 22, 22, 22, 22, 22, 22, 22, 22,
94
+ 22, 22, 22, 22, 22, 22, 22, 33,
95
+ 23, 23, 23, 22, 23, 22, 22, 22,
96
+ 22, 22, 22, 22, 22, 22, 22, 22,
97
+ 22, 22, 22, 22, 22, 22, 22, 22,
98
+ 22, 22, 22, 22, 22, 22, 22, 23,
99
+ 34, 23, 35, 23, 22, 36, 36, 36,
100
+ 36, 36, 36, 36, 36, 36, 36, 36,
101
+ 36, 36, 36, 36, 36, 36, 36, 36,
104
102
  36, 36, 36, 36, 36, 36, 36, 36,
105
103
  36, 36, 36, 36, 36, 36, 36, 36,
106
- 36, 36, 36, 36, 36, 36, 25, 36,
107
- 26, 37, 37, 26, 26, 26, 26, 26,
108
- 26, 26, 26, 26, 26, 37, 37, 37,
109
- 37, 37, 37, 37, 26, 26, 26, 26,
110
- 26, 26, 26, 26, 26, 26, 26, 26,
111
- 26, 26, 26, 26, 26, 26, 26, 26,
112
- 26, 26, 26, 26, 26, 26, 37, 37,
113
- 37, 37, 26, 37, 26, 26, 26, 26,
114
- 26, 26, 26, 26, 26, 26, 26, 26,
115
- 26, 26, 26, 26, 26, 26, 26, 26,
116
- 26, 26, 26, 26, 26, 26, 37, 29,
104
+ 36, 36, 36, 36, 36, 36, 36, 36,
105
+ 36, 36, 22, 36, 36, 22, 22, 22,
106
+ 22, 22, 22, 22, 22, 22, 22, 36,
107
+ 36, 36, 36, 36, 36, 36, 22, 22,
108
+ 22, 22, 22, 22, 22, 22, 22, 22,
109
+ 22, 22, 22, 22, 22, 22, 22, 22,
110
+ 22, 22, 22, 22, 22, 22, 22, 22,
111
+ 36, 37, 36, 36, 22, 36, 22, 22,
112
+ 22, 22, 22, 22, 22, 22, 22, 22,
113
+ 22, 22, 22, 22, 22, 22, 22, 22,
114
+ 22, 22, 22, 22, 22, 22, 22, 22,
115
+ 36, 36, 36, 36, 36, 22, 38, 38,
117
116
  38, 38, 38, 38, 38, 38, 38, 38,
118
117
  38, 38, 38, 38, 38, 38, 38, 38,
119
- 38, 38, 38, 38, 38, 38, 29, 38,
120
- 39, 4, 4, 4, 4, 4, 4, 4,
121
- 4, 4, 4, 4, 4, 4, 4, 4,
122
- 4, 4, 4, 4, 4, 4, 4, 39,
123
- 4, 4, 4, 4, 4, 4, 4, 4,
124
- 40, 41, 1, 4, 42, 4, 4, 2,
125
- 2, 2, 2, 2, 2, 2, 2, 2,
126
- 2, 4, 4, 4, 4, 4, 4, 4,
127
- 43, 43, 43, 43, 43, 43, 43, 43,
128
- 43, 43, 43, 43, 43, 43, 43, 43,
129
- 43, 43, 43, 43, 43, 43, 43, 43,
130
- 43, 43, 4, 4, 4, 4, 43, 4,
131
- 43, 43, 43, 43, 44, 43, 43, 43,
132
- 43, 43, 43, 43, 43, 45, 46, 43,
133
- 43, 43, 43, 43, 43, 43, 43, 43,
134
- 43, 43, 4, 39, 47, 47, 47, 47,
135
- 47, 47, 47, 47, 47, 47, 47, 47,
136
- 47, 47, 47, 47, 47, 47, 47, 47,
137
- 47, 47, 39, 47, 2, 2, 2, 2,
138
- 2, 2, 2, 2, 2, 2, 48, 1,
139
- 49, 1, 49, 49, 2, 2, 2, 2,
140
- 2, 2, 2, 2, 2, 2, 49, 43,
141
- 50, 50, 43, 43, 43, 43, 43, 43,
142
- 43, 43, 43, 43, 50, 50, 50, 50,
143
- 50, 50, 50, 43, 43, 43, 43, 43,
144
- 43, 43, 43, 43, 43, 43, 43, 43,
145
- 43, 43, 43, 43, 43, 43, 43, 43,
146
- 43, 43, 43, 43, 43, 50, 50, 50,
147
- 50, 43, 50, 43, 43, 43, 43, 43,
118
+ 38, 38, 38, 38, 38, 38, 38, 38,
119
+ 38, 38, 38, 38, 38, 38, 38, 38,
120
+ 38, 38, 38, 38, 38, 38, 38, 38,
121
+ 38, 38, 38, 39, 38, 38, 39, 39,
122
+ 39, 39, 39, 39, 39, 39, 39, 39,
123
+ 38, 38, 38, 38, 38, 38, 38, 39,
124
+ 39, 39, 39, 39, 39, 39, 39, 39,
125
+ 39, 39, 39, 39, 39, 39, 39, 39,
126
+ 39, 39, 39, 39, 39, 39, 39, 39,
127
+ 39, 38, 40, 38, 38, 39, 38, 39,
128
+ 39, 39, 39, 39, 39, 39, 39, 39,
129
+ 39, 39, 39, 39, 39, 39, 39, 39,
130
+ 39, 39, 39, 39, 39, 39, 39, 39,
131
+ 39, 38, 38, 38, 38, 38, 39, 24,
132
+ 41, 41, 41, 41, 41, 41, 41, 41,
133
+ 41, 41, 41, 41, 41, 41, 41, 41,
134
+ 41, 41, 41, 41, 41, 41, 24, 41,
135
+ 41, 41, 41, 41, 41, 41, 41, 41,
136
+ 41, 28, 29, 41, 41, 41, 41, 41,
137
+ 41, 41, 41, 41, 41, 41, 41, 41,
138
+ 41, 41, 41, 41, 32, 41, 41, 41,
139
+ 41, 41, 41, 41, 41, 41, 41, 41,
140
+ 41, 41, 41, 41, 41, 41, 41, 41,
141
+ 41, 41, 41, 41, 41, 41, 41, 41,
142
+ 41, 41, 41, 41, 41, 41, 41, 41,
143
+ 41, 41, 41, 41, 41, 41, 41, 41,
144
+ 41, 41, 41, 41, 41, 41, 41, 41,
145
+ 41, 41, 41, 41, 41, 41, 41, 41,
146
+ 41, 41, 41, 41, 35, 41, 28, 42,
147
+ 42, 42, 42, 42, 42, 42, 42, 42,
148
+ 42, 42, 42, 42, 42, 42, 42, 42,
149
+ 42, 42, 42, 42, 42, 28, 42, 29,
148
150
  43, 43, 43, 43, 43, 43, 43, 43,
149
151
  43, 43, 43, 43, 43, 43, 43, 43,
150
- 43, 43, 43, 43, 43, 50, 51, 4,
151
- 4, 4, 4, 4, 4, 4, 4, 4,
152
- 4, 4, 4, 4, 4, 4, 4, 4,
153
- 4, 4, 4, 4, 4, 51, 4, 9,
154
- 4, 52, 4, 4, 12, 4, 4, 53,
155
- 4, 4, 4, 4, 4, 4, 4, 4,
156
- 4, 4, 4, 4, 4, 4, 4, 4,
157
- 4, 4, 54, 4, 4, 4, 55, 55,
158
- 55, 55, 55, 55, 55, 55, 55, 55,
159
- 55, 55, 55, 55, 55, 55, 55, 55,
160
- 55, 55, 55, 55, 55, 55, 55, 55,
161
- 4, 4, 56, 57, 55, 4, 55, 55,
162
- 55, 55, 55, 55, 55, 55, 55, 55,
163
- 55, 55, 55, 55, 55, 55, 55, 55,
164
- 55, 55, 55, 55, 55, 55, 55, 55,
165
- 4, 58, 4, 59, 4, 51, 60, 60,
152
+ 43, 43, 43, 43, 43, 43, 29, 43,
153
+ 32, 44, 44, 44, 44, 44, 44, 44,
154
+ 44, 44, 44, 44, 44, 44, 44, 44,
155
+ 44, 44, 44, 44, 44, 44, 44, 32,
156
+ 44, 35, 45, 45, 45, 45, 45, 45,
157
+ 45, 45, 45, 45, 45, 45, 45, 45,
158
+ 45, 45, 45, 45, 45, 45, 45, 45,
159
+ 35, 45, 46, 47, 48, 8, 8, 8,
160
+ 8, 8, 8, 8, 8, 8, 50, 8,
161
+ 8, 8, 8, 8, 8, 8, 8, 8,
162
+ 8, 8, 8, 8, 8, 8, 8, 8,
163
+ 8, 8, 8, 8, 8, 50, 8, 8,
164
+ 51, 8, 8, 8, 8, 8, 52, 53,
165
+ 5, 8, 54, 55, 8, 6, 6, 6,
166
+ 6, 6, 6, 6, 6, 6, 6, 56,
167
+ 8, 8, 8, 8, 8, 8, 49, 49,
168
+ 49, 49, 49, 49, 49, 49, 49, 49,
169
+ 49, 49, 49, 49, 49, 49, 49, 49,
170
+ 49, 49, 49, 49, 49, 49, 49, 49,
171
+ 8, 8, 8, 8, 49, 8, 49, 49,
172
+ 49, 49, 57, 49, 49, 49, 49, 49,
173
+ 49, 49, 49, 58, 59, 49, 49, 49,
174
+ 49, 49, 49, 49, 49, 49, 49, 49,
175
+ 8, 8, 8, 8, 8, 49, 60, 60,
166
176
  60, 60, 60, 60, 60, 60, 60, 60,
167
177
  60, 60, 60, 60, 60, 60, 60, 60,
168
- 60, 60, 60, 60, 51, 60, 62, 61,
169
- 55, 61, 61, 55, 55, 55, 55, 55,
170
- 55, 55, 55, 55, 55, 61, 61, 61,
171
- 61, 61, 61, 61, 55, 55, 55, 55,
172
- 55, 55, 55, 55, 55, 55, 55, 55,
173
- 55, 55, 55, 55, 55, 55, 55, 55,
174
- 55, 55, 55, 55, 55, 55, 61, 61,
175
- 61, 61, 55, 61, 55, 55, 55, 55,
176
- 55, 55, 55, 55, 55, 55, 55, 55,
177
- 55, 55, 55, 55, 55, 55, 55, 55,
178
- 55, 55, 55, 55, 55, 55, 61, 0
178
+ 60, 60, 60, 60, 60, 60, 60, 60,
179
+ 60, 60, 60, 60, 60, 60, 60, 60,
180
+ 60, 60, 60, 60, 60, 60, 60, 60,
181
+ 60, 60, 60, 49, 60, 60, 49, 49,
182
+ 49, 49, 49, 49, 49, 49, 49, 49,
183
+ 60, 60, 60, 60, 60, 60, 60, 49,
184
+ 49, 49, 49, 49, 49, 49, 49, 49,
185
+ 49, 49, 49, 49, 49, 49, 49, 49,
186
+ 49, 49, 49, 49, 49, 49, 49, 49,
187
+ 49, 60, 61, 60, 60, 49, 60, 49,
188
+ 49, 49, 49, 49, 49, 49, 49, 49,
189
+ 49, 49, 49, 49, 49, 49, 49, 49,
190
+ 49, 49, 49, 49, 49, 49, 49, 49,
191
+ 49, 60, 60, 60, 60, 60, 49, 62,
192
+ 62, 62, 62, 62, 62, 62, 62, 62,
193
+ 62, 62, 62, 62, 62, 62, 62, 62,
194
+ 62, 62, 62, 62, 62, 62, 62, 62,
195
+ 62, 62, 62, 62, 62, 62, 62, 62,
196
+ 62, 62, 62, 62, 62, 62, 62, 62,
197
+ 62, 62, 62, 62, 63, 62, 62, 63,
198
+ 63, 63, 63, 63, 63, 63, 63, 63,
199
+ 63, 62, 62, 62, 62, 62, 62, 62,
200
+ 63, 63, 63, 63, 63, 63, 63, 63,
201
+ 63, 63, 63, 63, 63, 63, 63, 63,
202
+ 63, 63, 63, 63, 63, 63, 63, 63,
203
+ 63, 63, 62, 64, 62, 62, 63, 62,
204
+ 63, 63, 63, 63, 63, 63, 63, 63,
205
+ 63, 63, 63, 63, 63, 63, 63, 63,
206
+ 63, 63, 63, 63, 63, 63, 63, 63,
207
+ 63, 63, 62, 62, 62, 62, 62, 63,
208
+ 50, 65, 65, 65, 65, 65, 65, 65,
209
+ 65, 65, 65, 65, 65, 65, 65, 65,
210
+ 65, 65, 65, 65, 65, 65, 65, 50,
211
+ 65, 66, 6, 6, 6, 6, 6, 6,
212
+ 6, 6, 6, 6, 67, 5, 68, 5,
213
+ 68, 68, 6, 6, 6, 6, 6, 6,
214
+ 6, 6, 6, 6, 68, 69, 70, 8,
215
+ 8, 8, 8, 8, 8, 8, 8, 8,
216
+ 72, 8, 8, 8, 8, 8, 8, 8,
217
+ 8, 8, 8, 8, 8, 8, 8, 8,
218
+ 8, 8, 8, 8, 8, 8, 8, 72,
219
+ 8, 15, 8, 73, 8, 8, 18, 8,
220
+ 8, 74, 8, 8, 8, 8, 8, 8,
221
+ 8, 8, 8, 8, 8, 8, 8, 8,
222
+ 8, 8, 8, 8, 75, 8, 8, 8,
223
+ 71, 71, 71, 71, 71, 71, 71, 71,
224
+ 71, 71, 71, 71, 71, 71, 71, 71,
225
+ 71, 71, 71, 71, 71, 71, 71, 71,
226
+ 71, 71, 8, 8, 76, 77, 71, 8,
227
+ 71, 71, 71, 71, 71, 71, 71, 71,
228
+ 71, 71, 71, 71, 71, 71, 71, 71,
229
+ 71, 71, 71, 71, 71, 71, 71, 71,
230
+ 71, 71, 8, 78, 8, 79, 8, 71,
231
+ 80, 80, 80, 80, 80, 80, 80, 80,
232
+ 80, 80, 80, 80, 80, 80, 80, 80,
233
+ 80, 80, 80, 80, 80, 80, 80, 80,
234
+ 80, 80, 80, 80, 80, 80, 80, 80,
235
+ 80, 80, 80, 80, 80, 80, 80, 80,
236
+ 80, 80, 80, 80, 80, 71, 80, 80,
237
+ 71, 71, 71, 71, 71, 71, 71, 71,
238
+ 71, 71, 80, 80, 80, 80, 80, 80,
239
+ 80, 71, 71, 71, 71, 71, 71, 71,
240
+ 71, 71, 71, 71, 71, 71, 71, 71,
241
+ 71, 71, 71, 71, 71, 71, 71, 71,
242
+ 71, 71, 71, 80, 81, 80, 80, 71,
243
+ 80, 71, 71, 71, 71, 71, 71, 71,
244
+ 71, 71, 71, 71, 71, 71, 71, 71,
245
+ 71, 71, 71, 71, 71, 71, 71, 71,
246
+ 71, 71, 71, 80, 80, 80, 80, 80,
247
+ 71, 82, 82, 82, 82, 82, 82, 82,
248
+ 82, 82, 82, 82, 82, 82, 82, 82,
249
+ 82, 82, 82, 82, 82, 82, 82, 82,
250
+ 82, 82, 82, 82, 82, 82, 82, 82,
251
+ 82, 82, 82, 82, 82, 82, 82, 82,
252
+ 82, 82, 82, 82, 82, 82, 83, 82,
253
+ 82, 83, 83, 83, 83, 83, 83, 83,
254
+ 83, 83, 83, 82, 82, 82, 82, 82,
255
+ 82, 82, 83, 83, 83, 83, 83, 83,
256
+ 83, 83, 83, 83, 83, 83, 83, 83,
257
+ 83, 83, 83, 83, 83, 83, 83, 83,
258
+ 83, 83, 83, 83, 82, 84, 82, 82,
259
+ 83, 82, 83, 83, 83, 83, 83, 83,
260
+ 83, 83, 83, 83, 83, 83, 83, 83,
261
+ 83, 83, 83, 83, 83, 83, 83, 83,
262
+ 83, 83, 83, 83, 82, 82, 82, 82,
263
+ 82, 83, 72, 85, 85, 85, 85, 85,
264
+ 85, 85, 85, 85, 85, 85, 85, 85,
265
+ 85, 85, 85, 85, 85, 85, 85, 85,
266
+ 85, 72, 85, 86, 80, 0
179
267
  ]
180
268
 
181
269
  class << self
@@ -183,14 +271,17 @@ class << self
183
271
  private :_css_lexer_trans_targs, :_css_lexer_trans_targs=
184
272
  end
185
273
  self._css_lexer_trans_targs = [
186
- 23, 1, 25, 3, 0, 4, 23, 6,
187
- 23, 7, 28, 28, 9, 28, 28, 28,
188
- 13, 14, 16, 13, 13, 17, 15, 18,
189
- 19, 20, 21, 13, 13, 22, 13, 13,
190
- 13, 13, 13, 13, 13, 13, 13, 24,
191
- 23, 23, 26, 27, 2, 23, 5, 23,
192
- 23, 23, 23, 29, 8, 30, 28, 31,
193
- 28, 10, 11, 12, 28, 28, 28
274
+ 16, 18, 27, 29, 27, 3, 32, 5,
275
+ 0, 6, 27, 8, 27, 36, 38, 10,
276
+ 36, 36, 12, 36, 36, 36, 17, 16,
277
+ 19, 24, 16, 16, 20, 21, 25, 26,
278
+ 22, 16, 16, 23, 16, 1, 16, 17,
279
+ 1, 16, 16, 16, 16, 16, 16, 16,
280
+ 16, 28, 30, 31, 27, 27, 33, 34,
281
+ 35, 4, 27, 7, 27, 2, 27, 28,
282
+ 2, 27, 27, 27, 27, 27, 27, 37,
283
+ 39, 11, 40, 36, 36, 13, 14, 15,
284
+ 36, 9, 36, 37, 9, 36, 36
194
285
  ]
195
286
 
196
287
  class << self
@@ -198,14 +289,17 @@ class << self
198
289
  private :_css_lexer_trans_actions, :_css_lexer_trans_actions=
199
290
  end
200
291
  self._css_lexer_trans_actions = [
201
- 1, 0, 0, 0, 0, 0, 2, 0,
202
- 3, 0, 4, 5, 0, 6, 7, 8,
203
- 11, 0, 0, 12, 13, 0, 0, 0,
204
- 0, 0, 0, 14, 15, 0, 16, 17,
205
- 18, 19, 20, 21, 22, 23, 24, 0,
206
- 26, 27, 28, 0, 0, 29, 0, 30,
207
- 31, 32, 33, 0, 0, 0, 34, 0,
208
- 35, 0, 0, 0, 36, 37, 38
292
+ 1, 2, 3, 2, 4, 0, 0, 0,
293
+ 0, 0, 5, 0, 6, 7, 2, 0,
294
+ 8, 9, 0, 10, 11, 12, 2, 15,
295
+ 0, 0, 16, 17, 0, 0, 0, 0,
296
+ 0, 18, 19, 0, 20, 0, 21, 22,
297
+ 23, 24, 25, 26, 27, 28, 29, 30,
298
+ 31, 2, 0, 0, 33, 34, 35, 0,
299
+ 0, 0, 36, 0, 37, 0, 38, 22,
300
+ 23, 39, 40, 41, 42, 43, 44, 2,
301
+ 0, 0, 0, 45, 46, 0, 0, 0,
302
+ 47, 0, 48, 22, 23, 49, 50
209
303
  ]
210
304
 
211
305
  class << self
@@ -214,9 +308,11 @@ class << self
214
308
  end
215
309
  self._css_lexer_to_state_actions = [
216
310
  0, 0, 0, 0, 0, 0, 0, 0,
217
- 0, 0, 0, 0, 0, 9, 0, 0,
218
- 0, 0, 0, 0, 0, 0, 0, 25,
219
- 0, 0, 0, 0, 9, 0, 0, 0
311
+ 0, 0, 0, 0, 0, 0, 0, 0,
312
+ 13, 0, 0, 0, 0, 0, 0, 0,
313
+ 0, 0, 0, 32, 0, 0, 0, 0,
314
+ 0, 0, 0, 0, 13, 0, 0, 0,
315
+ 0
220
316
  ]
221
317
 
222
318
  class << self
@@ -225,9 +321,11 @@ class << self
225
321
  end
226
322
  self._css_lexer_from_state_actions = [
227
323
  0, 0, 0, 0, 0, 0, 0, 0,
228
- 0, 0, 0, 0, 0, 10, 0, 0,
229
- 0, 0, 0, 0, 0, 0, 0, 10,
230
- 0, 0, 0, 0, 10, 0, 0, 0
324
+ 0, 0, 0, 0, 0, 0, 0, 0,
325
+ 14, 0, 0, 0, 0, 0, 0, 0,
326
+ 0, 0, 0, 14, 0, 0, 0, 0,
327
+ 0, 0, 0, 0, 14, 0, 0, 0,
328
+ 0
231
329
  ]
232
330
 
233
331
  class << self
@@ -235,20 +333,22 @@ class << self
235
333
  private :_css_lexer_eof_trans, :_css_lexer_eof_trans=
236
334
  end
237
335
  self._css_lexer_eof_trans = [
238
- 0, 1, 0, 0, 0, 0, 0, 0,
239
- 0, 0, 0, 0, 0, 0, 31, 32,
240
- 33, 34, 35, 36, 37, 38, 39, 0,
241
- 48, 49, 50, 51, 0, 61, 62, 62
336
+ 0, 1, 3, 5, 0, 0, 0, 0,
337
+ 0, 14, 0, 0, 0, 0, 0, 0,
338
+ 0, 37, 39, 42, 43, 44, 45, 46,
339
+ 47, 48, 49, 0, 61, 63, 66, 67,
340
+ 68, 69, 70, 71, 0, 81, 83, 86,
341
+ 81
242
342
  ]
243
343
 
244
344
  class << self
245
345
  attr_accessor :css_lexer_start
246
346
  end
247
- self.css_lexer_start = 13;
347
+ self.css_lexer_start = 16;
248
348
  class << self
249
349
  attr_accessor :css_lexer_first_final
250
350
  end
251
- self.css_lexer_first_final = 13;
351
+ self.css_lexer_first_final = 16;
252
352
  class << self
253
353
  attr_accessor :css_lexer_error
254
354
  end
@@ -257,34 +357,30 @@ self.css_lexer_error = 0;
257
357
  class << self
258
358
  attr_accessor :css_lexer_en_pseudo_args
259
359
  end
260
- self.css_lexer_en_pseudo_args = 23;
360
+ self.css_lexer_en_pseudo_args = 27;
261
361
  class << self
262
362
  attr_accessor :css_lexer_en_predicate
263
363
  end
264
- self.css_lexer_en_predicate = 28;
364
+ self.css_lexer_en_predicate = 36;
265
365
  class << self
266
366
  attr_accessor :css_lexer_en_main
267
367
  end
268
- self.css_lexer_en_main = 13;
368
+ self.css_lexer_en_main = 16;
269
369
 
270
370
 
271
- # line 23 "lib/oga/css/lexer.rl"
371
+ # line 21 "lib/oga/css/lexer.rl"
272
372
 
273
373
  # % fix highlight
274
374
 
275
- ##
276
375
  # @param [String] data The data to lex.
277
- #
278
376
  def initialize(data)
279
377
  @data = data
280
378
  end
281
379
 
282
- ##
283
380
  # Gathers all the tokens for the input and returns them as an Array.
284
381
  #
285
382
  # @see [#advance]
286
383
  # @return [Array]
287
- #
288
384
  def lex
289
385
  tokens = []
290
386
 
@@ -295,7 +391,6 @@ self.css_lexer_en_main = 13;
295
391
  return tokens
296
392
  end
297
393
 
298
- ##
299
394
  # Advances through the input and generates the corresponding tokens. Each
300
395
  # token is yielded to the supplied block.
301
396
  #
@@ -303,9 +398,9 @@ self.css_lexer_en_main = 13;
303
398
  # the lexer loop has finished.
304
399
  #
305
400
  # @see [#add_token]
306
- #
307
401
  def advance(&block)
308
- @block = block
402
+ @block = block
403
+ @escaped = false
309
404
 
310
405
  data = @data # saves ivar lookups while lexing.
311
406
  ts = nil
@@ -329,7 +424,7 @@ self.css_lexer_en_main = 13;
329
424
  _css_lexer_trans_targs = self.class.send(:_css_lexer_trans_targs)
330
425
 
331
426
 
332
- # line 333 "lib/oga/css/lexer.rb"
427
+ # line 428 "lib/oga/css/lexer.rb"
333
428
  begin
334
429
  testEof = false
335
430
  _slen, _trans, _keys, _inds, _acts, _nacts = nil
@@ -352,12 +447,12 @@ begin
352
447
  end
353
448
  if _goto_level <= _resume
354
449
  case _css_lexer_from_state_actions[cs]
355
- when 10 then
450
+ when 14 then
356
451
  # line 1 "NONE"
357
452
  begin
358
453
  ts = p
359
454
  end
360
- # line 361 "lib/oga/css/lexer.rb"
455
+ # line 456 "lib/oga/css/lexer.rb"
361
456
  end
362
457
  _keys = cs << 1
363
458
  _inds = _css_lexer_index_offsets[cs]
@@ -376,55 +471,72 @@ ts = p
376
471
  cs = _css_lexer_trans_targs[_trans]
377
472
  if _css_lexer_trans_actions[_trans] != 0
378
473
  case _css_lexer_trans_actions[_trans]
379
- when 29 then
380
- # line 251 "lib/oga/css/lexer.rl"
474
+ when 23 then
475
+ # line 151 "lib/oga/css/lexer.rl"
476
+ begin
477
+ @escaped = true end
478
+ when 2 then
479
+ # line 1 "NONE"
381
480
  begin
382
481
  te = p+1
383
- begin add_token(:T_NTH) end
384
482
  end
385
- when 3 then
483
+ when 36 then
386
484
  # line 253 "lib/oga/css/lexer.rl"
387
485
  begin
486
+ te = p+1
487
+ begin add_token(:T_NTH) end
488
+ end
489
+ when 6 then
490
+ # line 255 "lib/oga/css/lexer.rl"
491
+ begin
388
492
  te = p+1
389
493
  begin add_token(:T_ODD) end
390
494
  end
391
- when 2 then
392
- # line 254 "lib/oga/css/lexer.rl"
495
+ when 5 then
496
+ # line 256 "lib/oga/css/lexer.rl"
393
497
  begin
394
498
  te = p+1
395
499
  begin add_token(:T_EVEN) end
396
500
  end
397
- when 26 then
501
+ when 33 then
398
502
  # line 235 "lib/oga/css/lexer.rl"
399
503
  begin
400
504
  te = p+1
401
505
  begin
402
506
  add_token(:T_RPAREN)
403
507
 
404
- cs = 13;
508
+ cs = 16;
405
509
  end
406
510
  end
407
- when 27 then
408
- # line 162 "lib/oga/css/lexer.rl"
511
+ when 34 then
512
+ # line 158 "lib/oga/css/lexer.rl"
409
513
  begin
410
514
  te = p+1
411
515
  begin
412
- emit(:T_IDENT, ts, te)
516
+ value = slice_input(ts, te)
517
+
518
+ # Translates "foo\.bar" into "foo.bar"
519
+ if @escaped
520
+ value = value.gsub('\.', '.')
521
+ @escaped = false
522
+ end
523
+
524
+ add_token(:T_IDENT, value)
413
525
  end
414
526
  end
415
- when 30 then
527
+ when 39 then
416
528
  # line 246 "lib/oga/css/lexer.rl"
417
529
  begin
418
530
  te = p
419
531
  p = p - 1; end
420
- when 32 then
421
- # line 252 "lib/oga/css/lexer.rl"
532
+ when 42 then
533
+ # line 254 "lib/oga/css/lexer.rl"
422
534
  begin
423
535
  te = p
424
536
  p = p - 1; begin add_token(:T_MINUS) end
425
537
  end
426
- when 31 then
427
- # line 195 "lib/oga/css/lexer.rl"
538
+ when 41 then
539
+ # line 196 "lib/oga/css/lexer.rl"
428
540
  begin
429
541
  te = p
430
542
  p = p - 1; begin
@@ -433,15 +545,39 @@ p = p - 1; begin
433
545
  add_token(:T_INT, value)
434
546
  end
435
547
  end
436
- when 33 then
437
- # line 162 "lib/oga/css/lexer.rl"
548
+ when 37 then
549
+ # line 158 "lib/oga/css/lexer.rl"
438
550
  begin
439
551
  te = p
440
552
  p = p - 1; begin
441
- emit(:T_IDENT, ts, te)
553
+ value = slice_input(ts, te)
554
+
555
+ # Translates "foo\.bar" into "foo.bar"
556
+ if @escaped
557
+ value = value.gsub('\.', '.')
558
+ @escaped = false
559
+ end
560
+
561
+ add_token(:T_IDENT, value)
442
562
  end
443
563
  end
444
- when 1 then
564
+ when 3 then
565
+ # line 158 "lib/oga/css/lexer.rl"
566
+ begin
567
+ begin p = ((te))-1; end
568
+ begin
569
+ value = slice_input(ts, te)
570
+
571
+ # Translates "foo\.bar" into "foo.bar"
572
+ if @escaped
573
+ value = value.gsub('\.', '.')
574
+ @escaped = false
575
+ end
576
+
577
+ add_token(:T_IDENT, value)
578
+ end
579
+ end
580
+ when 4 then
445
581
  # line 1 "NONE"
446
582
  begin
447
583
  case act
@@ -452,58 +588,58 @@ p = p - 1; begin
452
588
  next
453
589
  end
454
590
  end
455
- when 3 then
591
+ when 4 then
456
592
  begin begin p = ((te))-1; end
457
593
  add_token(:T_MINUS) end
458
594
  end
459
595
  end
460
- when 34 then
461
- # line 292 "lib/oga/css/lexer.rl"
596
+ when 45 then
597
+ # line 294 "lib/oga/css/lexer.rl"
462
598
  begin
463
599
  te = p+1
464
600
  begin add_token(:T_EQ) end
465
601
  end
466
- when 8 then
467
- # line 293 "lib/oga/css/lexer.rl"
602
+ when 12 then
603
+ # line 295 "lib/oga/css/lexer.rl"
468
604
  begin
469
605
  te = p+1
470
606
  begin add_token(:T_SPACE_IN) end
471
607
  end
472
- when 6 then
473
- # line 294 "lib/oga/css/lexer.rl"
608
+ when 10 then
609
+ # line 296 "lib/oga/css/lexer.rl"
474
610
  begin
475
611
  te = p+1
476
612
  begin add_token(:T_STARTS_WITH) end
477
613
  end
478
- when 5 then
479
- # line 295 "lib/oga/css/lexer.rl"
614
+ when 9 then
615
+ # line 297 "lib/oga/css/lexer.rl"
480
616
  begin
481
617
  te = p+1
482
618
  begin add_token(:T_ENDS_WITH) end
483
619
  end
484
- when 38 then
485
- # line 296 "lib/oga/css/lexer.rl"
620
+ when 50 then
621
+ # line 298 "lib/oga/css/lexer.rl"
486
622
  begin
487
623
  te = p+1
488
624
  begin add_token(:T_IN) end
489
625
  end
490
- when 7 then
491
- # line 297 "lib/oga/css/lexer.rl"
626
+ when 11 then
627
+ # line 299 "lib/oga/css/lexer.rl"
492
628
  begin
493
629
  te = p+1
494
630
  begin add_token(:T_HYPHEN_IN) end
495
631
  end
496
- when 35 then
497
- # line 274 "lib/oga/css/lexer.rl"
632
+ when 46 then
633
+ # line 276 "lib/oga/css/lexer.rl"
498
634
  begin
499
635
  te = p+1
500
636
  begin
501
637
  add_token(:T_RBRACK)
502
638
 
503
- cs = 13;
639
+ cs = 16;
504
640
  end
505
641
  end
506
- when 4 then
642
+ when 8 then
507
643
  # line 214 "lib/oga/css/lexer.rl"
508
644
  begin
509
645
  te = p+1
@@ -511,145 +647,290 @@ te = p+1
511
647
  emit(:T_STRING, ts + 1, te - 1)
512
648
  end
513
649
  end
514
- when 36 then
515
- # line 282 "lib/oga/css/lexer.rl"
650
+ when 49 then
651
+ # line 284 "lib/oga/css/lexer.rl"
516
652
  begin
517
653
  te = p
518
654
  p = p - 1; end
519
- when 37 then
520
- # line 162 "lib/oga/css/lexer.rl"
655
+ when 47 then
656
+ # line 158 "lib/oga/css/lexer.rl"
521
657
  begin
522
658
  te = p
523
659
  p = p - 1; begin
524
- emit(:T_IDENT, ts, te)
660
+ value = slice_input(ts, te)
661
+
662
+ # Translates "foo\.bar" into "foo.bar"
663
+ if @escaped
664
+ value = value.gsub('\.', '.')
665
+ @escaped = false
666
+ end
667
+
668
+ add_token(:T_IDENT, value)
525
669
  end
526
670
  end
527
- when 14 then
528
- # line 268 "lib/oga/css/lexer.rl"
671
+ when 7 then
672
+ # line 158 "lib/oga/css/lexer.rl"
673
+ begin
674
+ begin p = ((te))-1; end
675
+ begin
676
+ value = slice_input(ts, te)
677
+
678
+ # Translates "foo\.bar" into "foo.bar"
679
+ if @escaped
680
+ value = value.gsub('\.', '.')
681
+ @escaped = false
682
+ end
683
+
684
+ add_token(:T_IDENT, value)
685
+ end
686
+ end
687
+ when 18 then
688
+ # line 270 "lib/oga/css/lexer.rl"
529
689
  begin
530
690
  te = p+1
531
691
  begin
532
692
  add_token(:T_LBRACK)
533
693
 
534
- cs = 28;
694
+ cs = 36;
535
695
  end
536
696
  end
537
- when 15 then
538
- # line 147 "lib/oga/css/lexer.rl"
697
+ when 19 then
698
+ # line 134 "lib/oga/css/lexer.rl"
539
699
  begin
540
700
  te = p+1
541
701
  begin
542
702
  add_token(:T_PIPE)
543
703
  end
544
704
  end
545
- when 12 then
705
+ when 16 then
546
706
  # line 229 "lib/oga/css/lexer.rl"
547
707
  begin
548
708
  te = p+1
549
709
  begin
550
710
  add_token(:T_LPAREN)
551
711
 
552
- cs = 23;
712
+ cs = 27;
553
713
  end
554
714
  end
555
- when 13 then
556
- # line 162 "lib/oga/css/lexer.rl"
715
+ when 17 then
716
+ # line 158 "lib/oga/css/lexer.rl"
557
717
  begin
558
718
  te = p+1
559
719
  begin
560
- emit(:T_IDENT, ts, te)
720
+ value = slice_input(ts, te)
721
+
722
+ # Translates "foo\.bar" into "foo.bar"
723
+ if @escaped
724
+ value = value.gsub('\.', '.')
725
+ @escaped = false
726
+ end
727
+
728
+ add_token(:T_IDENT, value)
561
729
  end
562
730
  end
563
- when 11 then
564
- # line 317 "lib/oga/css/lexer.rl"
731
+ when 15 then
732
+ # line 319 "lib/oga/css/lexer.rl"
565
733
  begin
566
734
  te = p+1
567
735
  end
568
- when 22 then
569
- # line 306 "lib/oga/css/lexer.rl"
736
+ when 27 then
737
+ # line 308 "lib/oga/css/lexer.rl"
570
738
  begin
571
739
  te = p
572
740
  p = p - 1; begin add_token(:T_GREATER) end
573
741
  end
574
- when 19 then
575
- # line 307 "lib/oga/css/lexer.rl"
742
+ when 25 then
743
+ # line 309 "lib/oga/css/lexer.rl"
576
744
  begin
577
745
  te = p
578
746
  p = p - 1; begin add_token(:T_PLUS) end
579
747
  end
580
- when 24 then
581
- # line 308 "lib/oga/css/lexer.rl"
748
+ when 28 then
749
+ # line 310 "lib/oga/css/lexer.rl"
582
750
  begin
583
751
  te = p
584
752
  p = p - 1; begin add_token(:T_TILDE) end
585
753
  end
586
- when 17 then
587
- # line 151 "lib/oga/css/lexer.rl"
754
+ when 26 then
755
+ # line 138 "lib/oga/css/lexer.rl"
588
756
  begin
589
757
  te = p
590
758
  p = p - 1; begin
591
759
  add_token(:T_COMMA)
592
760
  end
593
761
  end
594
- when 16 then
595
- # line 137 "lib/oga/css/lexer.rl"
762
+ when 24 then
763
+ # line 124 "lib/oga/css/lexer.rl"
596
764
  begin
597
765
  te = p
598
766
  p = p - 1; begin
599
767
  add_token(:T_SPACE)
600
768
  end
601
769
  end
602
- when 23 then
603
- # line 162 "lib/oga/css/lexer.rl"
770
+ when 20 then
771
+ # line 158 "lib/oga/css/lexer.rl"
604
772
  begin
605
773
  te = p
606
774
  p = p - 1; begin
607
- emit(:T_IDENT, ts, te)
775
+ value = slice_input(ts, te)
776
+
777
+ # Translates "foo\.bar" into "foo.bar"
778
+ if @escaped
779
+ value = value.gsub('\.', '.')
780
+ @escaped = false
781
+ end
782
+
783
+ add_token(:T_IDENT, value)
608
784
  end
609
785
  end
610
- when 18 then
611
- # line 141 "lib/oga/css/lexer.rl"
786
+ when 1 then
787
+ # line 158 "lib/oga/css/lexer.rl"
788
+ begin
789
+ begin p = ((te))-1; end
790
+ begin
791
+ value = slice_input(ts, te)
792
+
793
+ # Translates "foo\.bar" into "foo.bar"
794
+ if @escaped
795
+ value = value.gsub('\.', '.')
796
+ @escaped = false
797
+ end
798
+
799
+ add_token(:T_IDENT, value)
800
+ end
801
+ end
802
+ when 40 then
803
+ # line 128 "lib/oga/css/lexer.rl"
612
804
  begin
613
805
  add_token(:T_HASH) end
614
- # line 304 "lib/oga/css/lexer.rl"
806
+ # line 248 "lib/oga/css/lexer.rl"
615
807
  begin
616
808
  te = p
617
809
  p = p - 1; end
618
- when 20 then
619
- # line 142 "lib/oga/css/lexer.rl"
810
+ when 29 then
811
+ # line 128 "lib/oga/css/lexer.rl"
812
+ begin
813
+ add_token(:T_HASH) end
814
+ # line 306 "lib/oga/css/lexer.rl"
815
+ begin
816
+ te = p
817
+ p = p - 1; end
818
+ when 43 then
819
+ # line 129 "lib/oga/css/lexer.rl"
620
820
  begin
621
821
  add_token(:T_DOT) end
622
- # line 304 "lib/oga/css/lexer.rl"
822
+ # line 248 "lib/oga/css/lexer.rl"
623
823
  begin
624
824
  te = p
625
825
  p = p - 1; end
626
- when 21 then
627
- # line 143 "lib/oga/css/lexer.rl"
826
+ when 30 then
827
+ # line 129 "lib/oga/css/lexer.rl"
828
+ begin
829
+ add_token(:T_DOT) end
830
+ # line 306 "lib/oga/css/lexer.rl"
831
+ begin
832
+ te = p
833
+ p = p - 1; end
834
+ when 44 then
835
+ # line 130 "lib/oga/css/lexer.rl"
628
836
  begin
629
837
  add_token(:T_COLON) end
630
- # line 304 "lib/oga/css/lexer.rl"
838
+ # line 248 "lib/oga/css/lexer.rl"
631
839
  begin
632
840
  te = p
633
841
  p = p - 1; end
634
- when 28 then
842
+ when 31 then
843
+ # line 130 "lib/oga/css/lexer.rl"
844
+ begin
845
+ add_token(:T_COLON) end
846
+ # line 306 "lib/oga/css/lexer.rl"
847
+ begin
848
+ te = p
849
+ p = p - 1; end
850
+ when 38 then
851
+ # line 151 "lib/oga/css/lexer.rl"
852
+ begin
853
+ @escaped = true end
854
+ # line 158 "lib/oga/css/lexer.rl"
855
+ begin
856
+ te = p
857
+ p = p - 1; begin
858
+ value = slice_input(ts, te)
859
+
860
+ # Translates "foo\.bar" into "foo.bar"
861
+ if @escaped
862
+ value = value.gsub('\.', '.')
863
+ @escaped = false
864
+ end
865
+
866
+ add_token(:T_IDENT, value)
867
+ end
868
+ end
869
+ when 48 then
870
+ # line 151 "lib/oga/css/lexer.rl"
871
+ begin
872
+ @escaped = true end
873
+ # line 158 "lib/oga/css/lexer.rl"
874
+ begin
875
+ te = p
876
+ p = p - 1; begin
877
+ value = slice_input(ts, te)
878
+
879
+ # Translates "foo\.bar" into "foo.bar"
880
+ if @escaped
881
+ value = value.gsub('\.', '.')
882
+ @escaped = false
883
+ end
884
+
885
+ add_token(:T_IDENT, value)
886
+ end
887
+ end
888
+ when 21 then
889
+ # line 151 "lib/oga/css/lexer.rl"
890
+ begin
891
+ @escaped = true end
892
+ # line 158 "lib/oga/css/lexer.rl"
893
+ begin
894
+ te = p
895
+ p = p - 1; begin
896
+ value = slice_input(ts, te)
897
+
898
+ # Translates "foo\.bar" into "foo.bar"
899
+ if @escaped
900
+ value = value.gsub('\.', '.')
901
+ @escaped = false
902
+ end
903
+
904
+ add_token(:T_IDENT, value)
905
+ end
906
+ end
907
+ when 22 then
908
+ # line 1 "NONE"
909
+ begin
910
+ te = p+1
911
+ end
912
+ # line 151 "lib/oga/css/lexer.rl"
913
+ begin
914
+ @escaped = true end
915
+ when 35 then
635
916
  # line 1 "NONE"
636
917
  begin
637
918
  te = p+1
638
919
  end
639
- # line 252 "lib/oga/css/lexer.rl"
920
+ # line 254 "lib/oga/css/lexer.rl"
640
921
  begin
641
- act = 3; end
642
- # line 643 "lib/oga/css/lexer.rb"
922
+ act = 4; end
923
+ # line 924 "lib/oga/css/lexer.rb"
643
924
  end
644
925
  end
645
926
  end
646
927
  if _goto_level <= _again
647
928
  case _css_lexer_to_state_actions[cs]
648
- when 9 then
929
+ when 13 then
649
930
  # line 1 "NONE"
650
931
  begin
651
932
  ts = nil; end
652
- when 25 then
933
+ when 32 then
653
934
  # line 1 "NONE"
654
935
  begin
655
936
  ts = nil; end
@@ -657,7 +938,7 @@ ts = nil; end
657
938
  begin
658
939
  act = 0
659
940
  end
660
- # line 661 "lib/oga/css/lexer.rb"
941
+ # line 942 "lib/oga/css/lexer.rb"
661
942
  end
662
943
 
663
944
  if cs == 0
@@ -686,7 +967,7 @@ act = 0
686
967
  end
687
968
  end
688
969
 
689
- # line 83 "lib/oga/css/lexer.rl"
970
+ # line 76 "lib/oga/css/lexer.rl"
690
971
 
691
972
  # % fix highlight
692
973
  ensure
@@ -695,7 +976,6 @@ end
695
976
 
696
977
  private
697
978
 
698
- ##
699
979
  # Emits a token of which the value is based on the supplied start/stop
700
980
  # position.
701
981
  #
@@ -705,25 +985,21 @@ end
705
985
  #
706
986
  # @see [#text]
707
987
  # @see [#add_token]
708
- #
709
988
  def emit(type, start, stop)
710
989
  value = slice_input(start, stop)
711
990
 
712
991
  add_token(type, value)
713
992
  end
714
993
 
715
- ##
716
994
  # Returns the text between the specified start and stop position.
717
995
  #
718
996
  # @param [Fixnum] start
719
997
  # @param [Fixnum] stop
720
998
  # @return [String]
721
- #
722
999
  def slice_input(start, stop)
723
1000
  return @data.byteslice(start, stop - start)
724
1001
  end
725
1002
 
726
- ##
727
1003
  # Yields a new token to the supplied block.
728
1004
  #
729
1005
  # @param [Symbol] type The token type.
@@ -731,13 +1007,12 @@ end
731
1007
  #
732
1008
  # @yieldparam [Symbol] type
733
1009
  # @yieldparam [String|NilClass] value
734
- #
735
1010
  def add_token(type, value = nil)
736
1011
  @block.call(type, value)
737
1012
  end
738
1013
 
739
1014
 
740
- # line 319 "lib/oga/css/lexer.rl"
1015
+ # line 321 "lib/oga/css/lexer.rl"
741
1016
 
742
1017
  end # Lexer
743
1018
  end # CSS