-
Notifications
You must be signed in to change notification settings - Fork 109
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
Don't get confused by c-escape characters #3
Comments
Before we support this, we'll probably want a way to define file types and what traits those file types should have (specialized dictionaries, That can then be extended into a config file that works with custom dictionaries (#9) to allow the user to override existing file type definitions or add their own. |
C++'s grammar rules: https://en.cppreference.com/w/cpp/language/escape scspell's regex: # Treat anything alphanumeric as a token of interest, as long as it is not
# immediately preceded by a single backslash. (The string "\ntext" should
# match on "text" rather than "ntext".)
C_ESCAPE_TOKEN_REGEX = re.compile(r'(?<![^\\]\\)\w+') Challenges:
|
Moved over from #313
|
@rhysd does go have a form of raw strings (no escaping performed)? I'm wondering how misspell handles the challenges they provide. For example, in Python its common to write regexes with raw strings so you don't have to double escape (e.g. |
Yes, it has. e.g. re := regexp.MustCompile(`\d+\.\d+\.\d+`) |
This comment has been minimized.
This comment has been minimized.
Since our primary concern is with having 100% confidence in the changes we make, a simple solution to this problem is to just not check words that start with Can't believe I hadn't thought of this before. |
Since our goal is 100% confidence in the results, its better to not check words than to correct the wrong words. With that in mind, we'll ignore words after what might be c-escape sequences (`\nfoo`) or printf substitutions (`%dfoo`). Fixes #3
The comparison docs still lists this as an open issue: https://github.com/crate-ci/typos/blob/84c8b30e065012c70187818aadba0e711ff5cafc/docs/comparison.md Is that intended? From what I read here, it is fixed? |
Thanks! I've fixed it |
Scspell will parse the file assumng escape characters exist but let you opt out.
See https://github.com/myint/scspell/blob/master/scspell/__init__.py#L78
Escape character support could instead be a file type setting, like dictionary values
The text was updated successfully, but these errors were encountered: