siphon-cli
Version:
Simple bundler for web applications. 📦🔧🧡
70 lines (69 loc) • 1.86 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.keywords = void 0;
var types_1 = require("../../../../types");
var utils_1 = require("../../../../utils");
var base_1 = require("./base");
exports.keywords = {
await: true,
break: true,
case: true,
catch: true,
class: true,
const: true,
continue: true,
debugger: true,
default: true,
delete: true,
do: true,
else: true,
extends: true,
import: true,
export: true,
false: true,
finally: true,
for: true,
function: true,
if: true,
implements: true,
return: true,
in: true,
instanceof: true,
interface: true,
let: true,
new: true,
null: true,
package: true,
private: true,
protected: true,
public: true,
static: true,
super: true,
switch: true,
synchronized: true,
this: true,
try: true,
typeof: true,
var: true,
void: true,
while: true,
with: true,
yield: true,
};
base_1.ezra.identifier = function (allowKeyword, allowHyphen) {
if (allowKeyword === void 0) { allowKeyword = false; }
if (allowHyphen === void 0) { allowHyphen = false; }
var id = new types_1.Identifier(this.i);
if (!(0, utils_1.isValidIdentifierCharacter)(this.text[this.i]))
this.raise("IDENTIFIER_EXPECTED");
if ((0, utils_1.isDigit)(this.text[this.i]))
this.raise("ID_FOLLOWS_LITERAL");
while ((0, utils_1.isValidIdentifierCharacter)(this.text[this.i]) ||
(allowHyphen && this.text[this.i] === "-"))
(id.name += this.text[this.i]), this.i++;
id.loc.end = this.i - 1;
if (!allowKeyword && exports.keywords[id.name] === true) {
this.raise("RESERVED", id.name, id.loc.end);
}
return id;
};