@param [TokenList, Token, String] tokens
A list of tokens. If the token is a string, it is parsed with {RubyLex}.
# File lib/yard/parser/ruby/legacy/token_list.rb, line 25 def push(*tokens) tokens.each do |tok| if tok.is_a?(TokenList) || tok.is_a?(Array) concat tok elsif tok.is_a?(Token) super tok elsif tok.is_a?(String) parse_content(tok) else raise ArgumentError, "Expecting token, list of tokens or string of code to be tokenized. Got #{tok.class}" end end self end
# File lib/yard/parser/ruby/legacy/token_list.rb, line 41 def squeeze(type = TkSPACE) last = nil TokenList.new(map {|t| x = t.is_a?(type) && last.is_a?(type) ? nil : t; last = t; x }) end
# File lib/yard/parser/ruby/legacy/token_list.rb, line 10 def to_s(full_statement = false, show_block = true) inject([]) do |acc, token| break acc if !full_statement && TkStatementEnd === token if !show_block && TkBlockContents === token acc << "" else acc << token.text end acc end.join end
Generated with the Darkfish Rdoc Generator 2.