Commit a8d6962a authored by Mormegil's avatar Mormegil Committed by Wouter van Oortmerssen

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
parent 23f75f59
...@@ -186,7 +186,7 @@ void Parser::Next() { ...@@ -186,7 +186,7 @@ void Parser::Next() {
case '/': case '/':
if (*cursor_ == '/') { if (*cursor_ == '/') {
const char *start = ++cursor_; const char *start = ++cursor_;
while (*cursor_ && *cursor_ != '\n') cursor_++; while (*cursor_ && *cursor_ != '\n' && *cursor_ != '\r') cursor_++;
if (*start == '/') { // documentation comment if (*start == '/') { // documentation comment
if (cursor_ != source_ && !seen_newline) if (cursor_ != source_ && !seen_newline)
Error("a documentation comment should be on a line on its own"); Error("a documentation comment should be on a line on its own");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment