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:
parent
23f75f598e
commit
a8d6962ac2
|
@ -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");
|
||||||
|
|
Loading…
Reference in New Issue