Module: CodeMiner::StringProcessor
- Included in:
- Parser
- Defined in:
- lib/codeminer/processors/string_processor.rb
Instance Method Summary collapse
- #on_embexpr_beg ⇒ Object
- #on_heredoc_beg ⇒ Object
- #on_heredoc_end ⇒ Object
- #on_string_add(string_content, string) ⇒ Object
- #on_string_concat(str1, str2) ⇒ Object
- #on_string_content ⇒ Object
- #on_string_embexpr(body) ⇒ Object
- #on_string_literal(string_content) ⇒ Object
- #on_tstring_beg ⇒ Object
- #on_tstring_content(value) ⇒ Object
- #on_tstring_end ⇒ Object
- #on_xstring_add(body, string) ⇒ Object
- #on_xstring_literal(token) ⇒ Object
- #on_xstring_new ⇒ Object
Instance Method Details
#on_embexpr_beg ⇒ Object
59 60 61 62 63 |
# File 'lib/codeminer/processors/string_processor.rb', line 59 def on_embexpr_beg(*) super.tap do |token| @embexpr << token end end |
#on_heredoc_beg ⇒ Object
65 66 67 68 69 |
# File 'lib/codeminer/processors/string_processor.rb', line 65 def on_heredoc_beg(*) super.tap do |token| @string_begin << token end end |
#on_heredoc_end ⇒ Object
71 72 73 74 75 |
# File 'lib/codeminer/processors/string_processor.rb', line 71 def on_heredoc_end(*) super.tap do |token| @string_end << token end end |
#on_string_add(string_content, string) ⇒ Object
9 10 11 |
# File 'lib/codeminer/processors/string_processor.rb', line 9 def on_string_add(string_content, string) string_content.add(string, extract_src_by_tokens(string)) end |
#on_string_concat(str1, str2) ⇒ Object
17 18 19 20 |
# File 'lib/codeminer/processors/string_processor.rb', line 17 def on_string_concat(str1, str2) dynamic_string = DynamicStringExpression.wrap(str1) dynamic_string.add(str2) end |
#on_string_content ⇒ Object
13 14 15 |
# File 'lib/codeminer/processors/string_processor.rb', line 13 def on_string_content StringContentExpression.new end |
#on_string_embexpr(body) ⇒ Object
28 29 30 31 32 |
# File 'lib/codeminer/processors/string_processor.rb', line 28 def on_string_embexpr(body) body.each.last.delimiter = '}' = extract_src_by_token(@embexpr.pop) StringEmbeddedExpression.new(body, ) end |
#on_string_literal(string_content) ⇒ Object
34 35 36 37 |
# File 'lib/codeminer/processors/string_processor.rb', line 34 def on_string_literal(string_content) string_content.src = extract_src_by_tokens(@string_begin.pop, @string_end.pop) string_content end |
#on_tstring_beg ⇒ Object
47 48 49 50 51 |
# File 'lib/codeminer/processors/string_processor.rb', line 47 def on_tstring_beg(*) super.tap do |token| @string_begin << token end end |
#on_tstring_content(value) ⇒ Object
5 6 7 |
# File 'lib/codeminer/processors/string_processor.rb', line 5 def on_tstring_content(value) Token.new(:string, value, extract_src_by_value(value)) end |
#on_tstring_end ⇒ Object
53 54 55 56 57 |
# File 'lib/codeminer/processors/string_processor.rb', line 53 def on_tstring_end(*) super.tap do |token| @string_end << token end end |
#on_xstring_add(body, string) ⇒ Object
43 44 45 |
# File 'lib/codeminer/processors/string_processor.rb', line 43 def on_xstring_add(body, string) body.add(string, extract_src_by_tokens(string)) end |
#on_xstring_literal(token) ⇒ Object
22 23 24 25 26 |
# File 'lib/codeminer/processors/string_processor.rb', line 22 def on_xstring_literal(token) token.column -= 1 token.end_column += 1 XStringExpression.new(token, extract_src_by_tokens(token)) end |
#on_xstring_new ⇒ Object
39 40 41 |
# File 'lib/codeminer/processors/string_processor.rb', line 39 def on_xstring_new StringContentExpression.new end |