Class: RubyLexer::HerePlaceholderToken
- Defined in:
- lib/rubylexer/token.rb
Overview
Instance Attribute Summary collapse
-
#bodyclass ⇒ Object
Returns the value of attribute bodyclass.
-
#close ⇒ Object
Returns the value of attribute close.
-
#dash ⇒ Object
readonly
Returns the value of attribute dash.
-
#ender ⇒ Object
readonly
Returns the value of attribute ender.
-
#open ⇒ Object
Returns the value of attribute open.
-
#quote ⇒ Object
readonly
Returns the value of attribute quote.
-
#string ⇒ Object
Returns the value of attribute string.
-
#termex ⇒ Object
readonly
Returns the value of attribute termex.
-
#unsafe_to_use ⇒ Object
Returns the value of attribute unsafe_to_use.
Attributes inherited from Token
#allow_ooo_offset, #as, #ident, #offset, #tag
Instance Method Summary collapse
- #===(bogus) ⇒ Object
- #append(s) ⇒ Object
- #append_token(tok) ⇒ Object
-
#initialize(dash, quote, ender, quote_real = true) ⇒ HerePlaceholderToken
constructor
A new instance of HerePlaceholderToken.
-
#line ⇒ Object
def with_line(line) @string.line=line; self end.
- #line=(line) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Token
#error, #has_no_block?, #ws_munge
Constructor Details
#initialize(dash, quote, ender, quote_real = true) ⇒ HerePlaceholderToken
Returns a new instance of HerePlaceholderToken.
441 442 443 444 445 446 447 448 449 450 |
# File 'lib/rubylexer/token.rb', line 441 def initialize(dash,quote,ender,quote_real=true) @dash,@quote,@ender,@quote_real=dash,quote,ender,quote_real @unsafe_to_use=true @string=StringToken.new #@termex=/^#{'[\s\v]*' if dash}#{Regexp.escape ender}$/ @termex=Regexp.new \ ["^", ('[\s\v]*' if dash), Regexp.escape(ender), "$"].join @bodyclass=HereBodyToken end |
Instance Attribute Details
#bodyclass ⇒ Object
Returns the value of attribute bodyclass.
438 439 440 |
# File 'lib/rubylexer/token.rb', line 438 def bodyclass @bodyclass end |
#close ⇒ Object
Returns the value of attribute close.
439 440 441 |
# File 'lib/rubylexer/token.rb', line 439 def close @close end |
#dash ⇒ Object (readonly)
Returns the value of attribute dash.
436 437 438 |
# File 'lib/rubylexer/token.rb', line 436 def dash @dash end |
#ender ⇒ Object (readonly)
Returns the value of attribute ender.
436 437 438 |
# File 'lib/rubylexer/token.rb', line 436 def ender @ender end |
#open ⇒ Object
Returns the value of attribute open.
439 440 441 |
# File 'lib/rubylexer/token.rb', line 439 def open @open end |
#quote ⇒ Object (readonly)
Returns the value of attribute quote.
436 437 438 |
# File 'lib/rubylexer/token.rb', line 436 def quote @quote end |
#string ⇒ Object
Returns the value of attribute string.
437 438 439 |
# File 'lib/rubylexer/token.rb', line 437 def string @string end |
#termex ⇒ Object (readonly)
Returns the value of attribute termex.
436 437 438 |
# File 'lib/rubylexer/token.rb', line 436 def termex @termex end |
#unsafe_to_use ⇒ Object
Returns the value of attribute unsafe_to_use.
437 438 439 |
# File 'lib/rubylexer/token.rb', line 437 def unsafe_to_use @unsafe_to_use end |
Instance Method Details
#===(bogus) ⇒ Object
452 |
# File 'lib/rubylexer/token.rb', line 452 def ===(bogus); false end |
#append(s) ⇒ Object
468 |
# File 'lib/rubylexer/token.rb', line 468 def append s; @string.append s end |
#append_token(tok) ⇒ Object
470 |
# File 'lib/rubylexer/token.rb', line 470 def append_token tok; @string.append_token tok end |
#line ⇒ Object
def with_line(line) @string.line=line; self end
474 |
# File 'lib/rubylexer/token.rb', line 474 def line; @string.line end |
#line=(line) ⇒ Object
475 |
# File 'lib/rubylexer/token.rb', line 475 def line=line; @string.line=line end |
#to_s ⇒ Object
454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/rubylexer/token.rb', line 454 def to_s # if @bodyclass==OutlinedHereBodyToken result=if/[^a-z_0-9]/i===@ender @ender.gsub(/[\\"]/, '\\\\'+'\\&') else @ender end return ["<<",@dash,@quote_real&&@quote,result,@quote_real&&@quote].join # else # assert !unsafe_to_use # return @string.to_s # end end |