Skip to content

Commit

Permalink
Rust: Fix parsing of function pointer struct fields.
Browse files Browse the repository at this point in the history
Previously, skipUntil was confused by the -> token.
  • Loading branch information
SiegeLord committed Apr 2, 2014
1 parent 16d9bbb commit 52a179d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tagmanager/ctags/rust.c
Expand Up @@ -67,6 +67,7 @@ typedef enum {
TOKEN_IDENT,
TOKEN_LSHIFT,
TOKEN_RSHIFT,
TOKEN_RARROW,
TOKEN_EOF
} tokenType;

Expand Down Expand Up @@ -129,6 +130,9 @@ static void writeCurTokenToStr (lexerState *lexer, vString *out_str)
case TOKEN_RSHIFT:
vStringCatS(out_str, ">>");
break;
case TOKEN_RARROW:
vStringCatS(out_str, "->");
break;
default:
vStringPut(out_str, (char) lexer->cur_token);
}
Expand Down Expand Up @@ -356,6 +360,11 @@ static int advanceToken (lexerState *lexer, boolean skip_whitspace)
advanceNChar(lexer, 2);
return lexer->cur_token = TOKEN_LSHIFT;
}
else if (lexer->cur_c == '-' && lexer->next_c == '>')
{
advanceNChar(lexer, 2);
return lexer->cur_token = TOKEN_RARROW;
}
else
{
int c = lexer->cur_c;
Expand Down

0 comments on commit 52a179d

Please sign in to comment.