Skip to content
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

Keep the whitespace #68

Closed
7 tasks done
wojciechczerniak opened this issue Dec 6, 2019 · 2 comments
Closed
7 tasks done

Keep the whitespace #68

wojciechczerniak opened this issue Dec 6, 2019 · 2 comments
Labels
Feature Something we can add later on without introducing a breaking change ODFF Conformance ODDF 1.3 Evaluator requirement ODFF SGE ODDF 1.3 Small Group Evaluator requirement

Comments

@wojciechczerniak
Copy link
Contributor

wojciechczerniak commented Dec 6, 2019

Description

A part of the ODFF conformance is to keep the whitespace created by formula creator. They may be a part of readability formatting.

  • Ignore the whitespace in calculations
  • Support all whitespace types mentioned in the spec (add tests)
    • SPACE (U+0020)
    • CHARACTER TABULATION (U+0009)
    • LINE FEED (U+000A)
    • CARRIAGE RETURN (U+000D)
  • Retain whitespace entered by the user

Syntax

Whitespace ::= #x20 | #x09 | #x0a | #x0d

Spec

For calculation purposes, whitespace is ignored unless it is inside the contents of string constants or text surrounded by single quotes. Evaluators shall ignore any whitespace characters before and/or after any operators, constant numbers, constant strings, constant errors, inline arrays, parentheses used for controlling precedence, and the closing parenthesis of a function call. Whitespace shall be ignored following the initial equal sign(s). Whitespace shall be ignored just before a function name, but whitespace shall not separate a function name from its initial opening parenthesis. Whitespace shall not be used in the interior of a terminating grammar rule (a rule that references no other rule other than character sets, internally or externally-defined), unless specifically permitted by the terminating grammar rule, since these rules define the lexical properties of a component. Evaluators shall not write formulas with whitespace embedded in any unquoted identifier, constant Number, or constant Error. Evaluators shall treat SPACE (U+0020), CHARACTER TABULATION (U+0009), LINE FEED (U+000A), and CARRIAGE RETURN (U+000D) as whitespace characters.

And:

Evaluators should retain whitespace entered by the original formula creator and use it when saving or presenting the formula, and should not add additional whitespace unless directed to do so during the process of editing a formula.

@wojciechczerniak wojciechczerniak added ODFF SGE ODDF 1.3 Small Group Evaluator requirement ODFF Conformance ODDF 1.3 Evaluator requirement Feature Something we can add later on without introducing a breaking change labels Dec 6, 2019
@wojciechczerniak wojciechczerniak added this to the Februrary 2020 milestone Jan 7, 2020
@voodoo11 voodoo11 mentioned this issue Feb 20, 2020
7 tasks
@voodoo11
Copy link
Collaborator

Done #184

Whitespaces at the end of the input will be trimmed, ex. '= A1 ' -> '= A1'
Whitespaces inside ranges will be skipped, ex. '=SUM(A1 : A2)' -> '=SUM(A1:A2)'
Whitespaces before function args separators will be skipped, ex. '=SUM(A1 , A2)' -> '=SUM(A1, A2)'

All needed whitespace chars supported and tested.

@wojciechczerniak
Copy link
Contributor Author

Thx! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Something we can add later on without introducing a breaking change ODFF Conformance ODDF 1.3 Evaluator requirement ODFF SGE ODDF 1.3 Small Group Evaluator requirement
Projects
None yet
Development

No branches or pull requests

2 participants