Sha256: 3b9632690423efaa423a2bcbbe4e97a84cf9db89774e8218756f1b99a1ccfdc1
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
module Yoda module AST class CommentBlock class TagTextTypePart < BasePart # @return [BasePart] attr_reader :parent # @return [Array<Parslet::Slice>] attr_reader :tokens # @param parent [BasePart] # @param tokens [Array<Parslet::Slice>] def initialize(parent:, tokens:) @parent = parent @tokens = tokens end # @return [CommentBlock] def comment_block parent.comment_block end # @return [Integer] def begin_index tokens.first.offset end # @return [Integer] def end_index tokens.last.offset + tokens.last.length end # @return [Array<Token>] def type_tokens @type_tokens ||= tokens.slice(1..-2).map { |token| Token.from_parslet(token, comment_block: comment_block) } end # @param location [Parsing::Location] # @return [Token, nil] def nearest_token(location) type_tokens.find { |token| token.include?(location) } end private def type_text text.slice(1..-2) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems