Skip to content

Exponential number notation#36

Merged
shellscape merged 5 commits intoshellscape:masterfrom
lydell:exponential-notation
Sep 26, 2017
Merged

Exponential number notation#36
shellscape merged 5 commits intoshellscape:masterfrom
lydell:exponential-notation

Conversation

@lydell
Copy link
Copy Markdown
Contributor

@lydell lydell commented Aug 16, 2017

Which issue # if any, does this resolve?

None; I didn't think of opening an issue first :)

Please check one:

  • New tests created for this change
  • Tests updated for this change

CSS spec: https://www.w3.org/TR/css-syntax-3/#number-token-diagram

Support for exponential number notation is wanted in prettier/prettier#2627

@lydell
Copy link
Copy Markdown
Contributor Author

lydell commented Aug 16, 2017

I just found a bug, so please don't merge just yet :)

@lydell
Copy link
Copy Markdown
Contributor Author

lydell commented Aug 16, 2017

Bug fixed. Ready for review again.

Copy link
Copy Markdown
Owner

@shellscape shellscape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, and much appreciate the PR! my apologies for getting back to you on this so late. a few minor changes and I think we're good

Comment thread lib/tokenize.js Outdated

// Exponential number notation with minus or plus: 1e-10, 1e+10
if (regex === wordEndNum || code === period) {
let code1 = css.charCodeAt(next),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's get some better descriptors for variable names here. ncode ncode1 ncode2 would be a little better since it'd correspond with the values being pulled. we don't want to do nextCode, nextCodeNext, nextCodeNextnext or anything silly like that, but we can do better than code1-3.

Comment thread lib/tokenize.js Outdated
const tab = '\t'.charCodeAt(0);
const cr = '\r'.charCodeAt(0);
const at = '@'.charCodeAt(0);
const smallE = 'e'.charCodeAt(0);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowerE and upperE please

@lydell
Copy link
Copy Markdown
Contributor Author

lydell commented Sep 26, 2017

@shellscape Variables renamed.

@shellscape shellscape merged commit 2722931 into shellscape:master Sep 26, 2017
@lydell lydell deleted the exponential-notation branch September 26, 2017 20:04
@lydell
Copy link
Copy Markdown
Contributor Author

lydell commented Sep 26, 2017

Thanks! Would you mind releasing this to npm? :)

@lydell lydell restored the exponential-notation branch September 27, 2017 05:15
@lydell
Copy link
Copy Markdown
Contributor Author

lydell commented Sep 28, 2017

@shellscape Next time you get ten minutes over, would you mind releasing this to npm? :)

@shellscape
Copy link
Copy Markdown
Owner

shellscape commented Sep 28, 2017

done, thanks for the heads up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants