2

From example on http://zaach.github.io/jison/docs/#specifying-a-language

[0-9]+("."[0-9]+)?\b  return 'NUMBER';

why in this regexp used "." instead of \. ?

redexp
  • 4,765
  • 7
  • 25
  • 37

1 Answers1

2

Because that's a Jison grammar tokenization rule not an exact regex.
In Jison a token is surrounded in ".

In the compiled rules you can see the rule converted to a regex:

["[0-9]+(?:\\.[0-9]+)?\\b", "return 'NUMBER';"],
rzymek
  • 9,064
  • 2
  • 45
  • 59