Hacker News new | ask | show | jobs
by whizzter 867 days ago
You still need a full JS(x) parser (and lexer) though since / symbols are contextual (as are < in JSX).

/ and < in operator positions becomes operators, whilst / in plain JS in a value position becomes the start of an reg-exp and < becomes the start of an JSX tag, so to handle it there needs to be a full parser (with a pull-lexer to correctly handle the contextual part) as you cannot just do a textual replacement due to ambiguity.