Corrected docs of the xpath lexer.

This commit is contained in:
Yorick Peterse 2014-06-04 19:33:46 +02:00
parent 114bc0d6e8
commit 7244e28eec
1 changed files with 7 additions and 5 deletions

View File

@ -59,8 +59,7 @@ module Oga
# This method stores the supplied block in `@block` and resets it after # This method stores the supplied block in `@block` and resets it after
# the lexer loop has finished. # the lexer loop has finished.
# #
# @param [String] data The String to consume. # @see [#add_token]
# @return [Array]
# #
def advance(&block) def advance(&block)
@block = block @block = block
@ -103,8 +102,8 @@ module Oga
# @param [Fixnum] start # @param [Fixnum] start
# @param [Fixnum] stop # @param [Fixnum] stop
# #
# @see #text # @see [#text]
# @see #add_token # @see [#add_token]
# #
def emit(type, start, stop) def emit(type, start, stop)
value = slice_input(start, stop) value = slice_input(start, stop)
@ -124,11 +123,14 @@ module Oga
end end
## ##
# Adds a token with the given type and value to the list. # Yields a new token to the supplied block.
# #
# @param [Symbol] type The token type. # @param [Symbol] type The token type.
# @param [String] value The token value. # @param [String] value The token value.
# #
# @yieldparam [Symbol] type
# @yieldparam [String|NilClass] value
#
def add_token(type, value = nil) def add_token(type, value = nil)
@block.call(type, value) @block.call(type, value)
end end