Class: Parser::CommentParser
- Inherits:
-
StringScanner
- Object
- StringScanner
- Parser::CommentParser
- Defined in:
- lib/parser/comment_parser.rb
Overview
Creates an instance of Comment, then parses the content and adds the contained doc- and tokenlines to it.
Instance Method Summary collapse
-
#initialize(input) ⇒ CommentParser
constructor
A new instance of CommentParser.
-
#parse ⇒ Parser::Comment
All lines, that start with a ‘@-symbol` will be processed as tokenline.
Methods inherited from StringScanner
#intelligent_skip_until, #save_scanned, #scan_until_ahead, #scan_until_or_end, #skip_escaping_until
Constructor Details
#initialize(input) ⇒ CommentParser
Returns a new instance of CommentParser.
12 13 14 15 |
# File 'lib/parser/comment_parser.rb', line 12 def initialize(input) super(input) @comment = Comment.new(input) end |
Instance Method Details
#parse ⇒ Parser::Comment
All lines, that start with a ‘@-symbol` will be processed as tokenline. If the next line after a token starts with two spaces, it will be interpreted as continuation of the preceding token.
All other lines are interpreted as doclines
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/parser/comment_parser.rb', line 27 def parse # we don't want the linebreak of the comment start in our first docline # i.e. ignore '/**\n' self.skip LINE_END while not eos? do parse_comment_line end return @comment end |