• Sathya Gunasekaran's avatar
    [numeric separator] Simplify error handling · e77eebfe
    Sathya Gunasekaran authored
    Pointing to the exact spot of the incorrect numeric separator seems
    clearer both in terms of the error itself, and the resulting code in
    scanner because we don't have to keep track of the start position.
    
    Previously, the error was:
      ➜ ./out.gn/x64.release/d8 --harmony-numeric-separator -e '0x1__1'
      unnamed:1: SyntaxError: Only one underscore is allowed as numeric separator
      0x1__1
      ^^^^
      SyntaxError: Only one underscore is allowed as numeric separator
    
    Now, the error is:
      ➜ ./out.gn/x64.release/d8 --harmony-numeric-separator -e '0x1__1'
      unnamed:1: SyntaxError: Only one underscore is allowed as numeric separator
      0x1__1
          ^
      SyntaxError: Only one underscore is allowed as numeric separator
    
    
    Bug: v8:7317
    Change-Id: I7df1b39816e51a97234da6ed0fca1bf8c0223c3e
    Reviewed-on: https://chromium-review.googlesource.com/962241
    Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
    Reviewed-by: 's avatarMathias Bynens <mathias@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#51950}
    e77eebfe
scanner.h 28 KB