Class: RubyLexer::IgnoreToken
- Includes:
- StillIgnoreToken
- Defined in:
- lib/rubylexer/token.rb,
lib/rubylexer/tokenprinter.rb
Overview
Direct Known Subclasses
EncodingDeclToken, EscNlToken, FileAndLineToken, HereBodyToken, ShebangToken, WsToken, ZwToken
Instance Attribute Summary collapse
-
#linecount ⇒ Object
readonly
Returns the value of attribute linecount.
Attributes inherited from Token
#allow_ooo_offset, #as, #endline, #ident, #offset, #startline, #tag
Instance Method Summary collapse
-
#initialize(ident, *stuff) ⇒ IgnoreToken
constructor
A new instance of IgnoreToken.
- #ws_munge(tp) ⇒ Object
Methods inherited from Token
#dump, #error, #has_no_block?, #inspect, #orig_inspect, #to_s
Constructor Details
#initialize(ident, *stuff) ⇒ IgnoreToken
Returns a new instance of IgnoreToken.
567 568 569 570 |
# File 'lib/rubylexer/token.rb', line 567 def initialize(ident,*stuff) @linecount=ident.count "\n" super end |
Instance Attribute Details
#linecount ⇒ Object (readonly)
Returns the value of attribute linecount.
572 573 574 |
# File 'lib/rubylexer/token.rb', line 572 def linecount @linecount end |
Instance Method Details
#ws_munge(tp) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/rubylexer/tokenprinter.rb', line 67 def ws_munge(tp) #tp.latestline+= to_s.scan("\n").size tp.lasttok=self result=unless tp.inws tp.inws=true ' ' else '' end #if ?= == @ident.to_s[0] result+="\\\n"*@ident.to_s.scan(/\r\n?|\n\r?/).size #end return result end |