File: /home/frenchy/www/french-american.org/current/node_modules/uglyfly-js/lib/predicates_fast.js
/***********************************************************************
Copyright 2014 (c) Saair Quaderi <saair.quaderi@gmail.com>
Copyright 2012-2013 (c) Mihai Bazon <mihai.bazon@gmail.com>
UglyflyJS sourcecode can be found here:
https://github.com/quaderi/uglyflyjs
UglyflyJS (by Saair) is a fork of UglifyJS2 (by Mihai Bazon)
Both libraries are released under the BSD 2-Clause License.
***********************************************************************/
/*globals define, module, require */
((typeof define === "function") ? define :
function () { "use strict"; require('./nd').apply(module, arguments); })(
"predicates",
[
//no dependencies
],
function () {
"use strict";
// Note the below code was largely generated using make-predicates.js
var predicates = {};
predicates.KEYWORDS = function KEYWORDS(str) {
switch (str.length) {
case 5:
switch (str) {
case "break":
case "catch":
case "const":
case "throw":
case "while":
return true;
}
return false;
case 4:
switch (str) {
case "case":
case "else":
case "void":
case "with":
return true;
}
return false;
case 6:
switch (str) {
case "delete":
case "return":
case "switch":
case "typeof":
return true;
}
return false;
case 3:
switch (str) {
case "for":
case "new":
case "try":
case "var":
return true;
}
return false;
case 8:
switch (str) {
case "continue":
case "debugger":
case "function":
return true;
}
return false;
case 2:
switch (str) {
case "do":
case "if":
case "in":
return true;
}
return false;
case 7:
switch (str) {
case "default":
case "finally":
return true;
}
return false;
case 10:
return str === "instanceof";
}
};
predicates.KEYWORDS_ATOM = function KEYWORDS_ATOM(str) {
switch (str) {
case "false":
case "null":
case "true":
return true;
}
return false;
};
predicates.RESERVED_WORDS = function RESERVED_WORDS(str) {
switch (str.length) {
case 5:
switch (str) {
case "break":
case "catch":
case "const":
case "throw":
case "while":
case "false":
case "class":
case "final":
case "float":
case "short":
case "super":
case "yield":
return true;
}
return false;
case 4:
switch (str) {
case "case":
case "else":
case "void":
case "with":
case "null":
case "true":
case "byte":
case "char":
case "enum":
case "goto":
case "long":
case "this":
return true;
}
return false;
case 6:
switch (str) {
case "delete":
case "return":
case "switch":
case "typeof":
case "double":
case "export":
case "import":
case "native":
case "public":
case "static":
case "throws":
return true;
}
return false;
case 7:
switch (str) {
case "default":
case "finally":
case "boolean":
case "extends":
case "package":
case "private":
return true;
}
return false;
case 8:
switch (str) {
case "continue":
case "debugger":
case "function":
case "abstract":
case "volatile":
return true;
}
return false;
case 3:
switch (str) {
case "for":
case "new":
case "try":
case "var":
case "int":
return true;
}
return false;
case 2:
switch (str) {
case "do":
case "if":
case "in":
return true;
}
return false;
case 9:
switch (str) {
case "interface":
case "protected":
case "transient":
return true;
}
return false;
case 10:
switch (str) {
case "instanceof":
case "implements":
return true;
}
return false;
case 12:
return str === "synchronized";
}
};
predicates.KEYWORDS_BEFORE_EXPRESSION = function KEYWORDS_BEFORE_EXPRESSION(str) {
switch (str.length) {
case 4:
switch (str) {
case "case":
case "else":
return true;
}
return false;
case 6:
switch (str) {
case "delete":
case "return":
return true;
}
return false;
case 3:
return str === "new";
case 5:
return str === "throw";
}
};
predicates.OPERATORS = function OPERATORS(str) {
switch (str.length) {
case 2:
switch (str) {
case "in":
case "!=":
case "%=":
case "&&":
case "&=":
case "*=":
case "++":
case "+=":
case "--":
case "-=":
case "/=":
case "<<":
case "<=":
case "==":
case ">=":
case ">>":
case "^=":
case "|=":
case "||":
return true;
}
return false;
case 1:
switch (str) {
case "!":
case "%":
case "&":
case "*":
case "+":
case "-":
case "/":
case "<":
case "=":
case ">":
case "?":
case "^":
case "|":
case "~":
return true;
}
return false;
case 3:
switch (str) {
case "new":
case "!==":
case "<<=":
case "===":
case ">>=":
case ">>>":
return true;
}
return false;
case 6:
switch (str) {
case "delete":
case "typeof":
return true;
}
return false;
case 4:
switch (str) {
case "void":
case ">>>=":
return true;
}
return false;
case 10:
return str === "instanceof";
}
};
predicates.OPERATOR_CHARS = function OPERATOR_CHARS(str) {
switch (str) {
case "!":
case "%":
case "&":
case "*":
case "+":
case "-":
case "<":
case "=":
case ">":
case "?":
case "^":
case "|":
case "~":
return true;
}
return false;
};
predicates.WHITESPACE_CHARS = function WHITESPACE_CHARS(str) {
switch (str.charCodeAt(0)) {
case 9:
case 10:
case 11:
case 12:
case 13:
case 32:
case 160:
case 6158:
case 8192:
case 8193:
case 8194:
case 8195:
case 8196:
case 8197:
case 8198:
case 8199:
case 8200:
case 8201:
case 8202:
case 8203:
case 8239:
case 8287:
case 12288:
return true;
}
return false;
};
predicates.PUNC_BEFORE_EXPRESSION = function PUNC_BEFORE_EXPRESSION(str) {
switch (str) {
case "(":
case ",":
case ".":
case ":":
case ";":
case "[":
case "{":
return true;
}
return false;
};
predicates.PUNC_CHARS = function PUNC_CHARS(str) {
switch (str) {
case "(":
case ")":
case ",":
case ":":
case ";":
case "[":
case "]":
case "{":
case "}":
return true;
}
return false;
};
predicates.UNARY_PREFIX = function UNARY_PREFIX(str) {
switch (str.length) {
case 1:
switch (str) {
case "!":
case "+":
case "-":
case "~":
return true;
}
return false;
case 6:
switch (str) {
case "delete":
case "typeof":
return true;
}
return false;
case 2:
switch (str) {
case "++":
case "--":
return true;
}
return false;
case 4:
return str === "void";
}
};
predicates.UNARY_POSTFIX = function UNARY_POSTFIX(str) {
switch (str) {
case "++":
case "--":
return true;
}
return false;
};
predicates.ASSIGNMENT = function ASSIGNMENT(str) {
switch (str.length) {
case 2:
switch (str) {
case "%=":
case "&=":
case "*=":
case "+=":
case "-=":
case "/=":
case "^=":
case "|=":
return true;
}
return false;
case 3:
switch (str) {
case "<<=":
case ">>=":
return true;
}
return false;
case 1:
return str === "=";
case 4:
return str === ">>>=";
}
};
predicates.REGEXP_MODIFIERS = function REGEXP_MODIFIERS(str) {
switch (str) {
case "g":
case "i":
case "m":
case "s":
case "y":
return true;
}
return false;
};
return predicates;
}
);