Division/RegExp conflict while tokenizing Javascript?

You can tell by what the preceding token is is in the stream. Go through each token that your lexer emits and ask whether it can reasonably be followed by a division sign or a regexp; you'll find that the two resulting sets of tokens are disjoint. For example ( { and all of the binary operators can only be followed by a regexp.

Likewise ) } identifiers, and string/number literals can only be followed by a division sign.

You can tell by what the preceding token is is in the stream. Go through each token that your lexer emits and ask whether it can reasonably be followed by a division sign or a regexp; you'll find that the two resulting sets of tokens are disjoint. For example, (, , {, ;, and all of the binary operators can only be followed by a regexp.

Likewise, ), , }, identifiers, and string/number literals can only be followed by a division sign. See Section 7 of the ECMAScript spec for more details.

Thanks pmdboi for the inspiration. I ended up creating a fork of Rkelly, a ruby javascript parser, that suffered from this problem, and implemented the solution you suggested. The code for the fork is here: https://github.Com/dzello/rkelly.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions