From a52e3cd96deacc1235e8d8869343dcf824bb4051 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Tue, 8 Oct 2013 16:09:56 +0300 Subject: [PATCH] Update list of reserved words to match ECMAScript 5. ES5 removed a bunch of reserved words that ES3 had reserved. These are also supported as identifiers by real-world implementations. So removing these. ES5 added 'let' and 'yield' to the reserved list, which have been added in here too. --- lib/rkelly/tokenizer.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/rkelly/tokenizer.rb b/lib/rkelly/tokenizer.rb index 296aa81..947173a 100644 --- a/lib/rkelly/tokenizer.rb +++ b/lib/rkelly/tokenizer.rb @@ -11,11 +11,15 @@ class Tokenizer const true false null debugger } + # First 6 are always reserved in ECMAScript 5.1 + # Others are only reserved in strict mode. + # http://www.ecma-international.org/ecma-262/5.1/#sec-7.6.1.2 + # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words RESERVED = %w{ - abstract boolean byte char class double enum export extends - final float goto implements import int interface long native package - private protected public short static super synchronized throws - transient volatile + class enum export extends import super + + implements interface package private protected public static + let yield } LITERALS = {