[geany/geany] 5e469d: Rust: Update comment parsing.
git-noreply at xxxxx
Tue Jul 29 15:10:14 UTC 2014
Author: SiegeLord <slabode at aim.com>
Committer: SiegeLord <slabode at aim.com>
Date: Tue, 29 Jul 2014 15:10:14 UTC
Rust: Update comment parsing.
Rust now allows CRLF line endings in source files, which doesn't actually
change any lexing here but the comment was wrong.
Also, the hashbang initial comment has a special case where #![ doesn't count
as a comment (but instead an inner attribute that just happens to be on the
19 lines changed, 15 insertions(+), 4 deletions(-)
@@ -188,19 +188,30 @@ static void scanWhitespace (lexerState *lexer)
/* Normal line comments start with two /'s and continue until the next \n
- * (NOT any other newline character!). Additionally, a shebang in the beginning
- * of the file also counts as a line comment.
+ * (potentially after a \r). Additionally, a shebang in the beginning of the
+ * file also counts as a line comment as long as it is not this sequence: #![ .
* Block comments start with / followed by a * and end with a * followed by a /.
* Unlike in C/C++ they nest. */
static void scanComments (lexerState *lexer)
- /* // or #! */
- if (lexer->next_c == '/' || lexer->next_c == '!')
+ /* // */
+ if (lexer->next_c == '/')
while (lexer->cur_c != EOF && lexer->cur_c != '\n')
+ /* #! */
+ else if (lexer->next_c == '!')
+ advanceNChar(lexer, 2);
+ /* If it is exactly #![ then it is not a comment, but an attribute */
+ if (lexer->cur_c == '[')
+ while (lexer->cur_c != EOF && lexer->cur_c != '\n')
+ /* block comment */
else if (lexer->next_c == '*')
int level = 1;
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits