function isValidIdentifierChar(ch, first) {
    // check directly for ASCII
    if (ch <= "\u007F") {
        if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch === '$' || ch === '_' ||
            (!first && (ch >= '0' && ch <= '9'))) {
            return true;
        }
        return false;
    }

    // create an object to test this in
    var x = {};
    x["x"+ch] = true;
    x[ch] = true;

    // then use eval to determine if it's a valid character
    var valid = false;
    try {
        valid = (Function("x", "return (x." + (first?"":"x") + ch + ");")(x) === true);
    } catch (ex) {}

    return valid;
}
function isValidIdentifierChar(ch, first) {
    
    if (ch <= "\u007F") {
        if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch === '$' || ch === '_' ||
            (!first && (ch >= '0' && ch <= '9'))) {
            return true;
        }
        return false;
    }

    
    var x = {};
    x["x"+ch] = true;
    x[ch] = true;

    
    var valid = false;
    try {
        valid = (Function("x", "return (x." + (first?"":"x") + ch + ");")(x) === true);
    } catch (ex) {}

    return valid;
}
function isValidIdentifierChar ( ch , first ) { // check directly for ASCII if ( ch <= "\u007F" ) { if ( ( ch >= 'a' && ch <= 'z' ) || ( ch >= 'A' && ch <= 'Z' ) || ch === '$' || ch === '_' || ( ! first && ( ch >= '0' && ch <= '9' ) ) ) { return true ; } return false ; } // create an object to test this in var x = { } ; x [ "x" + ch ] = true ; x [ ch ] = true ; // then use eval to determine if it's a valid character var valid = false ; try { valid = ( Function ( "x" , "return (x." + ( first ? "" : "x" ) + ch + ");" ) ( x ) === true ) ; } catch ( ex ) { } return valid ; }
/*
Since JavaScript provides no convenient way to determine if a
character is in a particular Unicode category, we use
metacircularity to accomplish this (oh yeaaaah!)
/ * Since JavaScript provides no convenient way to determine if a character is in a particular Unicode category we use metacircularity to accomplish this ( oh yeaaaah! )