-
Notifications
You must be signed in to change notification settings - Fork 640
TypeSpec: Add enumerator support #4339
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
Conversation
|
Thank you. Could you change the commit log header to "TypeSpec: add enumerator support" ?
Our CI/CD platforms reported failures. I read your code. Your code calls setScope on a token object. However, the caller and the callee share the token object. As a result, setting the scope affects the caller side. diff --git a/parsers/typespec.c b/parsers/typespec.c
index 75ae13059..b0e16e3a5 100644
--- a/parsers/typespec.c
+++ b/parsers/typespec.c
@@ -139,9 +139,12 @@ static void copyToken (tokenInfo *const dest, const tokenInfo *const src)
vStringCopy (dest->string, src->string);
}
-static void setScope (tokenInfo *const token, int scope)
+static int setScope (tokenInfo *const token, int scope)
{
+ int originalScope = token->scope;
+
token->scope = scope;
+ return originalScope;
}
static bool isIdentChar (const int c)
@@ -402,12 +405,12 @@ static void parseEnum(tokenInfo *const token)
if (token->type == TOKEN_OPEN_CURLY)
{
/* Parse enum body */
+ int originalScope = setScope (token, enumIndex);
while (token->type != TOKEN_CLOSE_CURLY && token->type != TOKEN_EOF)
{
if (token->type == TOKEN_IDENTIFIER)
{
/* Create tag for enumerator */
- setScope (token, enumIndex);
makeTypeSpecTag(token, K_ENUMERATOR);
readToken(token);
@@ -431,6 +434,7 @@ static void parseEnum(tokenInfo *const token)
else
readToken(token);
}
+ setScope(token, originalScope);
}
}
}Your new code: These lines are not tested at all. Please, delete trailing white spaces.
(Don't you use EditorConfig on your editor?)
Your commit is based on an old commit. Could you rebase your branch on the latest master branch? Adding a kind to a parser changes the CLI of ctags. After reconsidering, adding man pages solely for versioning is not a good idea. This output tells users that the Scheme parser is version 1 (current 1.1). The kind set has been updated once in an upper compatible way (age 1.1). The function kind and the set kind were added in the parser version 0. The unknown kind was added in the parser version 1. In this PR, you will add a kind. So I would like you to consider the versioning. |
parsers/typespec.c
Outdated
| { true, 'a', "alias", "aliases" }, | ||
| { true, 'p', "property", "properties" } | ||
| { true, 'p', "property", "properties" }, | ||
| { true, 'e', "enumerator", "enumerators (values inside an enumeration)" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put "," at the end of the new entry for "e".
When adding a new entry next time, you can make the diff output smaller:)
|
thanks, working on the fix |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4339 +/- ##
=======================================
Coverage 85.87% 85.87%
=======================================
Files 252 252
Lines 62597 62618 +21
=======================================
+ Hits 53755 53776 +21
Misses 8842 8842 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thank you. |

Test passed with make units LANGUAGES=TypeSpec