mathematic-inc / codemirror-tex

A monorepo for all TeX-related CodeMirror projects
GNU General Public License v3.0
11 stars 2 forks source link

bug(lezer-tex): initialization Problem #3

Open FoundTheWOUT opened 3 years ago

FoundTheWOUT commented 3 years ago

Describe the bug When I enter "\" at an Editor that inits with blank content, the browser would pop up this error. However, If enter some other keys first, then enter "\", everything is going completely correct.

Screenshots 截屏2021-06-20 下午7 17 02

jrandolf commented 3 years ago

This is okay. The error is not unexpected, but should be handled. As for why the latter doesn't error but the former does, the latter (the case with text before \) has a token list while the former doesn't.

E.g. The following example has no token list:

\

A backslash is not considered a token by itself. It always requires something after (just as TeX does) The following example has a token list:

t\

The t is a letter token, so a token list exists.