Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctags: fix Ruby parsing for block assigns #1820

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions ctags/parsers/ruby.c
Expand Up @@ -121,7 +121,7 @@ static bool notIdentChar (int c)
return ! isIdentChar (c);
}

static bool operatorChar (int c)
static bool isOperatorChar (int c)
{
return (c == '[' || c == ']' ||
c == '=' || c == '!' || c == '~' ||
Expand All @@ -133,7 +133,12 @@ static bool operatorChar (int c)

static bool notOperatorChar (int c)
{
return ! operatorChar (c);
return ! isOperatorChar (c);
}

static bool isSigilChar (int c)
{
return (c == '@' || c == '$');
}

static bool isWhitespace (int c)
Expand Down Expand Up @@ -180,6 +185,8 @@ static bool canMatchKeywordWithAssign (const unsigned char** s, const char* lite
return true;
}

advanceWhile (s, isSigilChar);

if (! advanceWhile (s, isIdentChar))
{
*s = original_pos;
Expand All @@ -188,7 +195,7 @@ static bool canMatchKeywordWithAssign (const unsigned char** s, const char* lite

advanceWhile (s, isWhitespace);

if (! (advanceWhile (s, operatorChar) && *(*s - 1) == '='))
if (! (advanceWhile (s, isOperatorChar) && *(*s - 1) == '='))
{
*s = original_pos;
return false;
Expand Down