lib/grammar.js
function checkGrammar(obj, callback) {
    let hasver = false;
    if (Array.isArray(obj)) {
        for (var i = 0; i < obj.length; ++i) {
            var nums = base.countGlobalObj(obj[i].name, obj);
            if (nums > 1) {
                callback(false, obj[i].name + ': duplication of name');

                return false;
            }

            if (obj[i].name == 'VER') {
                hasver = true;
            }

            if (obj[i].type == 'struct' || obj[i].type == 'static' || obj[i].type == 'message') {
                checkStruct(obj[i], callback, obj);
            }
            else if (obj[i].type == 'enum') {
                checkEnum(obj[i], callback);
            }
            else if (obj[i].type == 'type') {
                checkType(obj[i], callback, obj);
            }
        }

        if (!hasver) {
            callback(false, 'no VER!');

            return false;
        }

        return true;
    }

    callback(false, 'empty file!');

    return false;
}
function checkGrammar(obj, callback) {
    let hasver = false;
    if (Array.isArray(obj)) {
        for (var i = 0; i < obj.length; ++i) {
            var nums = base.countGlobalObj(obj[i].name, obj);
            if (nums > 1) {
                callback(false, obj[i].name + ': duplication of name');

                return false;
            }

            if (obj[i].name == 'VER') {
                hasver = true;
            }

            if (obj[i].type == 'struct' || obj[i].type == 'static' || obj[i].type == 'message') {
                checkStruct(obj[i], callback, obj);
            }
            else if (obj[i].type == 'enum') {
                checkEnum(obj[i], callback);
            }
            else if (obj[i].type == 'type') {
                checkType(obj[i], callback, obj);
            }
        }

        if (!hasver) {
            callback(false, 'no VER!');

            return false;
        }

        return true;
    }

    callback(false, 'empty file!');

    return false;
}
callback(isok, err)