Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(parser) Build common EMCAscript foundation
Builds a common keyword foundation for any grammar that is building on top of JavaScript: - LiveScript - CoffeeScript - TypeScript Also uses this common foundation for JS itself.
- Loading branch information
1 parent
5f1fbf1
commit b984c7b
Showing
11 changed files
with
292 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
const KEYWORDS = [ | ||
"as", // for exports | ||
"in", | ||
"of", | ||
"if", | ||
"for", | ||
"while", | ||
"finally", | ||
"var", | ||
"new", | ||
"function", | ||
"do", | ||
"return", | ||
"void", | ||
"else", | ||
"break", | ||
"catch", | ||
"instanceof", | ||
"with", | ||
"throw", | ||
"case", | ||
"default", | ||
"try", | ||
"switch", | ||
"continue", | ||
"typeof", | ||
"delete", | ||
"let", | ||
"yield", | ||
"const", | ||
"class", | ||
// JS handles these with a special rule | ||
// "get", | ||
// "set", | ||
"debugger", | ||
"async", | ||
"await", | ||
"static", | ||
"import", | ||
"from", | ||
"export", | ||
"extends" | ||
]; | ||
const LITERALS = [ | ||
"true", | ||
"false", | ||
"null", | ||
"undefined", | ||
"NaN", | ||
"Infinity" | ||
]; | ||
|
||
const TYPES = [ | ||
"Intl", | ||
"DataView", | ||
"Number", | ||
"Math", | ||
"Date", | ||
"String", | ||
"RegExp", | ||
"Object", | ||
"Function", | ||
"Boolean", | ||
"Error", | ||
"Symbol", | ||
"Set", | ||
"Map", | ||
"WeakSet", | ||
"WeakMap", | ||
"Proxy", | ||
"Reflect", | ||
"JSON", | ||
"Promise", | ||
"Float64Array", | ||
"Int16Array", | ||
"Int32Array", | ||
"Int8Array", | ||
"Uint16Array", | ||
"Uint32Array", | ||
"Float32Array", | ||
"Array", | ||
"Uint8Array", | ||
"Uint8ClampedArray", | ||
"ArrayBuffer" | ||
]; | ||
|
||
const ERROR_TYPES = [ | ||
"EvalError", | ||
"InternalError", | ||
"RangeError", | ||
"ReferenceError", | ||
"SyntaxError", | ||
"TypeError", | ||
"URIError" | ||
]; | ||
|
||
const BUILT_IN_GLOBALS = [ | ||
"setInterval", | ||
"setTimeout", | ||
"clearInterval", | ||
"clearTimeout", | ||
|
||
"require", | ||
"exports", | ||
|
||
"eval", | ||
"isFinite", | ||
"isNaN", | ||
"parseFloat", | ||
"parseInt", | ||
"decodeURI", | ||
"decodeURIComponent", | ||
"encodeURI", | ||
"encodeURIComponent", | ||
"escape", | ||
"unescape" | ||
]; | ||
|
||
const BUILT_IN_VARIABLES = [ | ||
"arguments", | ||
"this", | ||
"super", | ||
"console", | ||
"window", | ||
"document", | ||
"localStorage", | ||
"module", | ||
"global" // Node.js | ||
]; | ||
|
||
const BUILT_INS = [].concat( | ||
BUILT_IN_GLOBALS, | ||
BUILT_IN_VARIABLES, | ||
TYPES, | ||
ERROR_TYPES | ||
); | ||
|
||
export { LITERALS, BUILT_INS, KEYWORDS }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.