-
Notifications
You must be signed in to change notification settings - Fork 44
532 support negative numbers #872
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -51,6 +51,9 @@ int Parse(Location location, string macrosValue) | |||||
| if (Regex.IsMatch(macrosValue, $"^(0|[1-9][0-9]*)$")) | ||||||
| return int.Parse(macrosValue); | ||||||
|
|
||||||
| if (Regex.IsMatch(macrosValue, $"^(-[1-9][0-9]*)$")) | ||||||
|
||||||
| [Regex("[^ \t\v\f\r\n#;+\\-*/()=!<>\",.|\\[\\]&\\\\]+")] | |
| PreprocessingToken, |
Also I found issue in Yoakke, which generates lexer for us. LanguageDev/Yoakke#186 maybe that's related.
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.
I strongly suspect that we have other issue here. Numbers are tokens without sign. Sign + or - handled by Unary expression, but that does not work for some reasons.
currently, PreprocessorToken recognize number with operator - (sub) here.
Now Numbers are tokens without sign but with operator sub and etc.
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.
No it's not, otherwise how do you get token -10 so you need to handle it here.
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.
i think error here
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.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,8 @@ internal sealed record IdentifierExpression(Location Location, string Identifier | |
| if (Regex.IsMatch(searchValue, $"^(0|[1-9][0-9]*)$") | ||
| || Regex.IsMatch(searchValue, $"^{Regexes.HexLiteral}$") | ||
| || Regex.IsMatch(searchValue, "^0[0-7]+$") | ||
| || Regex.IsMatch(searchValue, "^0b[01]+$")) | ||
| || Regex.IsMatch(searchValue, "^0b[01]+$") | ||
| || Regex.IsMatch(searchValue, "^(-[1-9][0-9]*)$")) | ||
|
||
| { | ||
| return searchValue; | ||
| } | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.