oga 2.2 → 2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/oga/version.rb +1 -1
- data/lib/oga/xml/lexer.rb +0 -18
- data/lib/oga/xml/parser.rb +1 -17
- data/lib/oga/xml/pull_parser.rb +1 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59f11fbee4e3a82ad1a8cca29b80f06fdfac6d34
|
4
|
+
data.tar.gz: 07088c2201db9c31526cc454b61005c35075fce6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d33b04c566eceb848f6de1e95d4471ebc959694e85b16e33c01dedabbbf92f5cc15679559202f6e63437424d1dfa945cb9e8ce36282a12a77585da3210ba8e3
|
7
|
+
data.tar.gz: 15375495eadfe074c7c3d6fe1b23a7d71df186dc57db72ed43592e97a5071e6866ddaaf0c3ac0bf92937d21e9b3bfe6a058008776265debd4e41519c8b013554
|
data/README.md
CHANGED
@@ -158,7 +158,7 @@ Querying a document using a namespace:
|
|
158
158
|
* Stream/pull parsing
|
159
159
|
* SAX parsing
|
160
160
|
* Low memory footprint
|
161
|
-
* High performance
|
161
|
+
* High performance (taking into account most work happens in Ruby)
|
162
162
|
* Support for XPath 1.0
|
163
163
|
* CSS3 selector support
|
164
164
|
* XML namespace support (registering, querying, etc)
|
data/lib/oga/version.rb
CHANGED
data/lib/oga/xml/lexer.rb
CHANGED
@@ -112,19 +112,8 @@ module Oga
|
|
112
112
|
@data = data
|
113
113
|
@html = options[:html]
|
114
114
|
@strict = options[:strict] || false
|
115
|
-
|
116
|
-
reset
|
117
|
-
end
|
118
|
-
|
119
|
-
# Resets the internal state of the lexer. Typically you don't need to
|
120
|
-
# call this method yourself as its called by #lex after lexing a given
|
121
|
-
# String.
|
122
|
-
def reset
|
123
115
|
@line = 1
|
124
116
|
@elements = []
|
125
|
-
|
126
|
-
@data.rewind if @data.respond_to?(:rewind)
|
127
|
-
|
128
117
|
reset_native
|
129
118
|
end
|
130
119
|
|
@@ -149,9 +138,6 @@ module Oga
|
|
149
138
|
|
150
139
|
# Gathers all the tokens for the input and returns them as an Array.
|
151
140
|
#
|
152
|
-
# This method resets the internal state of the lexer after consuming the
|
153
|
-
# input.
|
154
|
-
#
|
155
141
|
# @see #advance
|
156
142
|
# @return [Array]
|
157
143
|
def lex
|
@@ -161,8 +147,6 @@ module Oga
|
|
161
147
|
tokens << [type, value, line]
|
162
148
|
end
|
163
149
|
|
164
|
-
reset
|
165
|
-
|
166
150
|
tokens
|
167
151
|
end
|
168
152
|
|
@@ -178,8 +162,6 @@ module Oga
|
|
178
162
|
# This method stores the supplied block in `@block` and resets it after
|
179
163
|
# the lexer loop has finished.
|
180
164
|
#
|
181
|
-
# This method does *not* reset the internal state of the lexer.
|
182
|
-
#
|
183
165
|
# @yieldparam [Symbol] type
|
184
166
|
# @yieldparam [String] value
|
185
167
|
# @yieldparam [Fixnum] line
|
data/lib/oga/xml/parser.rb
CHANGED
@@ -218,15 +218,8 @@ class Parser < LL::Driver
|
|
218
218
|
def initialize(data, options = {})
|
219
219
|
@data = data
|
220
220
|
@lexer = Lexer.new(data, options)
|
221
|
-
|
222
|
-
reset
|
223
|
-
end
|
224
|
-
|
225
|
-
# Resets the internal state of the parser.
|
226
|
-
def reset
|
227
221
|
@line = 1
|
228
|
-
|
229
|
-
@lexer.reset
|
222
|
+
@lexer.reset_native
|
230
223
|
end
|
231
224
|
|
232
225
|
# Yields the next token from the lexer.
|
@@ -264,15 +257,6 @@ class Parser < LL::Driver
|
|
264
257
|
raise LL::ParserError, message
|
265
258
|
end
|
266
259
|
|
267
|
-
# @see [LL::Driver#parse]
|
268
|
-
def parse
|
269
|
-
retval = super
|
270
|
-
|
271
|
-
reset
|
272
|
-
|
273
|
-
retval
|
274
|
-
end
|
275
|
-
|
276
260
|
# @param [Array] children
|
277
261
|
# @return [Oga::XML::Document]
|
278
262
|
def on_document(children = [])
|
data/lib/oga/xml/pull_parser.rb
CHANGED
@@ -54,13 +54,9 @@ module Oga
|
|
54
54
|
:xml_declaration => XML::XmlDeclaration
|
55
55
|
}
|
56
56
|
|
57
|
-
|
58
|
-
def reset
|
57
|
+
def initialize(*args)
|
59
58
|
super
|
60
|
-
|
61
|
-
@block = nil
|
62
59
|
@nesting = []
|
63
|
-
@node = nil
|
64
60
|
end
|
65
61
|
|
66
62
|
# Parses the input and yields every node to the supplied block.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yorick Peterse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|