[geany/geany] 2bde26: Rust: Fix parsing of attributes in structs/enums.
SiegeLord
git-noreply at xxxxx
Wed Apr 2 01:37:03 UTC 2014
Branch: refs/heads/master
Author: SiegeLord <slabode at aim.com>
Committer: SiegeLord <slabode at aim.com>
Date: Wed, 02 Apr 2014 01:37:03 UTC
Commit: 2bde26b2027d683619a8c6013db8d63a92291a75
https://github.com/geany/geany/commit/2bde26b2027d683619a8c6013db8d63a92291a75
Log Message:
-----------
Rust: Fix parsing of attributes in structs/enums.
Previously, things like:
struct Foo
{
#[bar]
baz: int
}
or
struct Foo
{
#![bar]
baz: int
}
would horribly confuse the parser and prevent proper parsing of the rest of the
file.
Modified Paths:
--------------
tagmanager/ctags/rust.c
Modified: tagmanager/ctags/rust.c
22 files changed, 21 insertions(+), 1 deletions(-)
===================================================================
@@ -715,9 +715,29 @@ static void parseStructOrEnum (lexerState *lexer, vString *scope, int parent_kin
vString *field_name = vStringNew();
while (lexer->cur_token != TOKEN_EOF)
{
+ int goal_tokens2[] = {'}', ','};
+ /* Skip attributes. Format:
+ * #[..] or #![..]
+ * */
+ if (lexer->cur_token == '#')
+ {
+ advanceToken(lexer, TRUE);
+ if (lexer->cur_token == '!')
+ advanceToken(lexer, TRUE);
+ if (lexer->cur_token == '[')
+ {
+ /* It's an attribute, skip it. */
+ skipUntil(lexer, NULL, 0);
+ }
+ else
+ {
+ /* Something's up with this field, skip to the next one */
+ skipUntil(lexer, goal_tokens2, 2);
+ continue;
+ }
+ }
if (lexer->cur_token == TOKEN_IDENT)
{
- int goal_tokens2[] = {'}', ','};
if (strcmp(lexer->token_str->buffer, "priv") == 0)
{
advanceToken(lexer, TRUE);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list