Package com.google.javascript.rhino
Class TokenStream
- java.lang.Object
-
- com.google.javascript.rhino.TokenStream
-
public final class TokenStream extends java.lang.Object
This class implements the JavaScript scanner.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.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isJSIdentifier(java.lang.String s)
static boolean
isKeyword(java.lang.String name)
Is the string an ES3 keyword?
-
-
-
Method Detail
-
isKeyword
public static boolean isKeyword(java.lang.String name)
Is the string an ES3 keyword?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.
-
isJSIdentifier
public static boolean isJSIdentifier(java.lang.String s)
-
-