Class: Parser::CommentParser
- Inherits:
-
StringScanner
- Object
- StringScanner
- Parser::CommentParser
- Defined in:
- lib/parser/comment_parser.rb
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 if the next line after a token starts with two spaces, it will be interpreted as continuation of the preceding token.
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.
7 8 9 10 |
# File 'lib/parser/comment_parser.rb', line 7 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
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/parser/comment_parser.rb', line 24 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 |