-
Notifications
You must be signed in to change notification settings - Fork 149
Add missing format parsing #234
base: master
Are you sure you want to change the base?
Conversation
for printf format:
- %m will print strerror(errno)
for scanf format:
- optional 'm' can be used with string conversions
- [ is a valid conversion specifier
literal %:
- do not match when literal % is used with other
flags
known bug: the following is not be hilighted properly:
printf("%ms");
the 's' it not part of the conversion specifier in
this case but is when used with scanf.
|
Who's doing the review? |
| (hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier | ||
| [diouxXDOUeEfFgGaACcSspn%] # conversion type | ||
| ((m?\\[((\\^\\]|\\])?[^\\]]+)\\])|m[sc]|[diouxXDOUeEfFgGaACcSspnm]) # conversion type | ||
| | %% # literal % |
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.
shouldn't this be a single %?
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.
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.
Ah, I missed the |. Thanks for explaining.
|
Can you please add some specs that cover these changes? |
|
What's the status of this? Someone requested this at microsoft/vscode-cpptools#1149 , so that '%[' works in fscanf. |
|
As per my last comment, it still needs specs to be considered. |
|
I update the function so that it's a bit more easy to read/review Spec: Linux: Nice formatted tables (incomplete though): |


atom --version
Atom : 1.18.0-dev-dc8311d
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
Requirements
Highlight of format specifier.
Small test that can be use for regression
Description of the Change
Current implementation does not deal properly with the following:
printf format:
for scanf format:
literal %:
Alternate Designs
The parser could be re-written to distinguish between quoted format specifier string and quoted string. It could also distinguish between scanf and printf in order to deal with %m parsing.
The proposed solution was kept for simplicity reason.
Benefits
Proper highlight of valide format specifier
Possible Drawbacks
None
Applicable Issues
The following is not be hilighted properly:
printf("%ms");
the 's' it not part of the conversion specifier in
this case but is when used with scanf.