jecelyin / 920-Text-Editor-old

new project
https://github.com/jecelyin/920-text-editor-v2/
Other
200 stars 87 forks source link

Improper syntax highlighting for JS #16

Open dead-claudia opened 10 years ago

dead-claudia commented 10 years ago

Code samples like the following are incorrectly highlighted:

function isPositiveZero(x) { return 1 / x === 1 / 0; }

The return statement is usually highlighted as a RegExp literal, with the triple equals highlighted, instead of two division statements. Similar highlighting issues are apparent with statements like these:

// both zeros are highlighted, neither should be
1 / 0;
0 / 1;

// highlights the x's and colon
a = x > 5 ? 5 / x : x / 5

// highlights all the way to the end of the file or until another '/' is found
a /= 5;

Android versions: 4.1.2 (stock phone), 4.4.2 (stock phone and CM11 nightly on tablet)

Tested on latest Google Play release.