Book a Demo

Author Topic: Javascript Ecma-262 Grammar  (Read 4856 times)

serodya

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Javascript Ecma-262 Grammar
« on: April 15, 2016, 11:45:20 pm »
Hello,

I am writing a grammar for JavaScript Ecma-262, so does someone know how to translate the following [lookahead ∉ <DecimalDigit>] into EBNF? look at the below example:

<EscapeSequence>    ::= <CharacterEscapeSequence> |
                                          "0" [lookahead ∉ DecimalDigit] |
                                         <HexEscapeSequence> |
                                         <UnicodeEscapeSequence>;

I guess it is: "0" skip(<DecimalDigit>)

The above excerpt is in the page 129 in http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

Thank you!!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Javascript Ecma-262 Grammar
« Reply #1 on: April 18, 2016, 08:17:03 am »
Looks like this is coming from a string. Generally speaking the only escape sequences you need to have a rule for in strings are: "\\\\" | "\\\" | "\\\'" (ie. \, " and ')

The others are relevant to interpreting the string, but don't have any significance in parsing the file.