"use strict";
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of Genie
//
// Copyright 2019-2020 The Board of Trustees of the Leland Stanford Junior University
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Author: Giovanni Campagna <gcampagn@cs.stanford.edu>
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const thingtalk_1 = require("thingtalk");
const C = __importStar(require("./ast_manip"));
async function default_1($runtime, $ttUtils, $options, $locale, $grammar, $loader) {
    const MAX_SMALL_INTEGER = 12;
    for (let i = 0; i <= MAX_SMALL_INTEGER; i++) {
        $grammar.declareSymbol("constant_Number");
        $grammar.addRule("constant_Number", [String(i)], (($0) => new thingtalk_1.Ast.Value.Number(i)), C.entityOrNumberValueKeyFn, {});
    }
    $grammar.declareSymbol("constant_String");
    $grammar.addConstants("constant_String", "QUOTED_STRING", thingtalk_1.Type.String, C.valueKeyFn, {});
    $grammar.declareSymbol("constant_Entity__tt__url");
    $grammar.addConstants("constant_Entity__tt__url", "URL", new thingtalk_1.Type.Entity('tt:url'), C.entityOrNumberValueKeyFn, {});
    $grammar.declareSymbol("constant_Entity__tt__username");
    $grammar.addConstants("constant_Entity__tt__username", "USERNAME", new thingtalk_1.Type.Entity('tt:username'), C.entityOrNumberValueKeyFn, {});
    $grammar.declareSymbol("constant_Entity__tt__hashtag");
    $grammar.addConstants("constant_Entity__tt__hashtag", "HASHTAG", new thingtalk_1.Type.Entity('tt:hashtag'), C.entityOrNumberValueKeyFn, {});
    $grammar.declareSymbol("constant_Entity__tt__phone_number");
    $grammar.addConstants("constant_Entity__tt__phone_number", "PHONE_NUMBER", new thingtalk_1.Type.Entity('tt:phone_number'), C.entityOrNumberValueKeyFn, {});
    $grammar.declareSymbol("constant_Entity__tt__email_address");
    $grammar.addConstants("constant_Entity__tt__email_address", "EMAIL_ADDRESS", new thingtalk_1.Type.Entity('tt:email_address'), C.entityOrNumberValueKeyFn, {});
    $grammar.declareSymbol("constant_Entity__tt__path_name");
    $grammar.addConstants("constant_Entity__tt__path_name", "PATH_NAME", new thingtalk_1.Type.Entity('tt:path_name'), C.entityOrNumberValueKeyFn, {});
    $grammar.declareSymbol("constant_Number");
    $grammar.addConstants("constant_Number", "NUMBER", thingtalk_1.Type.Number, C.entityOrNumberValueKeyFn, {});
    $grammar.declareSymbol("constant_Currency");
    $grammar.addConstants("constant_Currency", "CURRENCY", thingtalk_1.Type.Currency, C.valueKeyFn, {});
    $grammar.declareSymbol("constant_Time");
    $grammar.addConstants("constant_Time", "TIME", thingtalk_1.Type.Time, C.valueKeyFn, {});
    $grammar.declareSymbol("constant_Date");
    $grammar.addConstants("constant_Date", "DATE", thingtalk_1.Type.Date, C.valueKeyFn, {});
    $grammar.declareSymbol("constant_Location");
    $grammar.addConstants("constant_Location", "LOCATION", thingtalk_1.Type.Location, C.valueKeyFn, {});
    $grammar.declareSymbol("constant_Entity__tt__picture");
    $grammar.declareSymbol("constant_Entity__tt__function");
    $grammar.declareSymbol("constant_Entity__tt__program");
    $grammar.declareSymbol("constant_Entity__tt__device");
    $grammar.declareSymbol("constant_Boolean");
    $grammar.declareSymbol("constant_RecurrentTimeSpecification");
    $grammar.declareSymbol("constant_Measure_ms");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_ms", "MEASURE_ms", new thingtalk_1.Type.Measure('ms'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_byte");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_byte", "MEASURE_byte", new thingtalk_1.Type.Measure('byte'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_kg");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_kg", "MEASURE_kg", new thingtalk_1.Type.Measure('kg'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_C");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_C", "MEASURE_C", new thingtalk_1.Type.Measure('C'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_m");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_m", "MEASURE_m", new thingtalk_1.Type.Measure('m'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_m2");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_m2", "MEASURE_m2", new thingtalk_1.Type.Measure('m2'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_m3");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_m3", "MEASURE_m3", new thingtalk_1.Type.Measure('m3'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_m2");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_m2", "MEASURE_m2", new thingtalk_1.Type.Measure('m2'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_m3");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_m3", "MEASURE_m3", new thingtalk_1.Type.Measure('m3'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_mps");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_mps", "MEASURE_mps", new thingtalk_1.Type.Measure('mps'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_Pa");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_Pa", "MEASURE_Pa", new thingtalk_1.Type.Measure('Pa'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_kcal");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_kcal", "MEASURE_kcal", new thingtalk_1.Type.Measure('kcal'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_W");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_W", "MEASURE_W", new thingtalk_1.Type.Measure('W'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_lx");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_lx", "MEASURE_lx", new thingtalk_1.Type.Measure('lx'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_lm");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_lm", "MEASURE_lm", new thingtalk_1.Type.Measure('lm'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_dB");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_dB", "MEASURE_dB", new thingtalk_1.Type.Measure('dB'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Measure_dBm");
    if ($options.flags.inference) {
        $grammar.addConstants("constant_Measure_dBm", "MEASURE_dBm", new thingtalk_1.Type.Measure('byte'), C.valueKeyFn, {});
    }
    $grammar.declareSymbol("constant_Any");
    if (!$options.flags.unbalanced) {
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_String", undefined)], (($0) => { return $0; }), C.valueKeyFn, { repeat: (true), identity: (true) });
    }
    if ($options.flags.unbalanced) {
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_String", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    }
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Entity__tt__picture", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Entity__tt__username", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Entity__tt__hashtag", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Entity__tt__phone_number", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Entity__tt__email_address", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Entity__tt__path_name", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Number", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Time", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Location", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Currency", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    if (!$options.flags.turking) {
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Entity__tt__url", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Date", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_ms", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_byte", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_mps", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_m", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_m2", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_m3", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_C", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_kg", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_Pa", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_kcal", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_W", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_lx", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_lm", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_dB", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Measure_dBm", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
        $grammar.addRule("constant_Any", [new $runtime.NonTerminal("constant_Boolean", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    }
    $grammar.declareSymbol("constant_Numeric");
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Number", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Currency", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_ms", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_byte", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_mps", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_m", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_m2", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_m3", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_C", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_kg", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_Pa", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_kcal", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_W", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_lx", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_lm", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_dB", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
    $grammar.addRule("constant_Numeric", [new $runtime.NonTerminal("constant_Measure_dBm", undefined)], (($0) => { return $0; }), C.valueKeyFn, { identity: (true) });
}
exports.default = default_1;
;
//# sourceMappingURL=common-constants.genie.js.map