public class TokenStream
extends java.lang.Object
It is based on the C source files jsscan.c and jsscan.h in the jsref package.
IMPORTANT: As of 2018-03-09 it is still not possible to use Java 8 features in this file due to limitations on some internal Google projects that depend on it.
Constructor and Description |
---|
TokenStream() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isJSIdentifier(java.lang.String s) |
static boolean |
isKeyword(java.lang.String name)
Is the string an ES3 keyword?
|
public static boolean isKeyword(java.lang.String name)
Keywords for versions of JavaScript after ES3 are not included, because the parser would reject valid ES3 code that happened to newer keywords if we did that.
Since isKeyword() is used repeatedly in scanning, for performance reasons, it is implemented to do the minimum number of character comparisons to ascertain whether the given name is a keyword, instead of doing string search of the name against JS keywords.
public static boolean isJSIdentifier(java.lang.String s)
Copyright © 2009-2020 Google. All Rights Reserved.