Class: Yoda::Parsing::Query::CurrentCommentTokenQuery::InputtingLine
- Inherits:
-
Object
- Object
- Yoda::Parsing::Query::CurrentCommentTokenQuery::InputtingLine
- Defined in:
- lib/yoda/parsing/query/current_comment_token_query.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#token_sequence ⇒ Object
readonly
Returns the value of attribute token_sequence.
Instance Method Summary collapse
- #at_sign? ⇒ true, false
- #current_range ⇒ (Integer, Integer)?
- #current_state ⇒ Symbol
- #current_token ⇒ Parslet::Slice?
-
#initialize(token_sequence, column) ⇒ InputtingLine
constructor
A new instance of InputtingLine.
- #tag ⇒ Parslet::Slice?
Constructor Details
#initialize(token_sequence, column) ⇒ InputtingLine
Returns a new instance of InputtingLine.
76 77 78 79 |
# File 'lib/yoda/parsing/query/current_comment_token_query.rb', line 76 def initialize(token_sequence, column) @token_sequence = token_sequence @column = column end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
72 73 74 |
# File 'lib/yoda/parsing/query/current_comment_token_query.rb', line 72 def column @column end |
#token_sequence ⇒ Object (readonly)
Returns the value of attribute token_sequence.
69 70 71 |
# File 'lib/yoda/parsing/query/current_comment_token_query.rb', line 69 def token_sequence @token_sequence end |
Instance Method Details
#at_sign? ⇒ true, false
115 116 117 118 119 |
# File 'lib/yoda/parsing/query/current_comment_token_query.rb', line 115 def at_sign? current_token && current_token.to_s.match?(/\A[{}.&\]\[\(\)<>]/) && column == current_token.offset + current_token.size end |
#current_range ⇒ (Integer, Integer)?
87 88 89 90 |
# File 'lib/yoda/parsing/query/current_comment_token_query.rb', line 87 def current_range return nil unless current_token [current_token.offset, current_token.offset + current_token.size] end |
#current_state ⇒ Symbol
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/yoda/parsing/query/current_comment_token_query.rb', line 98 def current_state @current_state ||= begin if tag && %w(@type @!sig).include?(tag.to_s) && !on_tag? :type_tag_type elsif tag && token_sequence.parameter_tokens.empty? :tag elsif in_bracket? :type elsif at_parameter_name? :param else :none end end end |
#current_token ⇒ Parslet::Slice?
93 94 95 |
# File 'lib/yoda/parsing/query/current_comment_token_query.rb', line 93 def current_token @current_token ||= token_sequence.all_tokens.find { |token| token.offset <= column && column <= token.offset + token.size } end |
#tag ⇒ Parslet::Slice?
82 83 84 |
# File 'lib/yoda/parsing/query/current_comment_token_query.rb', line 82 def tag token_sequence.tag end |