-
Notifications
You must be signed in to change notification settings - Fork 108
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
Changed whitespace regex to /s+
(intermediate branch to fix the conflicts)
#935
Conversation
…eature/issue-898/resolve-conflicts
Codecov Report
@@ Coverage Diff @@
## develop #935 +/- ##
========================================
Coverage 95.70% 95.70%
========================================
Files 161 161
Lines 14018 14024 +6
Branches 2901 2902 +1
========================================
+ Hits 13416 13422 +6
Misses 602 602
|
src/parser/LexerConfig.ts
Outdated
@@ -95,7 +95,7 @@ export const ErrorLiteral = createToken({name: 'ErrorLiteral', pattern: /#[A-Za- | |||
/* skipping whitespaces */ | |||
export const WhiteSpace = createToken({ | |||
name: 'WhiteSpace', | |||
pattern: /[ \t\n\r]+/, | |||
pattern: /\s+/, |
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.
@sequba wrote in the OP:
The standard does not mention whitespace characters other than SPACE, TAB, LINE FEED, and CARRIAGE RETURN so I assume it is up to us how we want to handle them.
Our implementation will become non-standard if we do whatever we want. I think we should make the behavior configurable, as we did in the past with other ideas that go beyond the ODFF standard: #58
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.
IMO it is highly unlikely that someone wants to display #ERROR!
for formulas including non-breakable spaces but it won't hurt to add a config option for controlling that behaviour. I'll work on it.
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 added allowAllWhitespace
parameter
…eature/issue-898/resolve-conflicts
…eature/issue-898/resolve-conflicts
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.
Technically it looks very good but I have a doubt about the option itself.
src/Config.ts
Outdated
* | ||
* @category Formula Syntax | ||
*/ | ||
allowAllWhitespace: boolean, |
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 know there are many ways to do that, but I am looking for the most consistent and future-proof.
All other options in the "Formula Syntax" category allow string or array input. Have you considered naming this option ignoreWhiteSpace: 'standard' | 'any'
(with standard
as the default).
This allows us to add more options in the future like none
, etc.
I think that the word "any" fits better than "all", because usually refers to quantity and might be confusing.
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.
You're right. It's more flexible, Done.
…eature/issue-898/resolve-conflicts
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.
Thanks, love it!
This is a technical PR that was necessary to resolve the conflicts from the forked repository. Fixes #898
Original PR by MartinDawson (#877):
Other software compatibility:
Checked:
Other spreadsheet software accepts non-breaking space characters in formulas and displays them as regular spaces (no errors),
ODFF 1.3 compliance:
The standard does not mention whitespace characters other than SPACE, TAB, LINE FEED, and CARRIAGE RETURN so I assume it is up to us how we want to handle them.