Tolerate DOS-style EOL in IDL line comments

If an IDL file uses DOS-style EOLs (CR+LF), line comments need to
ignore the second linebreak character, otherwise, as is currently
the case, the parsed documentation comment includes a trailing `\r`
character, which is then output verbatim into the output source
code by flatc.

Change-Id: I39591631995a980622d20a4a32315178b33f18f6
This commit is contained in:
Mormegil 2015-04-14 18:09:08 +02:00 committed by Wouter van Oortmerssen
parent 23f75f598e
commit a8d6962ac2
1 changed files with 1 additions and 1 deletions

View File

@ -186,7 +186,7 @@ void Parser::Next() {
case '/':
if (*cursor_ == '/') {
const char *start = ++cursor_;
while (*cursor_ && *cursor_ != '\n') cursor_++;
while (*cursor_ && *cursor_ != '\n' && *cursor_ != '\r') cursor_++;
if (*start == '/') { // documentation comment
if (cursor_ != source_ && !seen_newline)
Error("a documentation comment should be on a line on its own");