Only emit extra T_SLASH tokens for "//".

This commit is contained in:
Yorick Peterse 2014-08-13 01:28:43 +02:00
parent f2fe2a4b47
commit a133b923a2
1 changed files with 10 additions and 1 deletions

View File

@ -30,6 +30,13 @@ module Oga
# #
AXIS_EMIT_NODE = %w{descendant-or-self parent self} AXIS_EMIT_NODE = %w{descendant-or-self parent self}
##
# Axes that require an extra T_SLASH token to be emitted.
#
# @return [Array]
#
AXIS_EMIT_EXTRA_SLASH = %w{descendant-or-self}
## ##
# @param [String] data The data to lex. # @param [String] data The data to lex.
# #
@ -246,7 +253,9 @@ module Oga
add_token(:T_LPAREN) add_token(:T_LPAREN)
add_token(:T_RPAREN) add_token(:T_RPAREN)
add_token(:T_SLASH) unless te == eof if AXIS_EMIT_EXTRA_SLASH.include?(value) and te != eof
add_token(:T_SLASH)
end
end end
} }