[css-syntax-3] Inconsistency in defining <number-token>

Open
#7,247 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
css
Domain
compilers, web-dev

Research direction

Start with the CSS Syntax 3 number-token railroad diagram and sections 4.3.12, “Consume a number,” and 4.3.13, “Convert a string to a number,” linked in the issue. Compare their allowed forms, including “-E7” and “E99,” and review the related issue #3599. Done means the discrepancy and intended validity of these forms are resolved in the specification.

Written by the indexing model from the issue text.

Description

Closed Rejected as Invalid

I believe the correct parsing of real numbers as specified by the railroad diagram is not implemented by the prose sections describing number parsing.

Specifically, it appears sections 4.3.12. Consume a number and 4.3.13. Convert a string to a number will allow "-E7" as a number.

This would conflict with the railroad diagram which requires something between sign and 'E'. It also seemingly conflicts with the spec's hyper-rigidity where "1.E1" is disallowed. (#3599)

(BTW: am I correct that that railroad diagram was copied from an older SVG spec?)

.
Once again I was trying to find the definition for SVG real numbers and the chain of refs led me to CSS Syntax. Specifically I was trying to find the 'rightness' of an emitted "9e-5" or "-1e-4".

I find section <number-token> under 4.1. Token Railroad Diagrams and say "yay, I'm right!"

Then I find section 4.3.12. Consume a number and am dismayed. Then I realized that spec was merely confusing and did allow for "9e-5". Then it seemed it was so loose as to allow for gibberish - no number at all!

I checked section 4.3.13. Convert a string to a number figuring it would restrict further. But like 4.3.12 so many of the parts are optional, there is little in the way of a minimal content required.

Was it intended to allow "E99" as a <number-token>?

Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from w3c/csswg-drafts

All issues in w3c/csswg-drafts

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.