var ivprogCore = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./grammar/en/ivprog.g4": /*!******************************!*\ !*** ./grammar/en/ivprog.g4 ***! \******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { // Generated from /tmp/tmp-20960K1oDCbiw48SG/ivprog.g4 by ANTLR 4.7 // jshint ignore: start var antlr4 = __webpack_require__(2); var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964", "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004", "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t", "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004", "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010", "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013", "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017", "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a", "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e", "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#", "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004", "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004", "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004", "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003", "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003", "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003", "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003", "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003", "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003", "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003", "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003", "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003", "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003", "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003", "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003", "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003", "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003", "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003", "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003", "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003", "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003", "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003", "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003", "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003", "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003", "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003", "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003", "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003", "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003", "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003", "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003", "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003", "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e", "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d", "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e", ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,", "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168", "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-", "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e", ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003", "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003", "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196", "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0", "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003", "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003", "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b", "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7", "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003", "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b", "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b", "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+", "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d", "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.", "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002", "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002", "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f", "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b", "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002", "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003", "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003", "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003", "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003", "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003", "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003", "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003", "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003", "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002", "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002", "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002", "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002", "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003", "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002", "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002", "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002", "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002", "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003", "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002", "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002", "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002", "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003", "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080", "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d", "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c", "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad", "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc", "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb", "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6", "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003", "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002", "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002", "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002", "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105", "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003", "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002", "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002", "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002", "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124", "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003", "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002", "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002", "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002", "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189", "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003", "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002", "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002", "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002", "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007", "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002", "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g", "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006", "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082", "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007", "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002", "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002", "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a", "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003", "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007", "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002", "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002", "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095", "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098", "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007", "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002", "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002", "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002", "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2", "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5", "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7", "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007", "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002", "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002", "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002", "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1", "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3", "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6", "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007", "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002", "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002", "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002", "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0", "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2", "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5", "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007", "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002", "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002", "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002", "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf", "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c", "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4", "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003", "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007", "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002", "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002", "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de", "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1", "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007", "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002", "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002", "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9", "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec", "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007", "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002", "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002", "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4", "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7", "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007", "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002", "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002", "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff", "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102", "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007", "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002", "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002", "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a", ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003", "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003", "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002", "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002", "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002", "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117", "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a", "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007", "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002", "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002", "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122", "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b", "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f", "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122", "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127", "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005", "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002", "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002", "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002", "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002", "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002", "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003", "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003", "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003", "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003", "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007", "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002", "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002", "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002", "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002", "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002", "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002", "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148", "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149", "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b", "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e", "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f", "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136", "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149", "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154", "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155", "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156", "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159", "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003", "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003", "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003", "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003", "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003", "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003", "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007", "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002", "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002", "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002", "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002", "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002", "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e", "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f", "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171", "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173", "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174", "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178", "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003", "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003", "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003", "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002", "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180", "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181", "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186", "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002", "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002", "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002", "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002", "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e", "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002", "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002", "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002", "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002", "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002", "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198", "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003", "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010", "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f", "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f", "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1", "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4", "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002", "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8", "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab", "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002", "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002", "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002", "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1", "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002", "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6", "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8", "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd", "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc", "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb", "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be", "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1", "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3", "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003", "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003", "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003", "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003", "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007", ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002", "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002", "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002", "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b", "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac", "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join(""); var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN); var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); }); function ivprog(input) { antlr4.Lexer.call(this, input); this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache()); return this; } ivprog.prototype = Object.create(antlr4.Lexer.prototype); ivprog.prototype.constructor = ivprog; ivprog.EOF = antlr4.Token.EOF; ivprog.RK_PROGRAM = 1; ivprog.RK_REAL = 2; ivprog.RK_VOID = 3; ivprog.RK_BOOLEAN = 4; ivprog.RK_STRING = 5; ivprog.RK_INTEGER = 6; ivprog.RK_CHARACTER = 7; ivprog.RK_SWITCH = 8; ivprog.RK_CASE = 9; ivprog.RK_DEFAULT = 10; ivprog.RK_CONST = 11; ivprog.RK_FUNCTION = 12; ivprog.RK_RETURN = 13; ivprog.RK_FOR = 14; ivprog.RK_BREAK = 15; ivprog.RK_DO = 16; ivprog.RK_WHILE = 17; ivprog.RK_IF = 18; ivprog.RK_ELSE = 19; ivprog.RK_FALSE = 20; ivprog.RK_TRUE = 21; ivprog.OPEN_PARENTHESIS = 22; ivprog.CLOSE_PARENTHESIS = 23; ivprog.OPEN_BRACE = 24; ivprog.CLOSE_BRACE = 25; ivprog.OPEN_CURLY = 26; ivprog.CLOSE_CURLY = 27; ivprog.COMMA = 28; ivprog.EQUAL = 29; ivprog.SUM_OP = 30; ivprog.MULTI_OP = 31; ivprog.AND_OPERATOR = 32; ivprog.OR_OPERATOR = 33; ivprog.RELATIONAL_OPERATOR = 34; ivprog.COLON = 35; ivprog.NOT_OPERATOR = 36; ivprog.ID = 37; ivprog.LIB_ID = 38; ivprog.INTEGER = 39; ivprog.REAL = 40; ivprog.STRING = 41; ivprog.CHARACTER = 42; ivprog.WHITESPACE = 43; ivprog.EOS = 44; ivprog.COMMENTS = 45; ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ]; ivprog.prototype.modeNames = [ "DEFAULT_MODE" ]; ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'", "'boolean'", "'string'", "'integer'", "'character'", "'switch'", "'case'", "'otherwise'", "'const'", "'function'", "'return'", "'for'", "'break'", "'do'", "'while'", "'if'", "'else'", "'false'", "'true'", "'('", "')'", "'['", "']'", "'{'", "'}'", "','", "'='", null, null, null, null, null, "':'" ]; ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER", "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST", "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE", "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR", "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR", "ID", "LIB_ID", "INTEGER", "REAL", "STRING", "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ]; ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER", "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST", "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT", "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR", "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR", "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart", "STRING", "STRING_CHARACTER", "CHARACTER", "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT", "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE", "COMMENTS" ]; ivprog.prototype.grammarFileName = "ivprog.g4"; exports.ivprog = ivprog; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { module.exports = { ivprog: __webpack_require__(0).ivprog }; /***/ }), /* 2 */ /***/ (function(module, exports) { module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js"); /***/ }) /******/ ]); /***/ }), /***/ "./grammar/en/langFunctions.js": /*!*************************************!*\ !*** ./grammar/en/langFunctions.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* This is a dictionary of the language defined functions **/ exports.default = { main_function: "start", $read: "read", $write: "write", $numElements: "numero_elementos", $matrixLines: "matriz_linhas", $matrixColumns: "matriz_colunas", $substring: "subcadeia", $length: "comprimento", $uppercase: "caixa_alta", $lowercase: "caixa_baixa", $charAt: "char_at", $isReal: "e_real", $isInt: "e_inteiro", $isBool: "e_logico", $castReal: "como_real", $castInt: "como_inteiro", $castBool: "como_logico", $castString: "como_cadeia", $sin: "sen", $cos: "cos", $tan: "tan", $sqrt: "raiz_quadrada", $pow: "pot", $log: "log", $abs: "modulo", $negate: "trocar_sinal", $invert: "inverter_valor", $max: "maximo", $min: "minimo" }; /***/ }), /***/ "./grammar/en/langLibs.js": /*!********************************!*\ !*** ./grammar/en/langLibs.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * This is the dictionary of the language defined libraries */ exports.default = { $mathLib: "Matematica", $ioLib: "ES", $strLib: "Texto", $arrayLib: "Arranjo", $langLib: "IV" }; /***/ }), /***/ "./grammar/es/ivprog.g4": /*!******************************!*\ !*** ./grammar/es/ivprog.g4 ***! \******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { // Generated from /tmp/tmp-20960KdmtVbsL5rbX/ivprog.g4 by ANTLR 4.7 // jshint ignore: start var antlr4 = __webpack_require__(2); var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964", "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004", "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t", "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004", "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010", "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013", "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017", "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a", "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e", "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#", "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004", "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004", "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004", "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003", "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003", "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003", "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003", "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003", "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003", "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003", "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003", "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003", "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b", "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b", "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f", "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003", "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003", "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003", "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003", "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003", "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003", "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003", "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003", "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003", "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003", "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003", "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003", "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003", "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003", "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003", "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003", "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003", "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003", "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003", "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e", "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158", "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e", ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,", "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173", "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-", "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e", ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003", "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003", "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1", "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab", "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003", "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003", "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b", "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2", "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003", "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b", "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b", "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+", "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d", "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.", "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002", "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002", "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f", "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b", "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002", "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003", "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003", "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003", "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003", "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003", "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003", "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003", "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003", "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002", "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002", "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002", "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002", "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003", "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002", "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002", "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002", "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002", "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003", "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002", "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002", "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002", "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003", "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081", "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e", "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d", "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af", "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be", "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb", "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8", "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003", "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002", "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002", "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002", "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110", "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003", "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002", "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002", "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002", "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f", "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003", "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002", "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002", "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002", "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194", "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003", "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002", "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002", "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002", "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007", "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002", "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t", "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080", "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082", "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007", "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002", "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002", "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a", "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d", "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007", "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002", "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002", "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095", "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098", "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007", "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002", "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002", "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002", "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2", "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5", "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003", "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007", "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002", "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002", "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002", "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1", "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014", "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6", "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007", "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002", "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002", "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002", "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0", "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3", "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5", "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007", "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002", "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002", "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002", "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf", "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2", "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4", "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007", "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002", "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002", "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002", "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de", "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1", "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007", "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002", "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002", "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9", "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec", "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002", "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002", "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002", "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4", "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7", "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007", "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002", "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002", "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff", "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102", "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007", "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002", "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002", "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a", "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d", "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007", "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002", "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002", "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115", ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003", "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003", "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002", "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002", "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002", "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122", "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125", "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007", "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002", "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002", "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d", "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126", "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a", "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d", "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132", "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005", "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002", "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002", "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002", "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002", "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002", "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003", "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003", "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003", "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003", "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007", "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002", "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002", "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002", "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002", "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002", "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002", "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153", "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154", "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156", "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159", "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a", "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141", "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154", "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f", "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160", "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161", "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164", "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003", "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003", "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003", "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003", "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003", "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003", "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007", "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002", "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002", "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002", "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002", "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002", "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179", "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a", "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c", "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e", "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f", "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183", "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003", "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003", "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003", "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002", "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b", "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c", "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191", "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002", "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002", "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002", "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002", "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199", "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002", "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002", "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002", "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002", "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002", "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3", "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003", "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010", "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa", "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa", "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac", "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af", "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002", "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3", "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6", "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002", "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002", "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002", "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc", "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002", "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1", "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3", "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8", "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7", "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6", "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9", "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc", "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce", "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003", "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003", "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003", "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003", "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007", ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002", "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002", "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002", "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166", "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7", "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join(""); var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN); var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); }); function ivprog(input) { antlr4.Lexer.call(this, input); this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache()); return this; } ivprog.prototype = Object.create(antlr4.Lexer.prototype); ivprog.prototype.constructor = ivprog; ivprog.EOF = antlr4.Token.EOF; ivprog.RK_PROGRAM = 1; ivprog.RK_REAL = 2; ivprog.RK_VOID = 3; ivprog.RK_BOOLEAN = 4; ivprog.RK_STRING = 5; ivprog.RK_INTEGER = 6; ivprog.RK_CHARACTER = 7; ivprog.RK_SWITCH = 8; ivprog.RK_CASE = 9; ivprog.RK_DEFAULT = 10; ivprog.RK_CONST = 11; ivprog.RK_FUNCTION = 12; ivprog.RK_RETURN = 13; ivprog.RK_FOR = 14; ivprog.RK_BREAK = 15; ivprog.RK_DO = 16; ivprog.RK_WHILE = 17; ivprog.RK_IF = 18; ivprog.RK_ELSE = 19; ivprog.RK_FALSE = 20; ivprog.RK_TRUE = 21; ivprog.OPEN_PARENTHESIS = 22; ivprog.CLOSE_PARENTHESIS = 23; ivprog.OPEN_BRACE = 24; ivprog.CLOSE_BRACE = 25; ivprog.OPEN_CURLY = 26; ivprog.CLOSE_CURLY = 27; ivprog.COMMA = 28; ivprog.EQUAL = 29; ivprog.SUM_OP = 30; ivprog.MULTI_OP = 31; ivprog.AND_OPERATOR = 32; ivprog.OR_OPERATOR = 33; ivprog.RELATIONAL_OPERATOR = 34; ivprog.COLON = 35; ivprog.NOT_OPERATOR = 36; ivprog.ID = 37; ivprog.LIB_ID = 38; ivprog.INTEGER = 39; ivprog.REAL = 40; ivprog.STRING = 41; ivprog.CHARACTER = 42; ivprog.WHITESPACE = 43; ivprog.EOS = 44; ivprog.COMMENTS = 45; ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ]; ivprog.prototype.modeNames = [ "DEFAULT_MODE" ]; ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'", "'logico'", "'cadeia'", "'inteiro'", "'caractere'", "'escolha'", "'caso'", "'contrario'", "'const'", "'funcao'", "'retorne'", "'para'", "'pare'", "'faca'", "'enquanto'", "'se'", "'senao'", "'falso'", "'verdadeiro'", "'('", "')'", "'['", "']'", "'{'", "'}'", "','", "'='", null, null, null, null, null, "':'" ]; ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER", "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST", "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE", "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR", "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR", "ID", "LIB_ID", "INTEGER", "REAL", "STRING", "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ]; ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER", "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST", "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT", "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR", "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR", "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart", "STRING", "STRING_CHARACTER", "CHARACTER", "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT", "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE", "COMMENTS" ]; ivprog.prototype.grammarFileName = "ivprog.g4"; exports.ivprog = ivprog; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { module.exports = { ivprog: __webpack_require__(0).ivprog }; /***/ }), /* 2 */ /***/ (function(module, exports) { module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js"); /***/ }) /******/ ]); /***/ }), /***/ "./grammar/es/langFunctions.js": /*!*************************************!*\ !*** ./grammar/es/langFunctions.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* This is a dictionary of the language defined functions **/ exports.default = { main_function: "inicio", $read: "leia", $write: "escreva", $numElements: "numero_elementos", $matrixLines: "matriz_linhas", $matrixColumns: "matriz_colunas", $substring: "subcadeia", $length: "comprimento", $uppercase: "caixa_alta", $lowercase: "caixa_baixa", $charAt: "char_at", $isReal: "e_real", $isInt: "e_inteiro", $isBool: "e_logico", $castReal: "como_real", $castInt: "como_inteiro", $castBool: "como_logico", $castString: "como_cadeia", $sin: "sen", $cos: "cos", $tan: "tan", $sqrt: "raiz_quadrada", $pow: "pot", $log: "log", $abs: "modulo", $negate: "trocar_sinal", $invert: "inverter_valor", $max: "maximo", $min: "minimo" }; /***/ }), /***/ "./grammar/es/langLibs.js": /*!********************************!*\ !*** ./grammar/es/langLibs.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * This is the dictionary of the language defined libraries */ exports.default = { $mathLib: "Matematica", $ioLib: "ES", $strLib: "Texto", $arrayLib: "Arranjo", $langLib: "IV" }; /***/ }), /***/ "./grammar/index.js": /*!**************************!*\ !*** ./grammar/index.js ***! \**************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4"); var PT = _interopRequireWildcard(_ivprog); var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js"); var _langFunctions2 = _interopRequireDefault(_langFunctions); var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js"); var _langLibs2 = _interopRequireDefault(_langLibs); var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4"); var EN = _interopRequireWildcard(_ivprog2); var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js"); var _langFunctions4 = _interopRequireDefault(_langFunctions3); var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js"); var _langLibs4 = _interopRequireDefault(_langLibs3); var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4"); var ES = _interopRequireWildcard(_ivprog3); var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js"); var _langFunctions6 = _interopRequireDefault(_langFunctions5); var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js"); var _langLibs6 = _interopRequireDefault(_langLibs5); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default }; exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default }; exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default }; /***/ }), /***/ "./grammar/pt/ivprog.g4": /*!******************************!*\ !*** ./grammar/pt/ivprog.g4 ***! \******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { // Generated from /tmp/tmp-20960Z6cKJnRTJX3z/ivprog.g4 by ANTLR 4.7 // jshint ignore: start var antlr4 = __webpack_require__(2); var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964", "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004", "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t", "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004", "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010", "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013", "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017", "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a", "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e", "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#", "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004", "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004", "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004", "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003", "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003", "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003", "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003", "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003", "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003", "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003", "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003", "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003", "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b", "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b", "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f", "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003", "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003", "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003", "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003", "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003", "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003", "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003", "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003", "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003", "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003", "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003", "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003", "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003", "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003", "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003", "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003", "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003", "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003", "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003", "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e", "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158", "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e", ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,", "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173", "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-", "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e", ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003", "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003", "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1", "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab", "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003", "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003", "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b", "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2", "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003", "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b", "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b", "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+", "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d", "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.", "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002", "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002", "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f", "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b", "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002", "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003", "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003", "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003", "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003", "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003", "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003", "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003", "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003", "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002", "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002", "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002", "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002", "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003", "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002", "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002", "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002", "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002", "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003", "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002", "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002", "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002", "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003", "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081", "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e", "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d", "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af", "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be", "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb", "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8", "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003", "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002", "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002", "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002", "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110", "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003", "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002", "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002", "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002", "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f", "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003", "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002", "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002", "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002", "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194", "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003", "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002", "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002", "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002", "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007", "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002", "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t", "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080", "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082", "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007", "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002", "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002", "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a", "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d", "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007", "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002", "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002", "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095", "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098", "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007", "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002", "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002", "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002", "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2", "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5", "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003", "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007", "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002", "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002", "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002", "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1", "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014", "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6", "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007", "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002", "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002", "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002", "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0", "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3", "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5", "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007", "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002", "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002", "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002", "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf", "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2", "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4", "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007", "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002", "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002", "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002", "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de", "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1", "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007", "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002", "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002", "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9", "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec", "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002", "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002", "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002", "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4", "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7", "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007", "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002", "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002", "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff", "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102", "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007", "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002", "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002", "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a", "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d", "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007", "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002", "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002", "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115", ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003", "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003", "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002", "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002", "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002", "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122", "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125", "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007", "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002", "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002", "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d", "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126", "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a", "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d", "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132", "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005", "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002", "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002", "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002", "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002", "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002", "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003", "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003", "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003", "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003", "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007", "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002", "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002", "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002", "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002", "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002", "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002", "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153", "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154", "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156", "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159", "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a", "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141", "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154", "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f", "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160", "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161", "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164", "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003", "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003", "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003", "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003", "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003", "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003", "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007", "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002", "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002", "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002", "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002", "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002", "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179", "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a", "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c", "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e", "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f", "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183", "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003", "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003", "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003", "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002", "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b", "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c", "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191", "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002", "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002", "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002", "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002", "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199", "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002", "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002", "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002", "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002", "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002", "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3", "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003", "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010", "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa", "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa", "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac", "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af", "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002", "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3", "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6", "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002", "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002", "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002", "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc", "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002", "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1", "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3", "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8", "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7", "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6", "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9", "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc", "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce", "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003", "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003", "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003", "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003", "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007", ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002", "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002", "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002", "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166", "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7", "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join(""); var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN); var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); }); function ivprog(input) { antlr4.Lexer.call(this, input); this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache()); return this; } ivprog.prototype = Object.create(antlr4.Lexer.prototype); ivprog.prototype.constructor = ivprog; ivprog.EOF = antlr4.Token.EOF; ivprog.RK_PROGRAM = 1; ivprog.RK_REAL = 2; ivprog.RK_VOID = 3; ivprog.RK_BOOLEAN = 4; ivprog.RK_STRING = 5; ivprog.RK_INTEGER = 6; ivprog.RK_CHARACTER = 7; ivprog.RK_SWITCH = 8; ivprog.RK_CASE = 9; ivprog.RK_DEFAULT = 10; ivprog.RK_CONST = 11; ivprog.RK_FUNCTION = 12; ivprog.RK_RETURN = 13; ivprog.RK_FOR = 14; ivprog.RK_BREAK = 15; ivprog.RK_DO = 16; ivprog.RK_WHILE = 17; ivprog.RK_IF = 18; ivprog.RK_ELSE = 19; ivprog.RK_FALSE = 20; ivprog.RK_TRUE = 21; ivprog.OPEN_PARENTHESIS = 22; ivprog.CLOSE_PARENTHESIS = 23; ivprog.OPEN_BRACE = 24; ivprog.CLOSE_BRACE = 25; ivprog.OPEN_CURLY = 26; ivprog.CLOSE_CURLY = 27; ivprog.COMMA = 28; ivprog.EQUAL = 29; ivprog.SUM_OP = 30; ivprog.MULTI_OP = 31; ivprog.AND_OPERATOR = 32; ivprog.OR_OPERATOR = 33; ivprog.RELATIONAL_OPERATOR = 34; ivprog.COLON = 35; ivprog.NOT_OPERATOR = 36; ivprog.ID = 37; ivprog.LIB_ID = 38; ivprog.INTEGER = 39; ivprog.REAL = 40; ivprog.STRING = 41; ivprog.CHARACTER = 42; ivprog.WHITESPACE = 43; ivprog.EOS = 44; ivprog.COMMENTS = 45; ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ]; ivprog.prototype.modeNames = [ "DEFAULT_MODE" ]; ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'", "'logico'", "'cadeia'", "'inteiro'", "'caractere'", "'escolha'", "'caso'", "'contrario'", "'const'", "'funcao'", "'retorne'", "'para'", "'pare'", "'faca'", "'enquanto'", "'se'", "'senao'", "'falso'", "'verdadeiro'", "'('", "')'", "'['", "']'", "'{'", "'}'", "','", "'='", null, null, null, null, null, "':'" ]; ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER", "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST", "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE", "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR", "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR", "ID", "LIB_ID", "INTEGER", "REAL", "STRING", "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ]; ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER", "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST", "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT", "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR", "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR", "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart", "STRING", "STRING_CHARACTER", "CHARACTER", "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT", "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE", "COMMENTS" ]; ivprog.prototype.grammarFileName = "ivprog.g4"; exports.ivprog = ivprog; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { module.exports = { ivprog: __webpack_require__(0).ivprog }; /***/ }), /* 2 */ /***/ (function(module, exports) { module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js"); /***/ }) /******/ ]); /***/ }), /***/ "./grammar/pt/langFunctions.js": /*!*************************************!*\ !*** ./grammar/pt/langFunctions.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* This is a dictionary of the language defined functions **/ exports.default = { main_function: "inicio", $read: "leia", $write: "escreva", $numElements: "numero_elementos", $matrixLines: "matriz_linhas", $matrixColumns: "matriz_colunas", $substring: "subcadeia", $length: "comprimento", $uppercase: "caixa_alta", $lowercase: "caixa_baixa", $charAt: "char_at", $isReal: "e_real", $isInt: "e_inteiro", $isBool: "e_logico", $castReal: "como_real", $castInt: "como_inteiro", $castBool: "como_logico", $castString: "como_cadeia", $sin: "sen", $cos: "cos", $tan: "tan", $sqrt: "raiz_quadrada", $pow: "pot", $log: "log", $abs: "modulo", $negate: "trocar_sinal", $invert: "inverter_valor", $max: "maximo", $min: "minimo" }; /***/ }), /***/ "./grammar/pt/langLibs.js": /*!********************************!*\ !*** ./grammar/pt/langLibs.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * This is the dictionary of the language defined libraries */ exports.default = { $mathLib: "Matematica", $ioLib: "ES", $strLib: "Texto", $arrayLib: "Arranjo", $langLib: "IV" }; /***/ }), /***/ "./i18n/en/error.json": /*!****************************!*\ !*** ./i18n/en/error.json ***! \****************************/ /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, id_missing, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */ /***/ (function(module) { module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","unexpected_break_command":"Erro interno crítico: Comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida"}; /***/ }), /***/ "./i18n/en/index.js": /*!**************************!*\ !*** ./i18n/en/index.js ***! \**************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json"); var _error2 = _interopRequireDefault(_error); var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json"); var _message2 = _interopRequireDefault(_message); var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json"); var _ui2 = _interopRequireDefault(_ui); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { 'message': _message2.default, 'error': _error2.default, 'ui': _ui2.default }; /***/ }), /***/ "./i18n/en/message.json": /*!******************************!*\ !*** ./i18n/en/message.json ***! \******************************/ /*! exports provided: default */ /***/ (function(module) { module.exports = {}; /***/ }), /***/ "./i18n/en/ui.json": /*!*************************!*\ !*** ./i18n/en/ui.json ***! \*************************/ /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, default */ /***/ (function(module) { module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"text","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Arithmetic Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console"}; /***/ }), /***/ "./i18n/es/error.json": /*!****************************!*\ !*** ./i18n/es/error.json ***! \****************************/ /*! exports provided: default */ /***/ (function(module) { module.exports = {}; /***/ }), /***/ "./i18n/es/index.js": /*!**************************!*\ !*** ./i18n/es/index.js ***! \**************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json"); var _error2 = _interopRequireDefault(_error); var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json"); var _message2 = _interopRequireDefault(_message); var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json"); var _ui2 = _interopRequireDefault(_ui); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { 'message': _message2.default, 'error': _error2.default, 'ui': _ui2.default }; /***/ }), /***/ "./i18n/es/message.json": /*!******************************!*\ !*** ./i18n/es/message.json ***! \******************************/ /*! exports provided: default */ /***/ (function(module) { module.exports = {}; /***/ }), /***/ "./i18n/es/ui.json": /*!*************************!*\ !*** ./i18n/es/ui.json ***! \*************************/ /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_break, text_else, text_return, text_btn_return, text_for, text_code_while, text_code_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, default */ /***/ (function(module) { module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"text","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_break":"break","text_else":"else","text_return":"return","text_btn_return":"Return","text_for":"for","text_code_while":"while","text_code_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Arithmetic Expression","text_iftrue":"If true then","text_repeatNtimes":"Repeat N times","text_receives":"receives","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console"}; /***/ }), /***/ "./i18n/index.js": /*!***********************!*\ !*** ./i18n/index.js ***! \***********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js"); var _en2 = _interopRequireDefault(_en); var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js"); var _pt2 = _interopRequireDefault(_pt); var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js"); var _es2 = _interopRequireDefault(_es); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { 'en': _en2.default, 'pt': _pt2.default, 'es': _es2.default }; /***/ }), /***/ "./i18n/pt/error.json": /*!****************************!*\ !*** ./i18n/pt/error.json ***! \****************************/ /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */ /***/ (function(module) { module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","unexpected_break_command":"Erro interno crítico: Comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida"}; /***/ }), /***/ "./i18n/pt/index.js": /*!**************************!*\ !*** ./i18n/pt/index.js ***! \**************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json"); var _error2 = _interopRequireDefault(_error); var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json"); var _message2 = _interopRequireDefault(_message); var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json"); var _ui2 = _interopRequireDefault(_ui); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { 'message': _message2.default, 'error': _error2.default, 'ui': _ui2.default }; /***/ }), /***/ "./i18n/pt/message.json": /*!******************************!*\ !*** ./i18n/pt/message.json ***! \******************************/ /*! exports provided: default */ /***/ (function(module) { module.exports = {}; /***/ }), /***/ "./i18n/pt/ui.json": /*!*************************!*\ !*** ./i18n/pt/ui.json ***! \*************************/ /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_return, text_btn_return, text_comment, join_or, text_attribution, text_if, text_break, text_else, text_for, text_code_while, text_code_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, default */ /***/ (function(module) { module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","real":"real","program":"programa","text":"cadeia","text_start":"texto","boolean":"logico","true":"verdadeiro","false":"falso","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"retorne","text_btn_return":"Retorno","text_comment":"Comentário","join_or":"ou","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"para","text_code_while":"enquanto","text_code_do":"faça","text_code_switch":"escolha","text_code_case":"caso","text_logic_expression":"Expressão Lógica","text_arithmetic_expression":"Expressão Aritmética","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal"}; /***/ }), /***/ "./js/assessment/ivprogAssessment.js": /*!*******************************************!*\ !*** ./js/assessment/ivprogAssessment.js ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IVProgAssessment = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js"); var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js"); var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js"); var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js"); var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var IVProgAssessment = exports.IVProgAssessment = function () { function IVProgAssessment(textCode, testCases, domConsole) { _classCallCheck(this, IVProgAssessment); this.textCode = textCode; this.testCases = testCases; this.domConsole = domConsole; } _createClass(IVProgAssessment, [{ key: "runTest", value: function runTest() { var outerRef = this; return new Promise(function (resolve, _) { try { // try and show error messages through domconsole var parser = _ivprogParser.IVProgParser.createParser(outerRef.textCode); var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree()); var validTree = semantic.analyseTree(); // loop test cases and show messages through domconsole var tests = outerRef.testCases.map(function (t, name) { return outerRef.evaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name); }); Promise.all(tests).then(function (results) { var count = results.reduce(function (lastValue, nextValue) { return lastValue + nextValue; }, 0); resolve(count / outerRef.testCases.length); }).catch(function (err) { outerRef.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole outerRef.domConsole.err(err.message); resolve(0); }); } catch (error) { outerRef.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole outerRef.domConsole.err(error.message); resolve(0); } }); } }, { key: "evaluateTestCase", value: function evaluateTestCase(prog, inputList, outputList, name) { var outerThis = this; return new Promise(function (resolve, reject) { var input = new _inputTest.InputTest(inputList); var output = new _outputTest.OutputTest(); prog.registerInput(input); prog.registerOutput(output); var startTime = Date.now(); prog.interpretAST().then(function (_) { var millis = Date.now() - startTime; if (input.inputList.length !== input.index) { outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!"); outerThis.domConsole.info("Levou " + millis + "ms"); resolve(1 * (input.index / inputList.length)); } else if (output.list.length < outputList.length) { outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">"); outerThis.domConsole.info("Levou " + millis + "ms"); resolve(1 * (output.list.length / outputList.length)); } else if (output.list.length > outputList.length) { outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">"); outerThis.domConsole.info("Levou " + millis + "ms"); resolve(1 * (outputList.length / output.list.length)); } else { var isOk = outerThis.checkOutput(output.list, outputList); if (!isOk) { outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">"); outerThis.domConsole.info("Levou " + millis + "ms"); resolve(0); } else { outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!"); outerThis.domConsole.info("Levou " + millis + "ms"); resolve(1); } } }).catch(function (_) { return resolve(0); }); }); } }, { key: "checkOutput", value: function checkOutput(aList, bList) { for (var i = 0; i < aList.length; i++) { var outValue = aList[i]; if (outValue != bList[i]) { return false; } } return true; } }]); return IVProgAssessment; }(); /***/ }), /***/ "./js/ast/commands/arrayAssign.js": /*!****************************************!*\ !*** ./js/ast/commands/arrayAssign.js ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArrayIndexAssign = undefined; var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) { _inherits(ArrayIndexAssign, _Assign); function ArrayIndexAssign(id, lineExpression, columnExpression, expression) { _classCallCheck(this, ArrayIndexAssign); var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression)); _this.line = lineExpression; _this.column = columnExpression; return _this; } return ArrayIndexAssign; }(_assign.Assign); /***/ }), /***/ "./js/ast/commands/arrayDeclaration.js": /*!*********************************************!*\ !*** ./js/ast/commands/arrayDeclaration.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArrayDeclaration = undefined; var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) { _inherits(ArrayDeclaration, _Declaration); function ArrayDeclaration(id, type, lines, columns, initial, isConst) { _classCallCheck(this, ArrayDeclaration); var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst)); _this.lines = lines; _this.columns = columns; return _this; } return ArrayDeclaration; }(_declaration.Declaration); /***/ }), /***/ "./js/ast/commands/assign.js": /*!***********************************!*\ !*** ./js/ast/commands/assign.js ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Assign = undefined; var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Assign = exports.Assign = function (_Command) { _inherits(Assign, _Command); function Assign(id, expression) { _classCallCheck(this, Assign); var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this)); _this.id = id; _this.expression = expression; return _this; } return Assign; }(_command.Command); /***/ }), /***/ "./js/ast/commands/break.js": /*!**********************************!*\ !*** ./js/ast/commands/break.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Break = undefined; var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Break = exports.Break = function (_Command) { _inherits(Break, _Command); function Break() { _classCallCheck(this, Break); return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this)); } return Break; }(_command.Command); /***/ }), /***/ "./js/ast/commands/case.js": /*!*********************************!*\ !*** ./js/ast/commands/case.js ***! \*********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Case = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Case = exports.Case = function (_Command) { _inherits(Case, _Command); function Case(expression) { _classCallCheck(this, Case); var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this)); _this.expression = expression; _this.commands = []; return _this; } _createClass(Case, [{ key: 'setCommands', value: function setCommands(commands) { this.commands = commands; } }, { key: 'isDefault', get: function get() { return this.expression === null; } }]); return Case; }(_command.Command); /***/ }), /***/ "./js/ast/commands/command.js": /*!************************************!*\ !*** ./js/ast/commands/command.js ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Command = exports.Command = function () { function Command() { _classCallCheck(this, Command); this._sourceInfo = null; } _createClass(Command, [{ key: "sourceInfo", set: function set(sourceInfo) { this._sourceInfo = sourceInfo; }, get: function get() { return this._sourceInfo; } }]); return Command; }(); /***/ }), /***/ "./js/ast/commands/commandBlock.js": /*!*****************************************!*\ !*** ./js/ast/commands/commandBlock.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var CommandBlock = exports.CommandBlock = function () { function CommandBlock(variables, commands) { _classCallCheck(this, CommandBlock); this.variables = variables; this.commands = commands; this._sourceInfo = null; } _createClass(CommandBlock, [{ key: "sourceInfo", set: function set(sourceInfo) { this._sourceInfo = sourceInfo; }, get: function get() { return this._sourceInfo; } }]); return CommandBlock; }(); /***/ }), /***/ "./js/ast/commands/declaration.js": /*!****************************************!*\ !*** ./js/ast/commands/declaration.js ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Declaration = undefined; var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Declaration = exports.Declaration = function (_Command) { _inherits(Declaration, _Command); function Declaration(id, type, initial, isConst) { _classCallCheck(this, Declaration); var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this)); _this.id = id; _this.type = type; _this.initial = initial; _this.isConst = isConst; return _this; } return Declaration; }(_command.Command); /***/ }), /***/ "./js/ast/commands/doWhile.js": /*!************************************!*\ !*** ./js/ast/commands/doWhile.js ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DoWhile = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var DoWhile = exports.DoWhile = function (_While) { _inherits(DoWhile, _While); function DoWhile(condition, commandBlock) { _classCallCheck(this, DoWhile); return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock)); } _createClass(DoWhile, [{ key: 'testFirst', get: function get() { return false; } }]); return DoWhile; }(_while.While); /***/ }), /***/ "./js/ast/commands/for.js": /*!********************************!*\ !*** ./js/ast/commands/for.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.For = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var For = exports.For = function (_Command) { _inherits(For, _Command); function For(assignment, condition, increment, commandBlock) { _classCallCheck(this, For); var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this)); _this.assignment = assignment; _this.condition = condition; _this.increment = increment; _this.commandBlock = commandBlock; return _this; } _createClass(For, [{ key: 'commands', get: function get() { return this.commandBlock.commands; } }]); return For; }(_command.Command); /***/ }), /***/ "./js/ast/commands/formalParameter.js": /*!********************************************!*\ !*** ./js/ast/commands/formalParameter.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var FormalParameter = exports.FormalParameter = function () { function FormalParameter(type, id) { var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; _classCallCheck(this, FormalParameter); this.type = type; this.id = id; this.byRef = byRef; this._sourceInfo = null; } _createClass(FormalParameter, [{ key: "sourceInfo", set: function set(sourceInfo) { this._sourceInfo = sourceInfo; }, get: function get() { return this._sourceInfo; } }]); return FormalParameter; }(); /***/ }), /***/ "./js/ast/commands/function.js": /*!*************************************!*\ !*** ./js/ast/commands/function.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Function = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Function = exports.Function = function () { function Function(name, returnType, formalParameters, commandBlock) { _classCallCheck(this, Function); this.name = name; this.returnType = returnType; this.formalParameters = formalParameters; this.commandBlock = commandBlock; this._sourceInfo = null; } _createClass(Function, [{ key: 'isMain', get: function get() { return this.name === null && this.returnType.isCompatible(_types.Types.VOID); } }, { key: 'commands', get: function get() { return this.commandBlock.commands; } }, { key: 'variablesDeclarations', get: function get() { return this.commandBlock.variables; } }, { key: 'sourceInfo', set: function set(sourceInfo) { this._sourceInfo = sourceInfo; }, get: function get() { return this._sourceInfo; } }]); return Function; }(); /***/ }), /***/ "./js/ast/commands/ifThenElse.js": /*!***************************************!*\ !*** ./js/ast/commands/ifThenElse.js ***! \***************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IfThenElse = undefined; var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var IfThenElse = exports.IfThenElse = function (_Command) { _inherits(IfThenElse, _Command); function IfThenElse(condition, ifTrue, ifFalse) { _classCallCheck(this, IfThenElse); var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this)); _this.condition = condition; _this.ifTrue = ifTrue; _this.ifFalse = ifFalse; return _this; } return IfThenElse; }(_command.Command); /***/ }), /***/ "./js/ast/commands/index.js": /*!**********************************!*\ !*** ./js/ast/commands/index.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FunctionCall = exports.FormalParameter = exports.SysCall = exports.Case = exports.Switch = exports.DoWhile = exports.CommandBlock = exports.IfThenElse = exports.Function = exports.For = exports.While = exports.ArrayDeclaration = exports.Declaration = exports.ArrayIndexAssign = exports.Assign = exports.Return = exports.Break = undefined; var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js"); var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js"); var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js"); var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js"); var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js"); var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js"); var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js"); var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js"); var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js"); var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js"); var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js"); var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js"); var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js"); var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js"); var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js"); var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js"); var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js"); //Proxy to expression since they do exatcly the same thing exports.Break = _break.Break; exports.Return = _return.Return; exports.Assign = _assign.Assign; exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign; exports.Declaration = _declaration.Declaration; exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration; exports.While = _while.While; exports.For = _for.For; exports.Function = _function.Function; exports.IfThenElse = _ifThenElse.IfThenElse; exports.CommandBlock = _commandBlock.CommandBlock; exports.DoWhile = _doWhile.DoWhile; exports.Switch = _switch.Switch; exports.Case = _case.Case; exports.SysCall = _sysCall.SysCall; exports.FormalParameter = _formalParameter.FormalParameter; exports.FunctionCall = _functionCall.FunctionCall; /***/ }), /***/ "./js/ast/commands/return.js": /*!***********************************!*\ !*** ./js/ast/commands/return.js ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Return = undefined; var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Return = exports.Return = function (_Command) { _inherits(Return, _Command); function Return(expression) { _classCallCheck(this, Return); var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this)); _this.expression = expression; return _this; } return Return; }(_command.Command); /***/ }), /***/ "./js/ast/commands/switch.js": /*!***********************************!*\ !*** ./js/ast/commands/switch.js ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Switch = undefined; var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Switch = exports.Switch = function (_Command) { _inherits(Switch, _Command); function Switch(expression, cases) { _classCallCheck(this, Switch); var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this)); _this.expression = expression; _this.cases = cases; return _this; } return Switch; }(_command.Command); /***/ }), /***/ "./js/ast/commands/sysCall.js": /*!************************************!*\ !*** ./js/ast/commands/sysCall.js ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * This class represents all the language defined functions. * The language processor uses the id provided here to properly execute the desired function. * The function is actually implemented inside the language processor. * All the functions can be found at: js/processor/definedFunctions.js */ var SysCall = exports.SysCall = function SysCall(langFunc) { _classCallCheck(this, SysCall); this.langFunc = langFunc; }; /***/ }), /***/ "./js/ast/commands/while.js": /*!**********************************!*\ !*** ./js/ast/commands/while.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.While = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var While = exports.While = function (_Command) { _inherits(While, _Command); function While(expression, commandBlock) { _classCallCheck(this, While); var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this)); _this.expression = expression; _this.commandBlock = commandBlock; return _this; } _createClass(While, [{ key: 'commands', get: function get() { return this.commandBlock.commands; } }, { key: 'testFirst', get: function get() { return true; } }]); return While; }(_command.Command); /***/ }), /***/ "./js/ast/error/syntaxError.js": /*!*************************************!*\ !*** ./js/ast/error/syntaxError.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var SyntaxError = exports.SyntaxError = function (_Error) { _inherits(SyntaxError, _Error); function SyntaxError() { var _ref; _classCallCheck(this, SyntaxError); for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) { msg[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg))); if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError); return _this; } return SyntaxError; }(Error); /***/ }), /***/ "./js/ast/error/syntaxErrorFactory.js": /*!********************************************!*\ !*** ./js/ast/error/syntaxErrorFactory.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SyntaxErrorFactory = undefined; var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js"); var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js"); var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({ extra_lines: function extra_lines() { return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines")); }, token_missing_one: function token_missing_one(expected, token) { var context = [expected, token.text, token.line, token.column]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context)); }, token_missing_list: function token_missing_list(expectedList, token) { var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR()); return SyntaxErrorFactory.token_missing_one(line, token); }, id_missing: function id_missing(token) { var context = [token.text, token.line, token.column]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context)); }, eos_missing: function eos_missing(token) { var context = [token.line, token.column]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context)); }, invalid_array_dimension: function invalid_array_dimension(typeName, token) { var context = [token.line, token.column, typeName]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context)); }, invalid_array_size: function invalid_array_size(token) { var context = [token.line]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context)); }, invalid_main_return: function invalid_main_return(name, typeName, token) { var context = [name, typeName, token.line]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context)); }, invalid_var_declaration: function invalid_var_declaration(token) { var context = [token.line]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context)); }, invalid_break_command: function invalid_break_command(cmdName, token) { var context = [token.line, cmdName]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context)); }, invalid_terminal: function invalid_terminal() { var context = [token.text, token.line, token.column]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context)); }, invalid_type: function invalid_type(list, token) { var line = list.join(_localizedStringsService.LocalizedStrings.getOR()); var context = [token.text, token.line, token.column, line]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context)); }, const_not_init: function const_not_init(token) { var context = [token.line, token.column]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context)); }, invalid_id_format: function invalid_id_format(token) { var context = [token.text, token.line, token.column]; return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context)); } }); /***/ }), /***/ "./js/ast/expressions/arrayAccess.js": /*!*******************************************!*\ !*** ./js/ast/expressions/arrayAccess.js ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArrayAccess = undefined; var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ArrayAccess = exports.ArrayAccess = function (_Expression) { _inherits(ArrayAccess, _Expression); function ArrayAccess(id, line, column) { _classCallCheck(this, ArrayAccess); var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this)); _this.id = id; _this.line = line; _this.column = column; return _this; } return ArrayAccess; }(_expression.Expression); /***/ }), /***/ "./js/ast/expressions/arrayLiteral.js": /*!********************************************!*\ !*** ./js/ast/expressions/arrayLiteral.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArrayLiteral = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ArrayLiteral = exports.ArrayLiteral = function (_Literal) { _inherits(ArrayLiteral, _Literal); function ArrayLiteral(type, value) { _classCallCheck(this, ArrayLiteral); var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type)); _this.value = value; return _this; } _createClass(ArrayLiteral, [{ key: 'validateType', value: function validateType() { // let valid = true; // if(this.columns !== null) { // const len = this.columns; // const len2 = this.lines; // for (let i = len - 1; i >= 0; i--) { // for (let j = len2 - 1; j >= 0; j--) { // if(this.value[i].value[j].type !== this.subtype) { // valid = false; // break; // } // } // } // } else { // const len = this.lines; // for (var i = len - 1; i >= 0; i--) { // if(this.value[i].type !== this.subtype) { // valid = false; // break; // } // } // } return true; //valid; } }, { key: 'validateSize', value: function validateSize() { var valid = true; if (this.columns !== null) { var equalityTest = data.value.map(function (v) { return v.length; }).reduce(function (old, next) { if (old === null) { return next; } else if (old === next) { return old; } else { return -1; } }, null); valid = equalityTest !== -1; } return valid; } }, { key: 'subtype', get: function get() { var element = this.value[0]; if (element instanceof ArrayLiteral) { return element.value[0].type; } else { return element.type; } } }, { key: 'lines', get: function get() { return this.value.length; } }, { key: 'columns', get: function get() { var element = this.value[0]; if (!(element instanceof ArrayLiteral)) { return null; } else { return element.value[0].value.length; } } }, { key: 'isVector', get: function get() { return this.columns === null; } }, { key: 'isValid', get: function get() { return true; //this.validateType() && this.validateSize(); } }]); return ArrayLiteral; }(_literal.Literal); /***/ }), /***/ "./js/ast/expressions/boolLiteral.js": /*!*******************************************!*\ !*** ./js/ast/expressions/boolLiteral.js ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BoolLiteral = undefined; var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js"); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var BoolLiteral = exports.BoolLiteral = function (_Literal) { _inherits(BoolLiteral, _Literal); function BoolLiteral(value) { _classCallCheck(this, BoolLiteral); var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN)); _this.value = value; return _this; } return BoolLiteral; }(_literal.Literal); /***/ }), /***/ "./js/ast/expressions/expression.js": /*!******************************************!*\ !*** ./js/ast/expressions/expression.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Expression = exports.Expression = function () { function Expression() { _classCallCheck(this, Expression); this._sourceInfo = null; } _createClass(Expression, [{ key: "sourceInfo", set: function set(sourceInfo) { this._sourceInfo = sourceInfo; }, get: function get() { return this._sourceInfo; } }]); return Expression; }(); /***/ }), /***/ "./js/ast/expressions/functionCall.js": /*!********************************************!*\ !*** ./js/ast/expressions/functionCall.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FunctionCall = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var FunctionCall = exports.FunctionCall = function (_Expression) { _inherits(FunctionCall, _Expression); function FunctionCall(id, actualParameters) { _classCallCheck(this, FunctionCall); var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this)); _this.id = id; _this.actualParameters = actualParameters; return _this; } _createClass(FunctionCall, [{ key: 'parametersSize', get: function get() { return this.actualParameters.length; } }]); return FunctionCall; }(_expression.Expression); /***/ }), /***/ "./js/ast/expressions/index.js": /*!*************************************!*\ !*** ./js/ast/expressions/index.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined; var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js"); var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js"); var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js"); var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js"); var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js"); var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js"); var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js"); var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js"); var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js"); var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js"); exports.ArrayAccess = _arrayAccess.ArrayAccess; exports.FunctionCall = _functionCall.FunctionCall; exports.IntLiteral = _intLiteral.IntLiteral; exports.RealLiteral = _realLiteral.RealLiteral; exports.BoolLiteral = _boolLiteral.BoolLiteral; exports.StringLiteral = _stringLiteral.StringLiteral; exports.ArrayLiteral = _arrayLiteral.ArrayLiteral; exports.VariableLiteral = _variableLiteral.VariableLiteral; exports.InfixApp = _infixApp.InfixApp; exports.UnaryApp = _unaryApp.UnaryApp; /***/ }), /***/ "./js/ast/expressions/infixApp.js": /*!****************************************!*\ !*** ./js/ast/expressions/infixApp.js ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InfixApp = undefined; var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var InfixApp = exports.InfixApp = function (_Expression) { _inherits(InfixApp, _Expression); function InfixApp(op, left, right) { _classCallCheck(this, InfixApp); var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this)); _this.op = op; _this.left = left; _this.right = right; return _this; } return InfixApp; }(_expression.Expression); /***/ }), /***/ "./js/ast/expressions/intLiteral.js": /*!******************************************!*\ !*** ./js/ast/expressions/intLiteral.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IntLiteral = undefined; var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js"); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var IntLiteral = exports.IntLiteral = function (_Literal) { _inherits(IntLiteral, _Literal); function IntLiteral(value) { _classCallCheck(this, IntLiteral); var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER)); _this.value = value; return _this; } return IntLiteral; }(_literal.Literal); /***/ }), /***/ "./js/ast/expressions/literal.js": /*!***************************************!*\ !*** ./js/ast/expressions/literal.js ***! \***************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Literal = undefined; var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Literal = exports.Literal = function (_Expression) { _inherits(Literal, _Expression); function Literal(type) { _classCallCheck(this, Literal); var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this)); _this.type = type; return _this; } return Literal; }(_expression.Expression); /***/ }), /***/ "./js/ast/expressions/realLiteral.js": /*!*******************************************!*\ !*** ./js/ast/expressions/realLiteral.js ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RealLiteral = undefined; var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js"); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var RealLiteral = exports.RealLiteral = function (_Literal) { _inherits(RealLiteral, _Literal); function RealLiteral(value) { _classCallCheck(this, RealLiteral); var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL)); _this.value = value; return _this; } return RealLiteral; }(_literal.Literal); /***/ }), /***/ "./js/ast/expressions/stringLiteral.js": /*!*********************************************!*\ !*** ./js/ast/expressions/stringLiteral.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StringLiteral = undefined; var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js"); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var StringLiteral = exports.StringLiteral = function (_Literal) { _inherits(StringLiteral, _Literal); function StringLiteral(value) { _classCallCheck(this, StringLiteral); var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING)); _this.value = value; return _this; } return StringLiteral; }(_literal.Literal); /***/ }), /***/ "./js/ast/expressions/unaryApp.js": /*!****************************************!*\ !*** ./js/ast/expressions/unaryApp.js ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UnaryApp = undefined; var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var UnaryApp = exports.UnaryApp = function (_InfixApp) { _inherits(UnaryApp, _InfixApp); function UnaryApp(op, left) { _classCallCheck(this, UnaryApp); return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null)); } return UnaryApp; }(_infixApp.InfixApp); /***/ }), /***/ "./js/ast/expressions/variableLiteral.js": /*!***********************************************!*\ !*** ./js/ast/expressions/variableLiteral.js ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VariableLiteral = undefined; var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js"); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var VariableLiteral = exports.VariableLiteral = function (_Literal) { _inherits(VariableLiteral, _Literal); function VariableLiteral(id) { _classCallCheck(this, VariableLiteral); var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED)); _this.id = id; return _this; } return VariableLiteral; }(_literal.Literal); /***/ }), /***/ "./js/ast/ivprogParser.js": /*!********************************!*\ !*** ./js/ast/ivprogParser.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IVProgParser = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js"); var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js"); var Expressions = _interopRequireWildcard(_expressions); var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js"); var Commands = _interopRequireWildcard(_commands); var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js"); var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js"); var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js"); var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js"); var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js"); var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js"); var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js"); var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var IVProgParser = exports.IVProgParser = function () { _createClass(IVProgParser, null, [{ key: 'createParser', value: function createParser(input) { var lexerClass = _languageService.LanguageService.getCurrentLexer(); return new IVProgParser(input, lexerClass); } // }, { key: 'BASE', get: function get() { return 0; } }, { key: 'FUNCTION', get: function get() { return 1; } }, { key: 'COMMAND', get: function get() { return 2; } }, { key: 'BREAKABLE', get: function get() { return 4; } // }]); function IVProgParser(input, lexerClass) { _classCallCheck(this, IVProgParser); this.lexerClass = lexerClass; this.lexer = new lexerClass(new _index.InputStream(input)); this.tokenStream = new _index.CommonTokenStream(this.lexer); this.tokenStream.fill(); this.pos = 1; this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING]; this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID); this.parsingArrayDimension = 0; this.scope = []; this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs(); } _createClass(IVProgParser, [{ key: 'parseTree', value: function parseTree() { return this.parseProgram(); } }, { key: 'getToken', value: function getToken() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos; // if(index === null) // index = this.pos; return this.tokenStream.LT(index); } }, { key: 'insideScope', value: function insideScope(scope) { if (this.scope.length <= 0) { return IVProgParser.BASE === scope; } else { return this.scope[this.scope.length - 1] === scope; } } }, { key: 'pushScope', value: function pushScope(scope) { this.scope.push(scope); } }, { key: 'popScope', value: function popScope() { return this.scope.pop(); } }, { key: 'isEOF', value: function isEOF() { this.getToken(this.pos); return this.tokenStream.fetchedEOF; } }, { key: 'parseProgram', value: function parseProgram() { var token = this.getToken(); var globalVars = []; var functions = []; if (this.lexerClass.RK_PROGRAM === token.type) { this.pos++; this.consumeNewLines(); this.checkOpenCurly(); this.pos++; while (true) { this.consumeNewLines(); var _token = this.getToken(); if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) { globalVars = globalVars.concat(this.parseGlobalVariables()); } else if (_token.type === this.lexerClass.RK_FUNCTION) { functions = functions.concat(this.parseFunction()); } else { break; } } this.consumeNewLines(); this.checkCloseCurly(); this.pos++; this.consumeNewLines(); if (!this.isEOF()) { throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines(); } return { global: globalVars, functions: functions }; } else { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token); } } }, { key: 'checkOpenCurly', value: function checkOpenCurly() { var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var token = this.getToken(); if (this.lexerClass.OPEN_CURLY !== token.type) { if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false; } return true; } }, { key: 'checkCloseCurly', value: function checkCloseCurly() { var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var token = this.getToken(); if (this.lexerClass.CLOSE_CURLY !== token.type) { if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false; } return true; } /* It checks if the current token at position pos is a ']'. * As a check function it doesn't increment pos. * * @params bool:attempt, indicates that the token is optional. Defaults: false * * @returns true if the attempt is true and current token is '[', * false is attempt is true and current token is not '[' **/ }, { key: 'checkOpenBrace', value: function checkOpenBrace() { var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var token = this.getToken(); if (this.lexerClass.OPEN_BRACE !== token.type) { if (!attempt) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token); } else { return false; } } return true; } }, { key: 'checkCloseBrace', value: function checkCloseBrace() { var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var token = this.getToken(); if (this.lexerClass.CLOSE_BRACE !== token.type) { if (!attempt) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token); } else { return false; } } return true; } }, { key: 'checkOpenParenthesis', value: function checkOpenParenthesis() { var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var token = this.getToken(); if (this.lexerClass.OPEN_PARENTHESIS !== token.type) { if (!attempt) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token); } else { return false; } } return true; } }, { key: 'checkCloseParenthesis', value: function checkCloseParenthesis() { var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var token = this.getToken(); if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) { if (!attempt) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token); } else { return false; } } return true; } }, { key: 'checkEOS', value: function checkEOS() { var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var eosToken = this.getToken(); if (eosToken.type !== this.lexerClass.EOS) { if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false; } return true; } }, { key: 'consumeForSemiColon', value: function consumeForSemiColon() { var eosToken = this.getToken(); if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) { this.pos++; return; } throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken); } }, { key: 'parseGlobalVariables', value: function parseGlobalVariables() { var decl = this.parseMaybeConst(); this.checkEOS(); this.pos++; return decl; } /* * Checks if the next token is PR_CONST. It's only available * at global variables declaration level * @returns Declararion(const, type, id, initVal?) **/ }, { key: 'parseMaybeConst', value: function parseMaybeConst() { var constToken = this.getToken(); if (constToken.type === this.lexerClass.RK_CONST) { this.pos++; var typeString = this.parseType(); return this.parseDeclaration(typeString, true); } else if (this.isVariableType(constToken)) { var _typeString = this.parseType(); return this.parseDeclaration(_typeString); } else { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken); } } /* * Parses a declarion of the form: type --- id --- (= --- EAnd)? * @returns a list of Declararion(const, type, id, initVal?) **/ }, { key: 'parseDeclaration', value: function parseDeclaration(typeString) { var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var initial = null; var dim1 = null; var dim2 = null; var idToken = this.getToken(); var idString = this.parseID(); // Check for array or vector // ID[int/IDi][int/IDj] if (this.checkOpenBrace(true)) { this.pos++; this.consumeNewLines(); dim1 = this.parseArrayDimension(); this.consumeNewLines(); this.checkCloseBrace(); this.pos++; if (this.checkOpenBrace(true)) { this.pos++; this.consumeNewLines(); dim2 = this.parseArrayDimension(); this.consumeNewLines(); this.checkCloseBrace(); this.pos++; } } var equalsToken = this.getToken(); if (isConst && equalsToken.type !== this.lexerClass.EQUAL) { throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken); } if (equalsToken.type === this.lexerClass.EQUAL) { this.pos++; initial = this.parseExpressionOR(); } var declaration = null; var dimensions = 0; if (dim1 !== null) { dimensions++; if (dim2 !== null) { dimensions++; } declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst); } else { declaration = new Commands.Declaration(idString, typeString, initial, isConst); } declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken); var commaToken = this.getToken(); if (commaToken.type === this.lexerClass.COMMA) { this.pos++; this.consumeNewLines(); return [declaration].concat(this.parseDeclaration(typeString, isConst)); } else { return [declaration]; } } }, { key: 'consumeNewLines', value: function consumeNewLines() { var token = this.getToken(); while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) { this.pos++; token = this.getToken(); } } }, { key: 'isVariableType', value: function isVariableType(token) { return this.variableTypes.find(function (v) { return v === token.type; }); } /* * Reads the next token of the stream to check if it is a Integer or an ID. * @returns Integer | ID **/ }, { key: 'parseArrayDimension', value: function parseArrayDimension() { var dimToken = this.getToken(); if (dimToken.type === this.lexerClass.INTEGER) { //parse as int literal this.pos++; return this.getIntLiteral(dimToken); } else if (dimToken.type === this.lexerClass.ID) { //parse as variable this.pos++; return this.parseVariable(dimToken); } else { throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken); } } /* * Returns an object {type: 'int', value: value}. * It checks for binary and hexadecimal integers. * @returns object with fields type and value **/ }, { key: 'getIntLiteral', value: function getIntLiteral(token) { var text = token.text; var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token); var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text)); exp.sourceInfo = sourceInfo; return exp; } }, { key: 'getRealLiteral', value: function getRealLiteral(token) { var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token); var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text)); exp.sourceInfo = sourceInfo; return exp; } }, { key: 'getStringLiteral', value: function getStringLiteral(token) { var text = token.text; var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token); var exp = new Expressions.StringLiteral((0, _parsers.toString)(text)); exp.sourceInfo = sourceInfo; return exp; } }, { key: 'getBoolLiteral', value: function getBoolLiteral(token) { var val = (0, _parsers.toBool)(token.text); var exp = new Expressions.BoolLiteral(val); exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);; return exp; } }, { key: 'parseArrayLiteral', value: function parseArrayLiteral() { this.checkOpenCurly(); var beginArray = this.getToken(); if (this.parsingArrayDimension >= 2) { // TODO: better error message throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line); } this.pos++; this.parsingArrayDimension++; this.consumeNewLines(); var data = this.parseExpressionList(); this.consumeNewLines(); this.checkCloseCurly(); var endArray = this.getToken(); this.pos++; this.parsingArrayDimension--; if (this.parsingArrayDimension === 0) { // if (!data.isValid) { // // TODO: better error message // console.log('invalid array'); // throw new Error(`Invalid array at line ${beginArray.line}`); // } } var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray); var dataDim = 1; if (data[0] instanceof Expressions.ArrayLiteral) { dataDim++; } var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim); var exp = new Expressions.ArrayLiteral(type, data); exp.sourceInfo = sourceInfo; return exp; } /* * Returns an object {type: 'variable', value: value}. * @returns object with fields type and value **/ }, { key: 'parseVariable', value: function parseVariable(token) { var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token); var exp = new Expressions.VariableLiteral(token.text); exp.sourceInfo = sourceInfo; return exp; } /* * Returns an object representing a function. It has * four attributes: returnType, id, formalParams and block. * The block object has two attributes: declarations and commands **/ }, { key: 'parseFunction', value: function parseFunction() { this.pushScope(IVProgParser.FUNCTION); var formalParams = []; var token = this.getToken(); if (token.type !== this.lexerClass.RK_FUNCTION) { //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token); return null; } this.pos++; var funType = this.parseType(); var dimensions = 0; if (this.checkOpenBrace(true)) { this.pos++; this.checkCloseBrace(); this.pos++; dimensions++; if (this.checkOpenBrace(true)) { this.pos++; this.checkCloseBrace(); this.pos++; dimensions++; } } var functionID = this.parseID(); this.checkOpenParenthesis(); this.pos++; this.consumeNewLines(); if (!this.checkCloseParenthesis(true)) { formalParams = this.parseFormalParameters(); // formal parameters this.consumeNewLines(); this.checkCloseParenthesis(); this.pos++; } else { this.pos++; } this.consumeNewLines(); var commandsBlock = this.parseCommandBlock(); var returnType = funType; if (dimensions > 0) { returnType = new _compoundType.CompoundType(funType, dimensions); } var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock); if (functionID === null && !func.isMain) { // TODO: better error message throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line); } this.popScope(); return func; } /* * Parse the formal parameters of a function. * @returns a list of objects with the following attributes: type, id and dimensions. **/ }, { key: 'parseFormalParameters', value: function parseFormalParameters() { var list = []; while (true) { var dimensions = 0; var typeString = this.parseType(); var idString = this.parseID(); if (this.checkOpenBrace(true)) { this.pos++; dimensions++; this.checkCloseBrace(); this.pos++; if (this.checkOpenBrace(true)) { this.pos++; dimensions++; this.checkCloseBrace(); this.pos++; } } var type = null; if (dimensions > 0) { type = new _compoundType.CompoundType(typeString, dimensions); } else { type = typeString; } list.push(new Commands.FormalParameter(type, idString)); var commaToken = this.getToken(); if (commaToken.type !== this.lexerClass.COMMA) break; this.pos++; this.consumeNewLines(); } return list; } }, { key: 'parseID', value: function parseID() { var token = this.getToken(); if (token.type !== this.lexerClass.ID) { throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token); } this.pos++; if (this.insideScope(IVProgParser.FUNCTION)) { if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) { return null; } } return token.text; } }, { key: 'parseMaybeLibID', value: function parseMaybeLibID() { var token = this.getToken(); if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) { throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token); } this.pos++; return token.text; } }, { key: 'parseType', value: function parseType() { var token = this.getToken(); if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) { return _types.Types.VOID; } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) { this.pos++; return _types.Types.VOID; } else if (this.isVariableType(token)) { this.pos++; switch (token.type) { case this.lexerClass.RK_INTEGER: return _types.Types.INTEGER; case this.lexerClass.RK_BOOLEAN: return _types.Types.BOOLEAN; case this.lexerClass.RK_REAL: return _types.Types.REAL; case this.lexerClass.RK_STRING: return _types.Types.STRING; default: break; } } throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token); } }, { key: 'parseCommandBlock', value: function parseCommandBlock() { var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var variablesDecl = []; var commands = []; var hasOpen = false; if (this.checkOpenCurly(optionalCurly)) { this.pos++; hasOpen = true; } this.consumeNewLines(); while (true) { var cmd = this.parseCommand(); if (cmd === null) break; if (cmd !== -1) { if (cmd instanceof Array) { variablesDecl = variablesDecl.concat(cmd); } else { commands.push(cmd); } } } this.consumeNewLines(); if (hasOpen) { this.checkCloseCurly(); this.pos++; this.consumeNewLines(); } return new Commands.CommandBlock(variablesDecl, commands); } }, { key: 'parseCommand', value: function parseCommand() { var token = this.getToken(); if (this.isVariableType(token)) { if (!this.insideScope(IVProgParser.FUNCTION)) { // TODO better error message throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line); } this.pushScope(IVProgParser.BASE); var varType = this.parseType(); this.popScope(); var cmd = this.parseDeclaration(varType); this.checkEOS(); this.pos++; return cmd; } else if (token.type === this.lexerClass.ID) { return this.parseIDCommand(); } else if (token.type === this.lexerClass.LIB_ID) { return this.parseIDCommand(); } else if (token.type === this.lexerClass.RK_RETURN) { return this.parseReturn(); } else if (token.type === this.lexerClass.RK_WHILE) { return this.parseWhile(); } else if (token.type === this.lexerClass.RK_FOR) { return this.parseFor(); } else if (token.type === this.lexerClass.RK_BREAK) { if (!this.insideScope(IVProgParser.BREAKABLE)) { // TODO better error message throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token); } return this.parseBreak(); } else if (token.type === this.lexerClass.RK_SWITCH) { return this.parseSwitchCase(); } else if (token.type === this.lexerClass.RK_DO) { return this.parseDoWhile(); } else if (token.type === this.lexerClass.RK_IF) { return this.parseIfThenElse(); } else if (this.checkEOS(true)) { this.pos++; return -1; } else { return null; } } }, { key: 'parseSwitchCase', value: function parseSwitchCase() { this.pushScope(IVProgParser.BREAKABLE); this.pos++; this.checkOpenParenthesis(); this.pos++; this.consumeNewLines(); var exp = this.parseExpressionOR(); this.consumeNewLines(); this.checkCloseParenthesis(); this.pos++; this.consumeNewLines(); this.checkOpenCurly(); this.pos++; this.consumeNewLines(); var casesList = this.parseCases(); this.consumeNewLines(); this.checkCloseCurly(); this.pos++; this.consumeNewLines(); this.popScope(); return new Commands.Switch(exp, casesList); } }, { key: 'parseDoWhile', value: function parseDoWhile() { this.pos++; this.consumeNewLines(); this.pushScope(IVProgParser.BREAKABLE); var commandsBlock = this.parseCommandBlock(); this.consumeNewLines(); //Maybe not... var whileToken = this.getToken(); if (whileToken.type !== this.lexerClass.RK_WHILE) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken); } this.pos++; this.checkOpenParenthesis(); this.pos++; this.consumeNewLines(); var condition = this.parseExpressionOR(); this.consumeNewLines(); this.checkCloseParenthesis(); this.pos++; this.checkEOS(); this.popScope(); return new Commands.DoWhile(condition, commandsBlock); } }, { key: 'parseIfThenElse', value: function parseIfThenElse() { if (this.insideScope(IVProgParser.BREAKABLE)) { this.pushScope(IVProgParser.BREAKABLE); } else { this.pushScope(IVProgParser.COMMAND); } this.pos++; this.checkOpenParenthesis(); this.pos++; this.consumeNewLines(); var logicalExpression = this.parseExpressionOR(); this.consumeNewLines(); this.checkCloseParenthesis(); this.pos++; this.consumeNewLines(); var cmdBlocks = this.parseCommandBlock(); var maybeElse = this.getToken(); if (maybeElse.type === this.lexerClass.RK_ELSE) { this.pos++; this.consumeNewLines(); var maybeIf = this.getToken(); var elseBlock = null; if (this.checkOpenCurly(true)) { elseBlock = this.parseCommandBlock(); } else if (maybeIf.type === this.lexerClass.RK_IF) { elseBlock = this.parseIfThenElse(); } else { // TODO better error message throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf); } return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock); } this.popScope(); return new Commands.IfThenElse(logicalExpression, cmdBlocks, null); } }, { key: 'parseFor', value: function parseFor() { this.pushScope(IVProgParser.BREAKABLE); this.pos++; this.checkOpenParenthesis(); this.pos++; this.consumeNewLines(); var attribution = this.parseForAssign(); this.consumeNewLines(); var condition = this.parseExpressionOR(); this.consumeForSemiColon(); var increment = this.parseForAssign(true); this.checkCloseParenthesis(); this.pos++; this.consumeNewLines(); var commandsBlock = this.parseCommandBlock(); this.popScope(); return new Commands.For(attribution, condition, increment, commandsBlock); } }, { key: 'parseWhile', value: function parseWhile() { this.pushScope(IVProgParser.BREAKABLE); this.pos++; this.checkOpenParenthesis(); this.pos++; this.consumeNewLines(); var logicalExpression = this.parseExpressionOR(); this.consumeNewLines(); this.checkCloseParenthesis(); this.pos++; this.consumeNewLines(); var cmdBlocks = this.parseCommandBlock(); this.popScope(); return new Commands.While(logicalExpression, cmdBlocks); } }, { key: 'parseBreak', value: function parseBreak() { this.pos++; this.checkEOS(); this.pos++; return new Commands.Break(); } }, { key: 'parseReturn', value: function parseReturn() { this.pos++; var exp = null; if (!this.checkEOS(true)) { exp = this.parseExpressionOR(); this.checkEOS(); } this.pos++; return new Commands.Return(exp); } }, { key: 'parseIDCommand', value: function parseIDCommand() { var refToken = this.getToken(); var isID = refToken.type === this.lexerClass.ID; var id = this.parseMaybeLibID(); if (this.checkOpenBrace(true)) { this.pos++; var lineExpression = null; var columnExpression = null; this.consumeNewLines(); lineExpression = this.parseExpression(); this.consumeNewLines(); this.checkCloseBrace(); this.pos++; if (this.checkOpenBrace(true)) { this.pos++; this.consumeNewLines(); columnExpression = this.parseExpression(); this.consumeNewLines(); this.checkCloseBrace(); this.pos++; } var equalToken = this.getToken(); if (equalToken.type !== this.lexerClass.EQUAL) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken); } this.pos++; var exp = this.parseExpressionOR(); this.checkEOS(); this.pos++; var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp); cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken); return cmd; } var equalOrParenthesis = this.getToken(); if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) { this.pos++; var _exp = this.parseExpressionOR(); this.checkEOS(); this.pos++; var _cmd = new Commands.Assign(id, _exp); _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis); return _cmd; } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) { var funcCall = this.parseFunctionCallCommand(id); this.checkEOS(); this.pos++; return funcCall; } else if (isID) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis); } else { throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken); } } }, { key: 'parseForAssign', value: function parseForAssign() { var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!isLast) this.consumeNewLines(); if (this.checkEOS(true)) { return null; } var id = this.parseID(); var equal = this.getToken(); if (equal.type !== this.lexerClass.EQUAL) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal); } this.pos++; var exp = this.parseExpressionOR(); if (!isLast) { this.consumeForSemiColon(); } var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal); var cmd = new Commands.Assign(id, exp); cmd.sourceInfo = sourceInfo; return cmd; } }, { key: 'parseCases', value: function parseCases() { var token = this.getToken(); if (token.type !== this.lexerClass.RK_CASE) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token); } this.pos++; var nextToken = this.getToken(); if (nextToken.type === this.lexerClass.RK_DEFAULT) { this.pos++; var colonToken = this.getToken(); if (colonToken.type !== this.lexerClass.COLON) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken); } this.pos++; this.consumeNewLines(); var block = this.parseCommandBlock(true); var defaultCase = new Commands.Case(null); defaultCase.setCommands(block.commands); return [defaultCase]; } else { var exp = this.parseExpressionOR(); var _colonToken = this.getToken(); if (_colonToken.type !== this.lexerClass.COLON) { throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken); } this.pos++; this.consumeNewLines(); var _block = this.parseCommandBlock(true); var aCase = new Commands.Case(exp); aCase.setCommands(_block.commands); var caseToken = this.getToken(); if (caseToken.type === this.lexerClass.RK_CASE) { return [aCase].concat(this.parseCases()); } else { return [aCase]; } } } /* * Parses an Expression following the structure: * * EOR => EAnd ( 'or' EOR)? #expression and * * EOR => ENot ('and' EOR)? #expression or * * ENot => 'not'? ER #expression not * * ER => E ((>=, <=, ==, >, <) E)? #expression relational * * E => factor ((+, -) E)? #expression * * factor=> term ((*, /, %) factor)? * * term => literal || arrayAccess || FuncCall || ID || '('EAnd')' **/ }, { key: 'parseExpressionOR', value: function parseExpressionOR() { var exp1 = this.parseExpressionAND(); while (this.getToken().type === this.lexerClass.OR_OPERATOR) { var opToken = this.getToken(); this.pos++; var or = (0, _operators.convertFromString)('or'); this.consumeNewLines(); var exp2 = this.parseExpressionAND(); var _finalExp = new Expressions.InfixApp(or, exp1, exp2); _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken); exp1 = _finalExp; } return exp1; } }, { key: 'parseExpressionAND', value: function parseExpressionAND() { var exp1 = this.parseExpressionNot(); while (this.getToken().type === this.lexerClass.AND_OPERATOR) { var opToken = this.getToken(); this.pos++; var and = (0, _operators.convertFromString)('and'); this.consumeNewLines(); var exp2 = this.parseExpressionNot(); var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2); _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken); exp1 = _finalExp2; } return exp1; } }, { key: 'parseExpressionNot', value: function parseExpressionNot() { var maybeNotToken = this.getToken(); if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) { var opToken = this.getToken(); this.pos++; var not = (0, _operators.convertFromString)('not'); var exp1 = this.parseExpressionRel(); finalExp = new Expressions.UnaryApp(not, exp1); finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken); return finalExp; } else { return this.parseExpressionRel(); } } }, { key: 'parseExpressionRel', value: function parseExpressionRel() { var exp1 = this.parseExpression(); while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) { var relToken = this.getToken(); this.pos++; var rel = (0, _operators.convertFromString)(relToken.text); var exp2 = this.parseExpression(); var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2); _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken); exp1 = _finalExp3; } return exp1; } }, { key: 'parseExpression', value: function parseExpression() { var factor = this.parseFactor(); while (this.getToken().type === this.lexerClass.SUM_OP) { var sumOpToken = this.getToken(); this.pos++; var op = (0, _operators.convertFromString)(sumOpToken.text); var factor2 = this.parseFactor(); var _finalExp4 = new Expressions.InfixApp(op, factor, factor2); _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken); factor = _finalExp4; } return factor; } }, { key: 'parseFactor', value: function parseFactor() { var term = this.parseTerm(); while (this.getToken().type === this.lexerClass.MULTI_OP) { var multOpToken = this.getToken(); this.pos++; var op = (0, _operators.convertFromString)(multOpToken.text); var term2 = this.parseTerm(); var _finalExp5 = new Expressions.InfixApp(op, term, term2); _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken); term = _finalExp5; } return term; } }, { key: 'parseTerm', value: function parseTerm() { var token = this.getToken(); var sourceInfo = null; switch (token.type) { case this.lexerClass.SUM_OP: this.pos++; sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token); var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm()); exp.sourceInfo = sourceInfo; return exp; case this.lexerClass.INTEGER: this.pos++; return this.getIntLiteral(token); case this.lexerClass.REAL: this.pos++; return this.getRealLiteral(token); case this.lexerClass.STRING: this.pos++; return this.getStringLiteral(token); case this.lexerClass.RK_TRUE: case this.lexerClass.RK_FALSE: this.pos++; return this.getBoolLiteral(token); case this.lexerClass.OPEN_CURLY: return this.parseArrayLiteral(); case this.lexerClass.ID: case this.lexerClass.LIB_ID: return this.parseIDTerm(); case this.lexerClass.OPEN_PARENTHESIS: return this.parseParenthesisExp(); default: throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token); } } }, { key: 'parseIDTerm', value: function parseIDTerm() { var tokenA = this.getToken(); var id = this.parseMaybeLibID(); var isID = tokenA.type === this.lexerClass.ID; if (isID && this.checkOpenBrace(true)) { var tokenB = null; this.pos++; var firstIndex = this.parseExpression(); var secondIndex = null; this.consumeNewLines(); this.checkCloseBrace(); tokenB = this.getToken(); this.pos++; if (this.checkOpenBrace(true)) { this.pos++; secondIndex = this.parseExpression(); this.consumeNewLines(); this.checkCloseBrace(); tokenB = this.getToken(); this.pos++; } var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB); var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex); exp.sourceInfo = sourceInfo; return exp; } else if (this.checkOpenParenthesis(true)) { return this.parseFunctionCallExpression(id); } else if (isID) { var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA); var _exp2 = new Expressions.VariableLiteral(id); _exp2.sourceInfo = _sourceInfo; return _exp2; } else { throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA); } } }, { key: 'getFunctionName', value: function getFunctionName(id) { var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id); if (name === null) { return id; } else { return name; } } }, { key: 'parseFunctionCallExpression', value: function parseFunctionCallExpression(id) { var tokenA = this.getToken(this.pos - 1); var actualParameters = this.parseActualParameters(); var tokenB = this.getToken(this.pos - 1); var funcName = this.getFunctionName(id); var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB); var cmd = new Expressions.FunctionCall(funcName, actualParameters); cmd.sourceInfo = sourceInfo; return cmd; } }, { key: 'parseFunctionCallCommand', value: function parseFunctionCallCommand(id) { return this.parseFunctionCallExpression(id); } }, { key: 'parseParenthesisExp', value: function parseParenthesisExp() { this.checkOpenParenthesis(); var tokenA = this.getToken(); this.pos++; this.consumeNewLines(); var exp = this.parseExpressionOR(); this.consumeNewLines(); this.checkCloseParenthesis(); var tokenB = this.getToken(); var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB); this.pos++; exp.sourceInfo = sourceInfo; return exp; } }, { key: 'parseActualParameters', value: function parseActualParameters() { this.checkOpenParenthesis(); this.pos++; if (this.checkCloseParenthesis(true)) { this.pos++; return []; } this.consumeNewLines(); var list = this.parseExpressionList(); this.consumeNewLines(); this.checkCloseParenthesis(); this.pos++; return list; } }, { key: 'parseExpressionList', value: function parseExpressionList() { var list = []; while (true) { var exp = this.parseExpressionOR(); list.push(exp); var maybeToken = this.getToken(); if (maybeToken.type !== this.lexerClass.COMMA) { break; } else { this.pos++; this.consumeNewLines(); } } return list; } }, { key: 'getTypeArray', value: function getTypeArray() { var _this = this; var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes; return types.map(function (x) { return _this.lexer.literalNames[x]; }); } }]); return IVProgParser; }(); /***/ }), /***/ "./js/ast/operators.js": /*!*****************************!*\ !*** ./js/ast/operators.js ***! \*****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.convertFromString = convertFromString; var Operators = exports.Operators = Object.freeze({ ADD: { ord: 0, value: "+" }, SUB: { ord: 1, value: "-" }, MULT: { ord: 2, value: '*' }, DIV: { ord: 3, value: '/' }, MOD: { ord: 4, value: '%' }, GT: { ord: 5, value: '>' }, GE: { ord: 6, value: '>=' }, LT: { ord: 7, value: '<' }, LE: { ord: 8, value: '<=' }, EQ: { ord: 9, value: '==' }, NEQ: { ord: 10, value: '!=' }, AND: { ord: 11, value: 'and' }, OR: { ord: 12, value: 'or' }, NOT: { ord: 13, value: 'not' } }); function convertFromString(op) { switch (op) { case '+': return Operators.ADD; case '-': return Operators.SUB; case '*': return Operators.MULT; case '/': return Operators.DIV; case '%': return Operators.MOD; case '>': return Operators.GT; case '>=': return Operators.GE; case '<': return Operators.LT; case '<=': return Operators.LE; case '==': return Operators.EQ; case '!=': return Operators.NEQ; case 'and': return Operators.AND; case 'or': return Operators.OR; case 'not': return Operators.NOT; } } /***/ }), /***/ "./js/ast/sourceInfo.js": /*!******************************!*\ !*** ./js/ast/sourceInfo.js ***! \******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var SourceInfo = exports.SourceInfo = function () { _createClass(SourceInfo, null, [{ key: "createSourceInfo", value: function createSourceInfo(token) { return new SourceInfo(token.line, token.column, token.text.length); } }, { key: "createSourceInfoFromList", value: function createSourceInfoFromList(tokenA, tokenB) { var line = tokenA.line; var column = tokenA.column; // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g // No idea why... var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex; return new SourceInfo(line, column, size); } }]); function SourceInfo(line, column, size) { _classCallCheck(this, SourceInfo); this.line = line; this.column = column; this.size = size; } return SourceInfo; }(); /***/ }), /***/ "./js/io/domConsole.js": /*!*****************************!*\ !*** ./js/io/domConsole.js ***! \*****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DOMConsole = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); var _jquery2 = _interopRequireDefault(_jquery); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var DOMConsole = exports.DOMConsole = function () { _createClass(DOMConsole, null, [{ key: 'USER', get: function get() { return 0; } }, { key: 'INFO', get: function get() { return 1; } }, { key: 'ERR', get: function get() { return 2; } }]); function DOMConsole(elementID) { _classCallCheck(this, DOMConsole); this.input = null; this.needInput = false; this.termDiv = null; this.anyKey = false; this.parent = (0, _jquery2.default)(elementID); this.setup(); this.inputListeners = []; } _createClass(DOMConsole, [{ key: 'setup', value: function setup() { this._setupDom(); this._setupEvents(); } }, { key: '_setupEvents', value: function _setupEvents() { var _this = this; this.input.on("keydown", function (event) { if (!_this.needInput) { event.preventDefault(); return; } var keyCode = event.which; if (keyCode === 13 || _this.anyKey) { var text = _this.input.val(); text = text.replace('[\n\r]+', ''); _this.notifyListeners(text); _this.write(text); _this.input.val(""); } }); } }, { key: '_setupDom', value: function _setupDom() { this.termDiv = (0, _jquery2.default)("
"); this.termDiv.addClass("ivprog-term-div"); this.input = (0, _jquery2.default)(''); this.input.addClass("ivprog-term-input"); this.termDiv.append(this.input); this.parent.append(this.termDiv); } }, { key: 'notifyListeners', value: function notifyListeners(text) { this.inputListeners.forEach(function (resolve) { return resolve(text); }); this.inputListeners.splice(0, this.inputListeners.length); this.hideInput(); this.anyKey = false; } }, { key: 'write', value: function write(text) { this._appendText(text, DOMConsole.USER); } }, { key: 'info', value: function info(text) { this._appendText(text, DOMConsole.INFO); } }, { key: 'err', value: function err(text) { this._appendText(text, DOMConsole.ERR); } }, { key: '_appendText', value: function _appendText(text, type) { var divClass = this.getClassForType(type); var textDiv = (0, _jquery2.default)("
"); textDiv.addClass(divClass); textDiv.append(text); textDiv.insertBefore(this.input); this.scrollTerm(); } }, { key: 'scrollTerm', value: function scrollTerm() { this.termDiv.animate({ scrollTop: this.termDiv.prop('scrollHeight') }, 0); } }, { key: 'getClassForType', value: function getClassForType(type) { switch (type) { case DOMConsole.USER: return "ivprog-term-userText"; case DOMConsole.INFO: return "ivprog-term-info"; case DOMConsole.ERR: return "ivprog-term-error"; } } }, { key: 'dispose', value: function dispose() { this.parent.off(); this.input.off(); this.input = null; this.parent.empty(); } }, { key: 'showInput', value: function showInput() { this.needInput = true; this.input.show(); this.input.focus(); } }, { key: 'hideInput', value: function hideInput() { this.needInput = false; this.input.hide(); } }, { key: 'requestInput', value: function requestInput(callback) { var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; this.inputListeners.push(callback); this.anyKey = anyKey; this.showInput(); } }, { key: 'sendOutput', value: function sendOutput(text) { var _this2 = this; text.split("\n").forEach(function (t) { t = t.replace(/\t/g, ' '); _this2.write(t); }); } }, { key: 'clear', value: function clear() { this.input.parent().children().not(this.input).remove(); this.input.val(""); } }]); return DOMConsole; }(); /***/ }), /***/ "./js/io/input.js": /*!************************!*\ !*** ./js/io/input.js ***! \************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Input = exports.Input = function () { function Input() { _classCallCheck(this, Input); } _createClass(Input, [{ key: "requestInput", value: function requestInput(callback) { throw new Error("Must be implemented"); } }]); return Input; }(); /***/ }), /***/ "./js/io/output.js": /*!*************************!*\ !*** ./js/io/output.js ***! \*************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Output = exports.Output = function () { function Output() { _classCallCheck(this, Output); } _createClass(Output, [{ key: "sendOutput", value: function sendOutput(text) { throw new Error("Must be implemented"); } }]); return Output; }(); /***/ }), /***/ "./js/main.js": /*!********************!*\ !*** ./js/main.js ***! \********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StringTypes = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined; var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js"); var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js"); var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js"); var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js"); var _lineI18n2 = _interopRequireDefault(_lineI18n); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var StringTypes = _lineI18n2.default.StringTypes; exports.runner = _runner.runner; exports.initVisualUI = _functions.initVisualUI; exports.LocalizedStrings = _localizedStringsService.LocalizedStrings; exports.StringTypes = StringTypes; /***/ }), /***/ "./js/processor/compatibilityTable.js": /*!********************************************!*\ !*** ./js/processor/compatibilityTable.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp; exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp; var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js"); var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js"); var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js"); function buildInfixAddTable() { var table = [[], [], [], []]; table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER; table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL; table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING; table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL; table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL; table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING; table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING; table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING; table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING; table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING; return table; } function buildInfixMultiDivSubTable() { var table = [[], [], [], []]; table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER; table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL; table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL; table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL; return table; } function buildInfixEqualityInequalityTable() { var table = [[], [], [], []]; table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN; table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN; table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN; table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN; return table; } function buildInfixRelationalTable() { var table = [[], [], [], []]; table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN; table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN; table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN; return table; } function buildInfixAndOrTable() { var table = [[], [], [], []]; table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN; return table; } function buildInfixModTable() { var table = [[], [], [], []]; table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER; return table; } function buildUnarySumSubList() { var list = []; list[_types.Types.INTEGER.ord] = _types.Types.INTEGER; list[_types.Types.REAL.ord] = _types.Types.REAL; return list; } function buildUnaryNegList() { var list = []; list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN; return list; } function buildInfixCompatibilityTable() { var compatibilityMap = new WeakMap(); compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable()); compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable()); compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable()); compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable()); compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable()); compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable()); compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable()); compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable()); compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable()); compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable()); compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable()); compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable()); compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable()); return compatibilityMap; } function buildUnaryCompatibilityTable() { var compatibilityMap = new WeakMap(); compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList()); compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList()); compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList()); return compatibilityMap; } var infixMap = buildInfixCompatibilityTable(); var unaryMap = buildUnaryCompatibilityTable(); function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) { try { if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) { var newMulti = []; for (var i = 0; i < leftExpressionType.types.length; i++) { var element = leftExpressionType.types[i]; if (rightExpressionType.types.indexOf(element) !== -1) { newMulti.push(element); } } if (newMulti.length <= 0) { return _types.Types.UNDEFINED; } else { return new _multiType.MultiType(newMulti); } } else if (leftExpressionType instanceof _multiType.MultiType) { if (leftExpressionType.isCompatible(rightExpressionType)) { return rightExpressionType; } else { return _types.Types.UNDEFINED; } } else if (rightExpressionType instanceof _multiType.MultiType) { if (rightExpressionType.isCompatible(leftExpressionType)) { return leftExpressionType; } else { return _types.Types.UNDEFINED; } } var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord]; if (resultType === null || resultType === undefined) { return _types.Types.UNDEFINED; } return resultType; } catch (e) { if (e instanceof TypeError) { return _types.Types.UNDEFINED; } else { throw e; } } } function resultTypeAfterUnaryOp(operator, leftExpressionType) { try { if (leftExpressionType instanceof _multiType.MultiType) { return leftExpressionType; } return unaryMap.get(operator)[leftExpressionType.ord]; } catch (e) { if (e instanceof TypeError) { return _types.Types.UNDEFINED; } else { throw e; } } } /***/ }), /***/ "./js/processor/context.js": /*!*********************************!*\ !*** ./js/processor/context.js ***! \*********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Context = exports.Context = Object.freeze({ BASE: Symbol('context:base'), BREAKABLE: Symbol('context:breakable'), FUNCTION: Symbol('context:function') }); /***/ }), /***/ "./js/processor/definedFunctions.js": /*!******************************************!*\ !*** ./js/processor/definedFunctions.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LanguageDefinedFunction = undefined; var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js"); var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js"); var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js"); var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js"); var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js"); var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js"); function valueToKey(value, object) { for (var key in object) { if (object.hasOwnProperty(key)) { if (object[key] === value) { return key; } } } return null; } function concatObjects() { var result = {}; for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) { objs[_key] = arguments[_key]; } for (var i = 0; i < objs.length; i++) { var obj = objs[i]; for (var key in obj) { if (obj.hasOwnProperty(key)) { result[key] = obj[key]; } } } return result; } var libsObject = { $mathLib: { $sin: (0, _math.createSinFun)(), $cos: (0, _math.createCosFun)(), $tan: (0, _math.createTanFun)(), $sqrt: (0, _math.createSqrtFun)(), $pow: (0, _math.createPowFun)(), $log: (0, _math.createLogFun)(), $abs: (0, _math.createAbsFun)(), $negate: (0, _math.createNegateFun)(), $invert: (0, _math.createInvertFun)(), $max: (0, _math.createMaxFun)(), $min: (0, _math.createMinFun)() }, $ioLib: { $read: (0, _io.createInputFun)(), $write: (0, _io.createOutputFun)() }, $strLib: { $substring: (0, _strings.createSubstringFun)(), $length: (0, _strings.createLengthFun)(), $uppercase: (0, _strings.createUppercaseFun)(), $lowercase: (0, _strings.createLowercaseFun)(), $charAt: (0, _strings.createrCharAtFun)() }, $arrayLib: { $numElements: (0, _arrays.createNumElementsFun)(), $matrixLines: (0, _arrays.createMatrixLinesFun)(), $matrixColumns: (0, _arrays.createMatrixColumnsFun)() }, $langLib: { $isReal: (0, _lang.createIsRealFun)(), $isInt: (0, _lang.createIsIntFun)(), $isBool: (0, _lang.createIsBoolFun)(), $castReal: (0, _lang.createCastRealFun)(), $castInt: (0, _lang.createCastIntFun)(), $castBool: (0, _lang.createCastBoolFun)(), $castString: (0, _lang.createCastStringFun)() } }; var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib); var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({ getMainFunctionName: function getMainFunctionName() { return _languageService.LanguageService.getCurrentLangFuncs().main_function; }, getInternalName: function getInternalName(localName) { if (localName.indexOf(".") !== -1) { var names = localName.split("."); var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs()); var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs()); if (lib === null || internalName === null) { return null; } return lib + "." + internalName; } var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs()); if (funcName !== null) { if (funcsObject[funcName]) { return funcName; } } return null; }, getFunction: function getFunction(internalName) { if (internalName.indexOf(".") !== -1) { var names = internalName.split("."); var libName = names[0]; var funName = names[1]; return libsObject[libName][funName]; } return funcsObject[internalName]; } }); /***/ }), /***/ "./js/processor/error/processorErrorFactory.js": /*!*****************************************************!*\ !*** ./js/processor/error/processorErrorFactory.js ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProcessorErrorFactory = undefined; var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js"); var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js"); var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js"); var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({}); /***/ }), /***/ "./js/processor/error/runtimeError.js": /*!********************************************!*\ !*** ./js/processor/error/runtimeError.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var RuntimeError = exports.RuntimeError = function (_Error) { _inherits(RuntimeError, _Error); function RuntimeError() { var _ref; _classCallCheck(this, RuntimeError); for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) { msg[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg))); if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError); return _this; } return RuntimeError; }(Error); /***/ }), /***/ "./js/processor/error/semanticError.js": /*!*********************************************!*\ !*** ./js/processor/error/semanticError.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var SemanticError = exports.SemanticError = function (_Error) { _inherits(SemanticError, _Error); function SemanticError() { var _ref; _classCallCheck(this, SemanticError); for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) { msg[_key] = arguments[_key]; } var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg))); if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError); return _this; } return SemanticError; }(Error); /***/ }), /***/ "./js/processor/ivprogProcessor.js": /*!*****************************************!*\ !*** ./js/processor/ivprogProcessor.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IVProgProcessor = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js"); var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js"); var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js"); var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js"); var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js"); var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js"); var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js"); var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js"); var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js"); var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js"); var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js"); var Commands = _interopRequireWildcard(_commands); var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js"); var Expressions = _interopRequireWildcard(_expressions); var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js"); var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js"); var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js"); var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var loopTimeoutMs = 10000; var IVProgProcessor = exports.IVProgProcessor = function () { _createClass(IVProgProcessor, null, [{ key: 'LOOP_TIMEOUT', get: function get() { return loopTimeoutMs; }, set: function set(ms) { loopTimeoutMs = ms; } }]); function IVProgProcessor(ast) { _classCallCheck(this, IVProgProcessor); this.ast = ast; this.globalStore = null; this.stores = null; this.context = null; this.input = null; this.forceKill = false; this.loopTimers = []; this.output = null; } _createClass(IVProgProcessor, [{ key: 'registerInput', value: function registerInput(input) { if (this.input !== null) this.input = null; this.input = input; } }, { key: 'registerOutput', value: function registerOutput(output) { if (this.output !== null) this.output = null; this.output = output; } }, { key: 'checkContext', value: function checkContext(context) { return this.context[this.context.length - 1] === context; } }, { key: 'ignoreSwitchCases', value: function ignoreSwitchCases(store) { if (store.mode === _modes.Modes.RETURN) { return true; } else if (store.mode === _modes.Modes.BREAK) { return true; } else { return false; } } }, { key: 'prepareState', value: function prepareState() { if (this.stores !== null) { for (var i = 0; i < this.stores.length; i++) { delete this.stores[i]; } this.stores = null; } if (this.globalStore !== null) this.globalStore = null; this.globalStore = new _store.Store(); this.stores = [this.globalStore]; this.context = [_context.Context.BASE]; } }, { key: 'interpretAST', value: function interpretAST() { this.prepareState(); this.initGlobal(); var mainFunc = this.findMainFunction(); if (mainFunc === null) { // TODO: Better error message throw new Error("Missing main funciton."); } return this.runFunction(mainFunc, [], this.globalStore); } }, { key: 'initGlobal', value: function initGlobal() { var _this = this; if (!this.checkContext(_context.Context.BASE)) { throw new Error("!!!CRITICAL: Invalid call to initGlobal outside BASE context!!!"); } this.ast.global.forEach(function (decl) { _this.executeCommand(_this.globalStore, decl).then(function (sto) { return _this.globalStore = sto; }); }); } }, { key: 'findMainFunction', value: function findMainFunction() { return this.ast.functions.find(function (v) { return v.isMain; }); } }, { key: 'findFunction', value: function findFunction(name) { if (name.match(/^\$.+$/)) { var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name); if (!!!fun) { throw new Error("!!!Internal Error. Language defined function not implemented -> " + name + "!!!"); } return fun; } else { var val = this.ast.functions.find(function (v) { return v.name === name; }); if (!!!val) { // TODO: better error message; throw new Error('Function ' + name + ' is not defined.'); } return val; } } }, { key: 'runFunction', value: function runFunction(func, actualParameters, store) { var _this2 = this; var funcStore = new _store.Store(); funcStore.extendStore(this.globalStore); var returnStoreObject = null; if (func.returnType instanceof _compoundType.CompoundType) { if (func.returnType.dimensions > 1) { returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]); } else { returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []); } } else { returnStoreObject = new _storeObject.StoreObject(func.returnType, null); } var funcName = func.isMain ? 'main' : func.name; var funcNameStoreObject = new _storeObject.StoreObject(_types.Types.STRING, funcName, true); funcStore.insertStore('$', returnStoreObject); funcStore.insertStore('$name', funcNameStoreObject); var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore); return newFuncStore$.then(function (sto) { _this2.context.push(_context.Context.FUNCTION); _this2.stores.push(sto); return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) { return _this2.executeCommands(stoWithVars, func.commands); }).then(function (finalSto) { _this2.stores.pop(); _this2.context.pop(); return finalSto; }); }); } }, { key: 'associateParameters', value: function associateParameters(formalList, actualList, callerStore, calleeStore) { var _this3 = this; if (formalList.length != actualList.length) { // TODO: Better error message throw new Error("Numbers of parameters doesn't match"); } var promises$ = actualList.map(function (actualParameter) { return _this3.evaluateExpression(callerStore, actualParameter); }); return Promise.all(promises$).then(function (values) { for (var i = 0; i < values.length; i++) { var stoObj = values[i]; var formalParameter = formalList[i]; if (formalParameter.type.isCompatible(stoObj.type)) { if (formalParameter.byRef && !stoObj.inStore) { throw new Error('You must inform a variable as parameter'); } if (formalParameter.byRef) { var ref = null; if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) { ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj); } else { ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore); } calleeStore.insertStore(formalParameter.id, ref); } else { var realValue = _this3.parseStoreObjectValue(stoObj); calleeStore.insertStore(formalParameter.id, realValue); } } else { throw new Error('Parameter ' + formalParameter.id + ' is not compatible with the value given.'); } } return calleeStore; }); } }, { key: 'executeCommands', value: function executeCommands(store, cmds) { // helper to partially apply a function, in this case executeCommand var outerRef = this; var partial = function partial(fun, cmd) { return function (sto) { return fun(sto, cmd); }; }; return cmds.reduce(function (lastCommand, next) { var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next); return lastCommand.then(nextCommand); }, Promise.resolve(store)); } }, { key: 'executeCommand', value: function executeCommand(store, cmd) { if (this.forceKill) { return Promise.reject("Interrupção forçada do programa!"); } else if (store.mode === _modes.Modes.PAUSE) { return Promise.resolve(this.executeCommand(store, cmd)); } else if (store.mode === _modes.Modes.RETURN) { return Promise.resolve(store); } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) { return Promise.resolve(store); } if (cmd instanceof Commands.Declaration) { return this.executeDeclaration(store, cmd); } else if (cmd instanceof Commands.ArrayIndexAssign) { return this.executeArrayIndexAssign(store, cmd); } else if (cmd instanceof Commands.Assign) { return this.executeAssign(store, cmd); } else if (cmd instanceof Commands.Break) { return this.executeBreak(store, cmd); } else if (cmd instanceof Commands.Return) { return this.executeReturn(store, cmd); } else if (cmd instanceof Commands.IfThenElse) { return this.executeIfThenElse(store, cmd); } else if (cmd instanceof Commands.While) { return this.executeWhile(store, cmd); } else if (cmd instanceof Commands.DoWhile) { return this.executeDoWhile(store, cmd); } else if (cmd instanceof Commands.For) { return this.executeFor(store, cmd); } else if (cmd instanceof Commands.Switch) { return this.executeSwitch(store, cmd); } else if (cmd instanceof Commands.FunctionCall) { return this.executeFunctionCall(store, cmd); } else if (cmd instanceof Commands.SysCall) { return this.executeSysCall(store, cmd); } else { throw new Error("!!!CRITICAL A unknown command was found!!!\n" + cmd); } } }, { key: 'executeSysCall', value: function executeSysCall(store, cmd) { var func = cmd.langFunc.bind(this); return func(store, cmd); } }, { key: 'executeFunctionCall', value: function executeFunctionCall(store, cmd) { var func = this.findFunction(cmd.id); return this.runFunction(func, cmd.actualParameters, store).then(function (sto) { if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) { // TODO: better error message return Promise.reject(new Error('Function ' + func.name + ' must have a return command')); } else { return store; } }); } }, { key: 'executeSwitch', value: function executeSwitch(store, cmd) { var _this4 = this; this.context.push(_context.Context.BREAKABLE); var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) { return promise.then(function (result) { var sto = result.sto; if (_this4.ignoreSwitchCases(sto)) { return Promise.resolve(result); } else if (result.wasTrue || aCase.isDefault) { var $newSto = _this4.executeCommands(result.sto, aCase.commands); return $newSto.then(function (nSto) { return Promise.resolve({ wasTrue: true, sto: nSto }); }); } else { var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression)); return $value.then(function (vl) { if (vl.value) { var _$newSto = _this4.executeCommands(result.sto, aCase.commands); return _$newSto.then(function (nSto) { return Promise.resolve({ wasTrue: true, sto: nSto }); }); } else { return Promise.resolve({ wasTrue: false, sto: sto }); } }); } }); }; try { var breakLoop = false; var $result = Promise.resolve({ wasTrue: false, sto: store }); for (var index = 0; index < cmd.cases.length && !breakLoop; index++) { var aCase = cmd.cases[index]; $result = auxCaseFun($result, cmd.expression, aCase); $result.then(function (r) { return breakLoop = _this4.ignoreSwitchCases(r.sto); }); } return $result.then(function (r) { _this4.context.pop(); if (r.sto.mode === _modes.Modes.BREAK) { r.sto.mode = _modes.Modes.RUN; } return r.sto; }); } catch (error) { return Promise.reject(error); } } }, { key: 'executeFor', value: function executeFor(store, cmd) { try { //BEGIN for -> while rewrite var initCmd = cmd.assignment; var condition = cmd.condition; var increment = cmd.increment; var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment)); var forAsWhile = new Commands.While(condition, whileBlock); //END for -> while rewrite var newCmdList = [initCmd, forAsWhile]; return this.executeCommands(store, newCmdList); } catch (error) { return Promise.reject(error); } } }, { key: 'executeDoWhile', value: function executeDoWhile(store, cmd) { var outerRef = this; try { outerRef.loopTimers.push(Date.now()); outerRef.context.push(_context.Context.BREAKABLE); var $newStore = outerRef.executeCommands(store, cmd.commands); return $newStore.then(function (sto) { if (sto.mode === _modes.Modes.BREAK) { outerRef.context.pop(); sto.mode = _modes.Modes.RUN; outerRef.loopTimers.pop(); return sto; } var $value = outerRef.evaluateExpression(sto, cmd.expression); return $value.then(function (vl) { if (!vl.type.isCompatible(_types.Types.BOOLEAN)) { // TODO: Better error message -- Inform line and column from token!!!! // THIS IF SHOULD BE IN A SEMANTIC ANALYSER return Promise.reject(new Error('DoWhile expression must be of type boolean')); } if (vl.value) { outerRef.context.pop(); for (var i = 0; i < outerRef.loopTimers.length; i++) { var time = outerRef.loopTimers[i]; if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) { console.log("Kill by Timeout..."); outerRef.forceKill = true; return Promise.reject(new Error("Potential endless loop detected.")); } } return outerRef.executeCommand(sto, cmd); } else { outerRef.context.pop(); outerRef.loopTimers.pop(); console.log("Clear Timeout..."); return sto; } }); }); } catch (error) { return Promise.reject(error); } } }, { key: 'executeWhile', value: function executeWhile(store, cmd) { var outerRef = this; try { outerRef.loopTimers.push(Date.now()); outerRef.context.push(_context.Context.BREAKABLE); var $value = outerRef.evaluateExpression(store, cmd.expression); return $value.then(function (vl) { if (vl.type.isCompatible(_types.Types.BOOLEAN)) { if (vl.value) { var $newStore = outerRef.executeCommands(store, cmd.commands); return $newStore.then(function (sto) { outerRef.context.pop(); if (sto.mode === _modes.Modes.BREAK) { outerRef.loopTimers.pop(); sto.mode = _modes.Modes.RUN; return sto; } for (var i = 0; i < outerRef.loopTimers.length; i++) { var time = outerRef.loopTimers[i]; if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) { console.log("Kill by Timeout..."); outerRef.forceKill = true; return Promise.reject(new Error("Potential endless loop detected.")); } } return outerRef.executeCommand(sto, cmd); }); } else { outerRef.context.pop(); outerRef.loopTimers.pop(); console.log("Clear Timeout..."); return store; } } else { // TODO: Better error message -- Inform line and column from token!!!! // THIS IF SHOULD BE IN A SEMANTIC ANALYSER return Promise.reject(new Error('Loop condition must be of type boolean')); } }); } catch (error) { return Promise.reject(error); } } }, { key: 'executeIfThenElse', value: function executeIfThenElse(store, cmd) { var _this5 = this; try { var $value = this.evaluateExpression(store, cmd.condition); return $value.then(function (vl) { if (vl.type.isCompatible(_types.Types.BOOLEAN)) { if (vl.value) { return _this5.executeCommands(store, cmd.ifTrue.commands); } else if (cmd.ifFalse !== null) { if (cmd.ifFalse instanceof Commands.IfThenElse) { return _this5.executeCommand(store, cmd.ifFalse); } else { return _this5.executeCommands(store, cmd.ifFalse.commands); } } else { return Promise.resolve(store); } } else { // TODO: Better error message -- Inform line and column from token!!!! // THIS IF SHOULD BE IN A SEMANTIC ANALYSER return Promise.reject(new Error('If expression must be of type boolean')); } }); } catch (error) { return Promise.reject(error); } } }, { key: 'executeReturn', value: function executeReturn(store, cmd) { var _this6 = this; try { var funcType = store.applyStore('$'); var $value = this.evaluateExpression(store, cmd.expression); var funcName = store.applyStore('$name'); return $value.then(function (vl) { if (vl === null && funcType.isCompatible(_types.Types.VOID)) { return Promise.resolve(store); } if (vl === null || !funcType.type.isCompatible(vl.type)) { // TODO: Better error message -- Inform line and column from token!!!! // THIS IF SHOULD BE IN A SEMANTIC ANALYSER return Promise.reject(new Error('Function ' + funcName.value + ' must return ' + funcType.type + ' instead of ' + vl.type + '.')); } else { var realValue = _this6.parseStoreObjectValue(vl); store.updateStore('$', realValue); store.mode = _modes.Modes.RETURN; return Promise.resolve(store); } }); } catch (error) { return Promise.reject(error); } } }, { key: 'executeBreak', value: function executeBreak(store, _) { if (this.checkContext(_context.Context.BREAKABLE)) { store.mode = _modes.Modes.BREAK; return Promise.resolve(store); } else { return Promise.reject(new Error("!!!CRITIAL: Break command outside Loop/Switch scope!!!")); } } }, { key: 'executeAssign', value: function executeAssign(store, cmd) { var _this7 = this; try { var $value = this.evaluateExpression(store, cmd.expression); return $value.then(function (vl) { var realValue = _this7.parseStoreObjectValue(vl); store.updateStore(cmd.id, realValue); return store; }); } catch (error) { return Promise.reject(error); } } }, { key: 'executeArrayIndexAssign', value: function executeArrayIndexAssign(store, cmd) { var _this8 = this; var mustBeArray = store.applyStore(cmd.id); if (!(mustBeArray.type instanceof _compoundType.CompoundType)) { return Promise.reject(new Error(cmd.id + " is not a vector/matrix")); } var line$ = this.evaluateExpression(store, cmd.line); var column$ = this.evaluateExpression(store, cmd.column); var value$ = this.evaluateExpression(store, cmd.expression); return Promise.all([line$, column$, value$]).then(function (results) { var lineSO = results[0]; if (!_types.Types.INTEGER.isCompatible(lineSO.type)) { // TODO: better error message //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS return Promise.reject(new Error("Array dimension must be of type int")); } var line = lineSO.number; var columnSO = results[1]; var column = null; if (columnSO !== null) { if (!_types.Types.INTEGER.isCompatible(columnSO.type)) { // TODO: better error message //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS return Promise.reject(new Error("Array dimension must be of type int")); } column = columnSO.number; } var value = _this8.parseStoreObjectValue(results[2]); if (line >= mustBeArray.lines) { // TODO: better error message return Promise.reject(new Error(exp.id + ': index out of bounds: ' + lines)); } if (column !== null && mustBeArray.columns === null) { // TODO: better error message return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column)); } if (column !== null && column >= mustBeArray.columns) { // TODO: better error message return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column)); } var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray); if (column !== null) { if (value.type instanceof _compoundType.CompoundType) { return Promise.reject(new Error("Invalid operation. This must be a value: line " + cmd.sourceInfo.line)); } newArray.value[line].value[column] = value; store.updateStore(cmd.id, newArray); } else { if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType) { return Promise.reject(new Error("Invalid operation. This must be a vector: line " + cmd.sourceInfo.line)); } newArray.value[line] = value; store.updateStore(cmd.id, newArray); } return store; }); } }, { key: 'executeDeclaration', value: function executeDeclaration(store, cmd) { try { var $value = this.evaluateExpression(store, cmd.initial); if (cmd instanceof Commands.ArrayDeclaration) { var $lines = this.evaluateExpression(store, cmd.lines); var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns); return Promise.all([$lines, $columns, $value]).then(function (values) { var lineSO = values[0]; if (!_types.Types.INTEGER.isCompatible(lineSO.type)) { // TODO: better error message //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS return Promise.reject(new Error("Array dimension must be of type int")); } var line = lineSO.number; var columnSO = values[1]; var column = null; if (columnSO !== null) { if (!_types.Types.INTEGER.isCompatible(columnSO.type)) { // TODO: better error message //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS return Promise.reject(new Error("Array dimension must be of type int")); } column = columnSO.number; } var value = values[2]; var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null); store.insertStore(cmd.id, temp); var realValue = value; if (value !== null) { if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) { if (value.type instanceof _compoundType.CompoundType) { realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue); } else { realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue); } } } else { realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []); if (column !== null) { for (var i = 0; i < line; i++) { realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, [])); } } } realValue.readOnly = cmd.isConst; store.updateStore(cmd.id, realValue); return store; }); } else { var temp = new _storeObject.StoreObject(cmd.type, null); store.insertStore(cmd.id, temp); return $value.then(function (vl) { var realValue = vl; if (vl !== null) { if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) { if (vl.type instanceof _compoundType.CompoundType) { realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), vl.refValue); } else { realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue); } } } else { realValue = new _storeObject.StoreObject(cmd.type, 0); } realValue.readOnly = cmd.isConst; store.updateStore(cmd.id, realValue); return store; }); } } catch (e) { return Promise.reject(e); } } }, { key: 'evaluateExpression', value: function evaluateExpression(store, exp) { if (exp instanceof Expressions.UnaryApp) { return this.evaluateUnaryApp(store, exp); } else if (exp instanceof Expressions.InfixApp) { return this.evaluateInfixApp(store, exp); } else if (exp instanceof Expressions.ArrayAccess) { return this.evaluateArrayAccess(store, exp); } else if (exp instanceof Expressions.VariableLiteral) { return this.evaluateVariableLiteral(store, exp); } else if (exp instanceof Expressions.IntLiteral) { return this.evaluateLiteral(store, exp); } else if (exp instanceof Expressions.RealLiteral) { return this.evaluateLiteral(store, exp); } else if (exp instanceof Expressions.BoolLiteral) { return this.evaluateLiteral(store, exp); } else if (exp instanceof Expressions.StringLiteral) { return this.evaluateLiteral(store, exp); } else if (exp instanceof Expressions.ArrayLiteral) { return this.evaluateArrayLiteral(store, exp); } else if (exp instanceof Expressions.FunctionCall) { return this.evaluateFunctionCall(store, exp); } return Promise.resolve(null); } }, { key: 'evaluateFunctionCall', value: function evaluateFunctionCall(store, exp) { var func = this.findFunction(exp.id); if (_types.Types.VOID.isCompatible(func.returnType)) { // TODO: better error message return Promise.reject(new Error('Function ' + exp.id + ' cannot be used inside an expression')); } var $newStore = this.runFunction(func, exp.actualParameters, store); return $newStore.then(function (sto) { if (sto.mode !== _modes.Modes.RETURN) { return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id)); } var val = sto.applyStore('$'); if (val instanceof _storeObjectArray.StoreObjectArray) { return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val)); } else { return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val)); } }); } }, { key: 'evaluateArrayLiteral', value: function evaluateArrayLiteral(store, exp) { if (!exp.isVector) { var $matrix = this.evaluateMatrix(store, exp.value); return $matrix.then(function (list) { var type = new _compoundType.CompoundType(list[0].type.innerType, 2); var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list); if (arr.isValid) return Promise.resolve(arr);else return Promise.reject(new Error('Invalid array')); }); } else { return this.evaluateVector(store, exp.value).then(function (list) { var type = new _compoundType.CompoundType(list[0].type, 1); var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list); if (stoArray.isValid) return Promise.resolve(stoArray);else return Promise.reject(new Error('Invalid array')); }); } } }, { key: 'evaluateVector', value: function evaluateVector(store, exps) { var _this9 = this; return Promise.all(exps.map(function (exp) { return _this9.evaluateExpression(store, exp); })); } }, { key: 'evaluateMatrix', value: function evaluateMatrix(store, exps) { var _this10 = this; return Promise.all(exps.map(function (vector) { var $vector = _this10.evaluateVector(store, vector.value); return $vector.then(function (list) { var type = new _compoundType.CompoundType(list[0].type, 1); return new _storeObjectArray.StoreObjectArray(type, list.length, null, list); }); })); } }, { key: 'evaluateLiteral', value: function evaluateLiteral(_, exp) { return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value)); } }, { key: 'evaluateVariableLiteral', value: function evaluateVariableLiteral(store, exp) { try { var val = store.applyStore(exp.id); if (val instanceof _storeObjectArray.StoreObjectArray) { return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val)); } else { return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val)); } } catch (error) { return Promise.reject(error); } } }, { key: 'evaluateArrayAccess', value: function evaluateArrayAccess(store, exp) { var mustBeArray = store.applyStore(exp.id); if (!(mustBeArray.type instanceof _compoundType.CompoundType)) { // TODO: better error message console.log(mustBeArray.type); return Promise.reject(new Error(exp.id + ' is not of type array')); } var $line = this.evaluateExpression(store, exp.line); var $column = this.evaluateExpression(store, exp.column); return Promise.all([$line, $column]).then(function (values) { var lineSO = values[0]; var columnSO = values[1]; if (!_types.Types.INTEGER.isCompatible(lineSO.type)) { // TODO: better error message //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS return Promise.reject(new Error("Array dimension must be of type int")); } var line = lineSO.number; var column = null; if (columnSO !== null) { if (!_types.Types.INTEGER.isCompatible(columnSO.type)) { // TODO: better error message //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS return Promise.reject(new Error("Array dimension must be of type int")); } column = columnSO.number; } if (line >= mustBeArray.lines) { // TODO: better error message return Promise.reject(new Error(exp.id + ': index out of bounds: ' + lines)); } if (column !== null && mustBeArray.columns === null) { // TODO: better error message return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column)); } if (column !== null && column >= mustBeArray.columns) { // TODO: better error message return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column)); } return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store)); }); } }, { key: 'evaluateUnaryApp', value: function evaluateUnaryApp(store, unaryApp) { var $left = this.evaluateExpression(store, unaryApp.left); return $left.then(function (left) { var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type); if (_types.Types.UNDEFINED.isCompatible(resultType)) { // TODO: better urgent error message return Promise.reject(new Error('Cannot use this op to ' + left.type)); } switch (unaryApp.op.ord) { case _operators.Operators.ADD.ord: return new _storeObject.StoreObject(resultType, left.value); case _operators.Operators.SUB.ord: return new _storeObject.StoreObject(resultType, left.value.negated()); case _operators.Operators.NOT.ord: return new _storeObject.StoreObject(resultType, !left.value); default: return Promise.reject(new Error('!!!Critical Invalid UnaryApp ' + unaryApp.op)); } }); } }, { key: 'evaluateInfixApp', value: function evaluateInfixApp(store, infixApp) { var $left = this.evaluateExpression(store, infixApp.left); var $right = this.evaluateExpression(store, infixApp.right); return Promise.all([$left, $right]).then(function (values) { var left = values[0]; var right = values[1]; var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type); if (_types.Types.UNDEFINED.isCompatible(resultType)) { // TODO: better urgent error message return Promise.reject(new Error('Cannot use this ' + infixApp.op + ' to ' + left.type + ' and ' + right.type)); } var result = null; switch (infixApp.op.ord) { case _operators.Operators.ADD.ord: { if (_types.Types.STRING.isCompatible(left.type)) { var rightStr = (0, _parsers.convertToString)(right.value, right.type); return new _storeObject.StoreObject(resultType, left.value + rightStr); } else if (_types.Types.STRING.isCompatible(right.type)) { var leftStr = (0, _parsers.convertToString)(left.value, left.type); return new _storeObject.StoreObject(resultType, leftStr + right.value); } else { return new _storeObject.StoreObject(resultType, left.value.plus(right.value)); } } case _operators.Operators.SUB.ord: return new _storeObject.StoreObject(resultType, left.value.minus(right.value)); case _operators.Operators.MULT.ord: return new _storeObject.StoreObject(resultType, left.value.times(right.value)); case _operators.Operators.DIV.ord: { result = left.value / right.value; if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value); return new _storeObject.StoreObject(resultType, result); } case _operators.Operators.MOD.ord: return new _storeObject.StoreObject(resultType, left.value.modulo(right.value)); case _operators.Operators.GT.ord: { if (_types.Types.STRING.isCompatible(left.type)) { result = left.value.length > right.value.length; } else { result = left.value.gt(right.value); } return new _storeObject.StoreObject(resultType, result); } case _operators.Operators.GE.ord: { if (_types.Types.STRING.isCompatible(left.type)) { result = left.value.length >= right.value.length; } else { result = left.value.gte(right.value); } return new _storeObject.StoreObject(resultType, result); } case _operators.Operators.LT.ord: { if (_types.Types.STRING.isCompatible(left.type)) { result = left.value.length < right.value.length; } else { result = left.value.lt(right.value); } return new _storeObject.StoreObject(resultType, result); } case _operators.Operators.LE.ord: { if (_types.Types.STRING.isCompatible(left.type)) { result = left.value.length <= right.value.length; } else { result = left.value.lte(right.value); } return new _storeObject.StoreObject(resultType, result); } case _operators.Operators.EQ.ord: { if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) { result = left.value.eq(right.value); } else { result = left.value === right.value; } return new _storeObject.StoreObject(resultType, result); } case _operators.Operators.NEQ.ord: { if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) { result = !left.value.eq(right.value); } else { result = left.value !== right.value; } return new _storeObject.StoreObject(resultType, result); } case _operators.Operators.AND.ord: return new _storeObject.StoreObject(resultType, left.value && right.value); case _operators.Operators.OR.ord: return new _storeObject.StoreObject(resultType, left.value || right.value); default: return Promise.reject(new Error('!!!Critical Invalid InfixApp ' + infixApp.op)); } }); } }, { key: 'parseStoreObjectValue', value: function parseStoreObjectValue(vl) { var realValue = vl; if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) { if (vl.type instanceof _compoundType.CompoundType) { switch (vl.type.dimensions) { case 1: { realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value); break; } default: { throw new Error("Three dimensional array address..."); } } } else { realValue = new _storeObject.StoreObject(vl.type, vl.value); } } return realValue; } }]); return IVProgProcessor; }(); /***/ }), /***/ "./js/processor/lib/arrays.js": /*!************************************!*\ !*** ./js/processor/lib/arrays.js ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createNumElementsFun = createNumElementsFun; exports.createMatrixLinesFun = createMatrixLinesFun; exports.createMatrixColumnsFun = createMatrixColumnsFun; var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js"); var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js"); var Commands = _interopRequireWildcard(_commands); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js"); var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js"); var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } /** * num_elements * matrix_lines * matrix_columns */ function createNumElementsFun() { var numElementsFun = function numElementsFun(sto, _) { var vector = sto.applyStore("vector"); var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines)); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]); var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block); return func; } function createMatrixLinesFun() { var matrixLinesFun = function matrixLinesFun(sto, _) { var matrix = sto.applyStore("matrix"); var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines)); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]); var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block); return func; } function createMatrixColumnsFun() { var matrixColumnsFun = function matrixColumnsFun(sto, _) { var matrix = sto.applyStore("matrix"); var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns)); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]); var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block); return func; } /***/ }), /***/ "./js/processor/lib/io.js": /*!********************************!*\ !*** ./js/processor/lib/io.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createOutputFun = createOutputFun; exports.createInputFun = createInputFun; var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js"); var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js"); var Commands = _interopRequireWildcard(_commands); var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js"); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function createOutputFun() { var writeFunction = function writeFunction(store, _) { var val = store.applyStore('p1'); if (val.type.isCompatible(_types.Types.INTEGER)) { this.output.sendOutput(val.value.toString()); } else if (val.type.isCompatible(_types.Types.REAL)) { if (val.value.dp() <= 0) { this.output.sendOutput(val.value.toFixed(1)); } else { this.output.sendOutput(val.value.toString()); } } else { this.output.sendOutput(val.value); } return Promise.resolve(store); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]); var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block); return func; } function createInputFun() { var readFunction = function readFunction(store, _) { var _this = this; var request = new Promise(function (resolve, _) { _this.input.requestInput(resolve); }); return request.then(function (text) { var typeToConvert = store.applyStore('p1').type; var stoObj = null; if (typeToConvert.isCompatible(_types.Types.INTEGER)) { var val = (0, _parsers.toInt)(text); stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val); } else if (typeToConvert.isCompatible(_types.Types.REAL)) { stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text)); } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) { stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text)); } else if (typeToConvert.isCompatible(_types.Types.STRING)) { stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text)); } _this.loopTimers.splice(0, _this.loopTimers.length); store.updateStore('p1', stoObj); return Promise.resolve(store); }); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]); var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block); return func; } /***/ }), /***/ "./js/processor/lib/lang.js": /*!**********************************!*\ !*** ./js/processor/lib/lang.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createIsRealFun = createIsRealFun; exports.createIsIntFun = createIsIntFun; exports.createIsBoolFun = createIsBoolFun; exports.createCastRealFun = createCastRealFun; exports.createCastIntFun = createCastIntFun; exports.createCastBoolFun = createCastBoolFun; exports.createCastStringFun = createCastStringFun; var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js"); var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js"); var Commands = _interopRequireWildcard(_commands); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js"); var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js"); var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js"); var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } /** * * is_real * is_int * is_bool * cast_real * cast_int * cast_bool * cast_string */ function createIsRealFun() { var isRealFun = function isRealFun(sto, _) { var str = sto.applyStore("str"); var parser = _ivprogParser.IVProgParser.createParser(str.value); var result = false; try { var val = parser.parseTerm(); if (val instanceof _expressions.RealLiteral) { result = true; } } catch (error) {} var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]); var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block); return func; } function createIsIntFun() { var isIntFun = function isIntFun(sto, _) { var str = sto.applyStore("str"); var parser = _ivprogParser.IVProgParser.createParser(str.value); var result = false; try { var val = parser.parseTerm(); if (val instanceof _expressions.IntLiteral) { result = true; } } catch (error) {} var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]); var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block); return func; } function createIsBoolFun() { var isBoolFun = function isBoolFun(sto, _) { var str = sto.applyStore("str"); var parser = _ivprogParser.IVProgParser.createParser(str.value); var result = false; try { var val = parser.parseTerm(); if (val instanceof _expressions.BoolLiteral) { result = true; } } catch (error) {} var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]); var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block); return func; } function createCastRealFun() { var castRealFun = function castRealFun(sto, _) { var val = sto.applyStore("val"); switch (val.type.ord) { case _types.Types.INTEGER.ord: { var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number)); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); } case _types.Types.STRING.ord: { var parser = _ivprogParser.IVProgParser.createParser(val.value); try { var result = parser.parseTerm(); if (result instanceof _expressions.RealLiteral) { var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", _temp)); } } catch (error) { return Promise.reject("cannot convert string to real"); } } } }; var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]); var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block); return func; } function createCastIntFun() { var castIntFun = function castIntFun(sto, _) { var val = sto.applyStore("val"); switch (val.type.ord) { case _types.Types.REAL.ord: { var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number)); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); } case _types.Types.STRING.ord: { var parser = _ivprogParser.IVProgParser.createParser(val.value); try { var result = parser.parseTerm(); if (result instanceof _expressions.IntLiteral) { var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", _temp2)); } } catch (error) { return Promise.reject("cannot convert string to real"); } } } }; var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]); var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block); return func; } function createCastBoolFun() { var castBoolFun = function castBoolFun(sto, _) { var str = sto.applyStore("str"); var parser = _ivprogParser.IVProgParser.createParser(str.value); try { var val = parser.parseTerm(); if (val instanceof _expressions.BoolLiteral) { var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); } } catch (error) {} return Promise.reject("cannot convert " + str.value + " to boolean"); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]); var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block); return func; } function createCastStringFun() { var castStringFun = function castStringFun(store, _) { var val = store.applyStore('str'); var result = (0, _parsers.convertToString)(val); var temp = new _storeObject.StoreObject(_types.Types.STRING, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]); var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block); return func; } /***/ }), /***/ "./js/processor/lib/math.js": /*!**********************************!*\ !*** ./js/processor/lib/math.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSinFun = createSinFun; exports.createCosFun = createCosFun; exports.createTanFun = createTanFun; exports.createSqrtFun = createSqrtFun; exports.createPowFun = createPowFun; exports.createLogFun = createLogFun; exports.createAbsFun = createAbsFun; exports.createNegateFun = createNegateFun; exports.createInvertFun = createInvertFun; exports.createMaxFun = createMaxFun; exports.createMinFun = createMinFun; var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js"); var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js"); var Commands = _interopRequireWildcard(_commands); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js"); var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js"); var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js"); var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js"); var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /** * sin * cos * tan * sqrt * pow * log * abs * negate * invert * max * min */ function convertToRadians(degrees) { return degrees.times(_decimal.Decimal.acos(-1)).div(180); } function createSinFun() { var sinFun = function sinFun(sto, _) { var x = sto.applyStore('x'); var result = _decimal.Decimal.sin(convertToRadians(x.value)); var temp = new _storeObject.StoreObject(_types.Types.REAL, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]); var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block); return func; } function createCosFun() { var cosFun = function cosFun(sto, _) { var x = sto.applyStore('x'); var result = _decimal.Decimal.cos(convertToRadians(x.value)); var temp = new _storeObject.StoreObject(_types.Types.REAL, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]); var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block); return func; } function createTanFun() { var tanFun = function tanFun(sto, _) { var x = sto.applyStore('x'); var result = _decimal.Decimal.tan(convertToRadians(x.value)); var temp = new _storeObject.StoreObject(_types.Types.REAL, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]); var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block); return func; } function createSqrtFun() { var sqrtFun = function sqrtFun(sto, _) { var x = sto.applyStore('x'); var result = x.value.sqrt(); var temp = new _storeObject.StoreObject(_types.Types.REAL, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]); var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block); return func; } function createPowFun() { var powFun = function powFun(sto, _) { var x = sto.applyStore('x'); var y = sto.applyStore('y'); var result = x.value.pow(y.value); var temp = new _storeObject.StoreObject(_types.Types.REAL, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]); var func = new Commands.Function('$pow', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false), new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'y', false)], block); return func; } function createLogFun() { var logFun = function logFun(sto, _) { var x = sto.applyStore('x'); if (x.value.isNegative()) { return Promise.reject("the value passed to log function cannot be negative"); } var result = _decimal.Decimal.log10(x.value); var temp = new _storeObject.StoreObject(_types.Types.REAL, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]); var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block); return func; } function createAbsFun() { var absFun = function absFun(sto, _) { var x = sto.applyStore('x'); var result = x.value.abs(); var temp = new _storeObject.StoreObject(x.type, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]); var func = new Commands.Function('$abs', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block); return func; } function createNegateFun() { var negateFun = function negateFun(sto, _) { var x = sto.applyStore('x'); var result = x.value.negated(); var temp = new _storeObject.StoreObject(x.type, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]); var func = new Commands.Function('$negate', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block); return func; } function createInvertFun() { var invertFun = function invertFun(sto, _) { var x = sto.applyStore('x'); var result = (0, _parsers.toReal)(1).dividedBy(x.value); var temp = new _storeObject.StoreObject(_types.Types.REAL, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]); var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block); return func; } function createMaxFun() { var maxFun = function maxFun(sto, _) { var x = sto.applyStore('x'); var numbers = x.value.map(function (stoObj) { return stoObj.value; }); var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers)); var temp = new _storeObject.StoreObject(x.type.innerType, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1); var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]); var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block); return func; } function createMinFun() { var minFun = function minFun(sto, _) { var x = sto.applyStore('x'); var numbers = x.value.map(function (stoObj) { return stoObj.value; }); var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers)); var temp = new _storeObject.StoreObject(x.type.innerType, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore('$', temp)); }; var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1); var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]); var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block); return func; } /***/ }), /***/ "./js/processor/lib/strings.js": /*!*************************************!*\ !*** ./js/processor/lib/strings.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSubstringFun = createSubstringFun; exports.createLengthFun = createLengthFun; exports.createUppercaseFun = createUppercaseFun; exports.createLowercaseFun = createLowercaseFun; exports.createrCharAtFun = createrCharAtFun; var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js"); var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js"); var Commands = _interopRequireWildcard(_commands); var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js"); var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js"); var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } /* * substring * length * uppercase * lowercase * charAt **/ function createSubstringFun() { var substringFun = function substringFun(sto, _) { var str = sto.applyStore("str"); var start = sto.applyStore("start"); var end = sto.applyStore("end"); var result = str.value.substring(start.value, end.value); var temp = new _storeObject.StoreObject(_types.Types.STRING, result); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]); var func = new Commands.Function('$substring', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'start', false), new Commands.FormalParameter(_types.Types.INTEGER, 'end', false)], block); return func; } function createLengthFun() { var lengthFun = function lengthFun(sto, _) { var str = sto.applyStore("str"); var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length)); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]); var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block); return func; } function createUppercaseFun() { var uppercaseFun = function uppercaseFun(sto, _) { var str = sto.applyStore("str"); var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase()); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]); var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block); return func; } function createLowercaseFun() { var lowercaseFun = function lowercaseFun(sto, _) { var str = sto.applyStore("str"); var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase()); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]); var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block); return func; } function createrCharAtFun() { var charAtFun = function charAtFun(sto, _) { var str = sto.applyStore("str"); var idx = sto.applyStore("index"); if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) { return Promise.reject(new Error("invalid string position")); } var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber())); sto.mode = _modes.Modes.RETURN; return Promise.resolve(sto.updateStore("$", temp)); }; var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]); var func = new Commands.Function('$charAt', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'index', false)], block); return func; } /***/ }), /***/ "./js/processor/modes.js": /*!*******************************!*\ !*** ./js/processor/modes.js ***! \*******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Modes = exports.Modes = Object.freeze({ RETURN: Symbol('mode:return'), BREAK: Symbol('mode:break'), PAUSE: Symbol('mode:pause'), RUN: Symbol('mode:run') }); /***/ }), /***/ "./js/processor/semantic/semanticAnalyser.js": /*!***************************************************!*\ !*** ./js/processor/semantic/semanticAnalyser.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SemanticAnalyser = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js"); var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js"); var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js"); var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js"); var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js"); var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js"); var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js"); var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js"); var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js"); var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var SemanticAnalyser = exports.SemanticAnalyser = function () { function SemanticAnalyser(ast) { _classCallCheck(this, SemanticAnalyser); this.ast = ast; this.lexerClass = _languageService.LanguageService.getCurrentLexer(); var lexer = new this.lexerClass(null); this.literalNames = lexer.literalNames; this.symbolMap = null; } _createClass(SemanticAnalyser, [{ key: 'pushMap', value: function pushMap() { if (this.symbolMap === null) { this.symbolMap = { map: {}, next: null }; } else { var n = { map: {}, next: this.symbolMap }; this.symbolMap = n; } } }, { key: 'popMap', value: function popMap() { if (this.symbolMap !== null) { this.symbolMap = this.symbolMap.next; } } }, { key: 'insertSymbol', value: function insertSymbol(id, typeInfo) { this.symbolMap.map[id] = typeInfo; } }, { key: 'findSymbol', value: function findSymbol(id, symMap) { if (!symMap.map[id]) { if (symMap.next) { return this.findSymbol(id, symMap.next); } throw new Error("variable not defined " + id); } else { return symMap.map[id]; } } }, { key: 'findFunction', value: function findFunction(name) { if (name.match(/^\$.+$/)) { var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name); if (!!!fun) { throw new Error("!!!Internal Error. Language defined function not implemented -> " + name + "!!!"); } return fun; } else { var val = this.ast.functions.find(function (v) { return v.name === name; }); if (!!!val) { // TODO: better error message; throw new Error('Function ' + name + ' is not defined.'); } return val; } } }, { key: 'analyseTree', value: function analyseTree() { var globalVars = this.ast.global; this.pushMap(); this.assertDeclarations(globalVars); var functions = this.ast.functions; var mainFunc = functions.filter(function (f) { return f.name === null; }); if (mainFunc.length <= 0) { throw new Error("no main func..."); } else if (mainFunc.length > 1) { throw new Error("only one main func..."); } for (var i = 0; i < functions.length; i++) { var fun = functions[i]; this.assertFunction(fun); } return this.ast; } }, { key: 'assertDeclarations', value: function assertDeclarations(list) { for (var i = 0; i < list.length; i++) { this.assertDeclaration(list[i]); } } }, { key: 'assertDeclaration', value: function assertDeclaration(declaration) { if (declaration instanceof _commands.ArrayDeclaration) { if (declaration.initial === null) { var lineType = this.evaluateExpressionType(declaration.lines); if (!lineType.isCompatible(_types.Types.INTEGER)) { throw new Error("dim must be int"); } if (declaration.columns !== null) { var columnType = this.evaluateExpressionType(declaration.columns); if (!columnType.isCompatible(_types.Types.INTEGER)) { throw new Error("dim must be int"); } } this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type }); return; } this.evaluateArrayLiteral(declaration.lines, declaration.columns, declaration.type, declaration.initial); this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type }); } else { if (declaration.initial === null) { this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type }); return; } var resultType = this.evaluateExpressionType(declaration.initial); if (resultType instanceof _multiType.MultiType) { if (!resultType.isCompatible(declaration.type)) { throw new Error('Invalid type'); } this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type }); } else if (!declaration.type.isCompatible(resultType)) { throw new Error('Invalid type'); } else { this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type }); } } } }, { key: 'evaluateExpressionType', value: function evaluateExpressionType(expression) { if (expression instanceof _expressions.UnaryApp) { var op = expression.op; var resultType = this.evaluateExpressionType(expression.left); return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType); } else if (expression instanceof _expressions.InfixApp) { var _op = expression.op; var resultTypeLeft = this.evaluateExpressionType(expression.left); var resultTypeRight = this.evaluateExpressionType(expression.right); return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight); } else if (expression instanceof _literal.Literal) { return this.evaluateLiteralType(expression); } else if (expression instanceof _expressions.FunctionCall) { var fun = this.findFunction(expression.id); if (fun.returnType.isCompatible(_types.Types.VOID)) { throw new Error("void return"); } this.assertParameters(fun, expression.actualParameters); return fun.returnType; } else if (expression instanceof _expressions.ArrayAccess) { var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap); if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) { throw new Error("it's not an array"); } var lineType = this.evaluateExpressionType(expression.line); if (!lineType.isCompatible(_types.Types.INTEGER)) { throw new Error("line must be integer"); } if (expression.column !== null) { if (arrayTypeInfo.columns === null) { throw new Error("it's not a matrix"); } var columnType = this.evaluateExpressionType(expression.column); if (!columnType.isCompatible(_types.Types.INTEGER)) { throw new Error("column must be integer"); } } var arrType = arrayTypeInfo.type; if (expression.column !== null) { // indexing matrix return arrType.innerType; } else { if (arrayTypeInfo.columns === null) { return arrType.innerType; } return new _compoundType.CompoundType(arrType.innerType, 1); } } } }, { key: 'evaluateLiteralType', value: function evaluateLiteralType(literal) { if (literal instanceof _expressions.IntLiteral) { return literal.type; } else if (literal instanceof _expressions.RealLiteral) { return literal.type; } else if (literal instanceof _expressions.StringLiteral) { return literal.type; } else if (literal instanceof _expressions.BoolLiteral) { return literal.type; } else if (literal instanceof _expressions.VariableLiteral) { var typeInfo = this.findSymbol(literal.id, this.symbolMap); if (typeInfo.type instanceof _compoundType.CompoundType) { return typeInfo.type; } return typeInfo.type; } else { console.warn("Evaluating type only for an array literal..."); var last = null; if (literal.value.length === 1) { last = this.evaluateExpressionType(literal.value[0]); } else { for (var i = 0; i < literal.value.length; i++) { var e = this.evaluateExpressionType(literal.value[i]); if (last === null) { last = e; } else if (!last.isCompatible(e)) { throw new Error("invalid value type for array"); } else { last = e; } } } if (last instanceof _compoundType.CompoundType) { return new _compoundType.CompoundType(last.innerType, last.dimensions + 1); } return new _compoundType.CompoundType(last, 1); } } }, { key: 'evaluateArrayLiteral', value: function evaluateArrayLiteral(lines, columns, type, literal) { var _this = this; if (literal instanceof _expressions.ArrayLiteral) { if (columns === null) { // it's a vector... var dimType = this.evaluateExpressionType(lines); if (!dimType.isCompatible(_types.Types.INTEGER)) { throw new Error("dim must be int"); } if (lines instanceof _expressions.IntLiteral && !lines.value.eq(literal.value.length)) { throw new Error("invalid array size"); } literal.value.reduce(function (last, next) { var eType = _this.evaluateExpressionType(next); if (!last.canAccept(eType)) { throw new Error("invalid value type for array"); } return last; }, type); return true; } else { var _dimType = this.evaluateExpressionType(columns); if (!_dimType.isCompatible(_types.Types.INTEGER)) { throw new Error("dim must be int"); } if (columns instanceof _expressions.IntLiteral && !columns.value.eq(literal.value.length)) { throw new Error("invalid array size"); } for (var i = 0; i < columns; i++) { var anotherArray = literal.value[i]; this.evaluateArrayLiteral(lines, null, type, anotherArray); } } } else { var resultType = this.evaluateExpressionType(literal); if (!(resultType instanceof _compoundType.CompoundType)) { throw new Error("initial must be of type array"); } if (!type.isCompatible(resultType)) { throw new Error("invalid array type"); } return true; } } }, { key: 'assertFunction', value: function assertFunction(fun) { var _this2 = this; this.pushMap(); fun.formalParameters.forEach(function (formalParam) { if (formalParam.type instanceof _compoundType.CompoundType) { if (formalParam.type.dimensions > 1) { _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type }); } else { _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type }); } } else { _this2.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type }); } }); this.assertDeclarations(fun.variablesDeclarations); var optional = fun.returnType.isCompatible(_types.Types.VOID); var valid = this.assertReturn(fun, optional); if (!valid) { throw new Error("function has no accessible return"); } this.popMap(); } }, { key: 'assertReturn', value: function assertReturn(fun, optional) { var _this3 = this; return fun.commands.reduce(function (last, next) { return _this3.checkCommand(fun.returnType, next, optional) || last; }, optional); } }, { key: 'checkCommand', value: function checkCommand(type, cmd, optional) { if (cmd instanceof _commands.While) { var resultType = this.evaluateExpressionType(cmd.expression); if (!resultType.isCompatible(_types.Types.BOOLEAN)) { throw new Error("condition not boolean"); } this.checkCommands(type, cmd.commands, optional); return false; } else if (cmd instanceof _commands.For) { this.checkCommand(type, cmd.assignment, optional); var _resultType = this.evaluateExpressionType(cmd.condition); if (!_resultType.isCompatible(_types.Types.BOOLEAN)) { throw new Error("condition not boolean"); } this.checkCommand(type, cmd.increment, optional); this.checkCommands(type, cmd.commands, optional); return false; } else if (cmd instanceof _commands.Switch) { var sType = this.evaluateExpressionType(cmd.expression); var result = optional; var hasDefault = false; for (var i = 0; i < cmd.cases.length; i++) { var aCase = cmd.cases[i]; if (aCase.expression !== null) { var caseType = this.evaluateExpressionType(aCase.expression); if (!sType.isCompatible(caseType)) { throw new Error("invalid type in case"); } } else { hasDefault = true; } result = result && this.checkCommands(type, aCase.commands, result); } return result && hasDefault; } else if (cmd instanceof _commands.ArrayIndexAssign) { var typeInfo = this.findSymbol(cmd.id, this.symbolMap); if (!(typeInfo.type instanceof _compoundType.CompoundType)) { throw new Error(cmd.id + " is not an array."); } var exp = cmd.expression; var lineExp = cmd.line; var lineType = this.evaluateExpressionType(lineExp); if (!lineType.isCompatible(_types.Types.INTEGER)) { throw new Error("array dimension must be of type int"); } var columnExp = cmd.column; if (typeInfo.columns === null && columnExp !== null) { throw new Error(cmd.id + " is not a matrix"); } else if (columnExp !== null) { var columnType = this.evaluateExpressionType(columnExp); if (!columnType.isCompatible(_types.Types.INTEGER)) { throw new Error("array dimension must be of type int"); } } // exp can be a arrayLiteral, a single value exp or an array access if (exp instanceof _expressions.ArrayLiteral) { this.evaluateArrayLiteral(typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp); } else { // cannot properly evaluate since type system is poorly constructed } return optional; } else if (cmd instanceof _commands.Assign) { var _typeInfo = this.findSymbol(cmd.id, this.symbolMap); var _exp = cmd.expression; if (_exp instanceof _expressions.ArrayLiteral) { if (!(_typeInfo.type instanceof _compoundType.CompoundType)) { throw new Error("type not compatible"); } this.evaluateArrayLiteral(_typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp); } else { var _resultType2 = this.evaluateExpressionType(_exp); if (!_resultType2.isCompatible(_typeInfo.type)) { throw new Error("type not compatible"); } } return optional; } else if (cmd instanceof _commands.Break) { return optional; } else if (cmd instanceof _commands.IfThenElse) { var _resultType3 = this.evaluateExpressionType(cmd.condition); if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) { throw new Error("condition not boolean"); } if (cmd.ifFalse instanceof _commands.IfThenElse) { return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional); } else { return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional); } } else if (cmd instanceof _expressions.FunctionCall) { var fun = this.findFunction(cmd.id); this.assertParameters(fun, cmd.actualParameters); return optional; } else if (cmd instanceof _commands.Return) { if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) { throw new Error('invalid return type'); } else if (cmd.expression !== null) { var _resultType4 = this.evaluateExpressionType(cmd.expression); if (!type.isCompatible(_resultType4)) { console.log(_resultType4); throw new Error('invalid return type'); } else { return true; } } else { return true; } } } }, { key: 'checkCommands', value: function checkCommands(type, cmds, optional) { var _this4 = this; return cmds.reduce(function (last, next) { return _this4.checkCommand(type, next, optional) || last; }, optional); } }, { key: 'assertParameters', value: function assertParameters(fun, actualParametersList) { if (fun.formalParameters.length !== actualParametersList.length) { throw new Error("wrong number of parameters..."); } for (var i = 0; i < actualParametersList.length; i++) { var param = actualParametersList[i]; var formalParam = fun.formalParameters[i]; if (formalParam.byRef) { if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) { throw new Error("Invalid param type for ref"); } } var resultType = this.evaluateExpressionType(param); if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) { var shared = 0; for (var j = 0; j < resultType.types.length; j++) { var element = resultType.types[j]; if (formalParam.type.types.indexOf(element) !== -1) { shared++; } } if (shared <= 0) { throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.'); } } else if (resultType instanceof _multiType.MultiType) { if (!resultType.isCompatible(formalParam.type)) { throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.'); } } else if (!formalParam.type.isCompatible(resultType)) { console.log("####"); console.log(resultType); console.log("####"); console.log(formalParam.type); throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.'); } } } }]); return SemanticAnalyser; }(); /***/ }), /***/ "./js/processor/store/store.js": /*!*************************************!*\ !*** ./js/processor/store/store.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Store = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Store = exports.Store = function () { function Store() { _classCallCheck(this, Store); this.store = {}; this.nextStore = null; this.mode = _modes.Modes.RUN; } _createClass(Store, [{ key: "extendStore", value: function extendStore(nextStore) { this.nextStore = nextStore; } }, { key: "applyStore", value: function applyStore(id) { if (!this.store[id]) { if (this.nextStore !== null) { return this.nextStore.applyStore(id); } else { // TODO: better error message throw new Error("Variable " + id + " not found."); } } var val = this.store[id]; if (val.isRef) { return val.getRefObj(); } return this.store[id]; } }, { key: "updateStore", value: function updateStore(id, stoObj) { if (!this.store[id]) { if (this.nextStore !== null) { this.nextStore.updateStore(id, stoObj); return this; } else { // TODO: better error message throw new Error("Variable " + id + " not found."); } } else { var oldObj = this.store[id]; if (oldObj.readOnly) { // TODO: better error message throw new Error("Cannot change value of a read only variable: " + id); } if (oldObj.isRef) { oldObj.updateRef(stoObj); return this; } else if (oldObj.isCompatible(stoObj)) { stoObj.setID(id); this.store[id] = Object.freeze(stoObj); return this; } else { var oldType = oldObj.type; var stoType = stoObj.type; // TODO: better error message throw new Error(oldType + " is not compatible with type " + stoType + " given"); } } } //In case of future use of ref, it needs to have a special function to update the storeRefObject // and no the StoreObject refferenced by it // updateStoreRef(id, stoObjAddress) {...} }, { key: "insertStore", value: function insertStore(id, stoObj) { if (this.store[id]) { // TODO: better error message throw new Error(id + " is already defined"); } stoObj.setID(id); this.store[id] = Object.freeze(stoObj); return this; } }]); return Store; }(); /***/ }), /***/ "./js/processor/store/storeObject.js": /*!*******************************************!*\ !*** ./js/processor/store/storeObject.js ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StoreObject = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js"); var _decimal2 = _interopRequireDefault(_decimal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var StoreObject = exports.StoreObject = function () { function StoreObject(type, value) { var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; _classCallCheck(this, StoreObject); this._type = type; this._value = value; this._readOnly = readOnly; this._id = null; } _createClass(StoreObject, [{ key: 'setID', value: function setID(id) { this._id = id; } }, { key: 'isCompatible', value: function isCompatible(another) { if (another instanceof StoreObject) { return this.type.isCompatible(another.type); } return false; } }, { key: 'id', get: function get() { return this._id; } }, { key: 'inStore', get: function get() { return this.id !== null; } }, { key: 'type', get: function get() { return this._type; } }, { key: 'value', get: function get() { return this._value; } }, { key: 'number', get: function get() { if (this._value instanceof _decimal2.default) { return this._value.toNumber(); } else { return null; } } }, { key: 'readOnly', get: function get() { return this._readOnly; }, set: function set(value) { this._readOnly = value; } }]); return StoreObject; }(); /***/ }), /***/ "./js/processor/store/storeObjectArray.js": /*!************************************************!*\ !*** ./js/processor/store/storeObjectArray.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StoreObjectArray = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) { _inherits(StoreObjectArray, _StoreObject); function StoreObjectArray(type, lines, columns) { var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; _classCallCheck(this, StoreObjectArray); var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly)); _this._lines = lines; _this._columns = columns; return _this; } _createClass(StoreObjectArray, [{ key: 'isCompatible', value: function isCompatible(another) { if (another instanceof _storeObject.StoreObject) { if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) { if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) { return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another); } } } return false; } }, { key: 'lines', get: function get() { return this._lines; } }, { key: 'columns', get: function get() { return this._columns; } }, { key: 'isVector', get: function get() { return this.type.dimensions === 1; } }, { key: 'isValid', get: function get() { var _this2 = this; if (this.value !== null) { if (this.isVector) { if (this.value.length !== this.lines) { return false; } var mustBeNull = this.value.find(function (v) { return !_this2.type.canAccept(v.type); }); if (!!mustBeNull) { return false; } } return true; } else { if (this.lines !== this.value.length) { return false; } for (var i = 0; i < this.lines; i++) { for (var j = 0; j < this.columns; j++) { var arr = this.value[i]; if (arr.length !== this.columns) { return false; } var _mustBeNull = arr.find(function (v) { return !_this2.type.canAccept(v.type); }); if (!!_mustBeNull) { return false; } } } return true; } } }]); return StoreObjectArray; }(_storeObject.StoreObject); /***/ }), /***/ "./js/processor/store/storeObjectArrayAddress.js": /*!*******************************************************!*\ !*** ./js/processor/store/storeObjectArrayAddress.js ***! \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StoreObjectArrayAddress = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js"); var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js"); var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) { _inherits(StoreObjectArrayAddress, _StoreObject); function StoreObjectArrayAddress(refID, line, column, store) { _classCallCheck(this, StoreObjectArrayAddress); var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false)); _this.refID = refID; _this.store = store; _this.line = line; _this.column = column; return _this; } _createClass(StoreObjectArrayAddress, [{ key: 'getArrayObject', value: function getArrayObject() { return this.store.applyStore(this.refID); } }, { key: 'updateArrayObject', value: function updateArrayObject(stoObj) { var anArray = this.getArrayObject(); var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray); if (!stoObj.type.isCompatible(this.type)) { throw new Error('Invalid operation: cannot assign the value given to ' + this.refID); } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) { throw new Error('Invalid operation: cannot assign the value given to ' + this.refID); } if (this.column !== null) { newArray.value[this.line].value[this.column] = stoObj; return newArray; } else { newArray.value[this.line] = stoObj; return newArray; } } }, { key: 'isCompatible', value: function isCompatible(another) { if (this.type.isCompatible(another.type)) { if (another.type instanceof _compoundType.CompoundType) { return this.lines === another.lines && this.columns === another.columns; } else { this.refValue.isCompatible(another); } } } }, { key: 'isRef', get: function get() { return false; } }, { key: 'inStore', get: function get() { return true; } }, { key: 'refValue', get: function get() { var refLine = this.store.applyStore(this.refID).value[this.line]; if (this.column !== null) { var refColumn = refLine.value[this.column]; return refColumn; } return refLine; } }, { key: 'value', get: function get() { return this.refValue.value; } }, { key: 'type', get: function get() { return this.refValue.type; } }, { key: 'lines', get: function get() { if (!(this.type instanceof _compoundType.CompoundType)) { return null; } return this.refValue.value.length; } }, { key: 'columns', get: function get() { switch (this.type.dimensions) { case 2: return this.refValue.value[0].value.length; default: return null; } } }]); return StoreObjectArrayAddress; }(_storeObject.StoreObject); /***/ }), /***/ "./js/processor/store/storeObjectArrayAddressRef.js": /*!**********************************************************!*\ !*** ./js/processor/store/storeObjectArrayAddressRef.js ***! \**********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StoreObjectArrayAddressRef = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js"); var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js"); var _decimal2 = _interopRequireDefault(_decimal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) { _inherits(StoreObjectArrayAddressRef, _StoreObject); function StoreObjectArrayAddressRef(address) { _classCallCheck(this, StoreObjectArrayAddressRef); var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false)); _this.address = address; return _this; } _createClass(StoreObjectArrayAddressRef, [{ key: 'getRefObj', value: function getRefObj() { return this.address.refValue; } }, { key: 'updateRef', value: function updateRef(stoObj) { var newArray = this.address.updateArrayObject(stoObj); this.address.store.updateStore(this.address.refID, newArray); } }, { key: 'isCompatible', value: function isCompatible(another) { return this.address.isCompatible(another); } }, { key: 'isRef', get: function get() { return true; } }, { key: 'type', get: function get() { return this.address.type; } }, { key: 'value', get: function get() { return this.address.value; } }, { key: 'number', get: function get() { if (this.value instanceof _decimal2.default) { return this.value.toNumber(); } else { return null; } } }]); return StoreObjectArrayAddressRef; }(_storeObject.StoreObject); /***/ }), /***/ "./js/processor/store/storeObjectRef.js": /*!**********************************************!*\ !*** ./js/processor/store/storeObjectRef.js ***! \**********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StoreObjectRef = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js"); var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js"); var _decimal2 = _interopRequireDefault(_decimal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) { _inherits(StoreObjectRef, _StoreObject); function StoreObjectRef(refID, store) { _classCallCheck(this, StoreObjectRef); var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false)); _this.refID = refID; _this.store = store; return _this; } _createClass(StoreObjectRef, [{ key: 'getRefObj', value: function getRefObj() { return this.store.applyStore(this.refID); } }, { key: 'updateRef', value: function updateRef(stoObj) { this.store.updateStore(this.refID, stoObj); } }, { key: 'isCompatible', value: function isCompatible(another) { return this.store.applyStore(this.refID).isCompatible(another); } }, { key: 'isRef', get: function get() { return true; } }, { key: 'type', get: function get() { return this.store.applyStore(this.refID).type; } }, { key: 'value', get: function get() { return this.store.applyStore(this.refID).value; } }, { key: 'number', get: function get() { if (this.value instanceof _decimal2.default) { return this.value.toNumber(); } else { return null; } } }]); return StoreObjectRef; }(_storeObject.StoreObject); /***/ }), /***/ "./js/runner.js": /*!**********************!*\ !*** ./js/runner.js ***! \**********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runner = runner; var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js"); var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js"); var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js"); var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js"); var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js"); function runner() { var ivprogLexer = _languageService.LanguageService.getCurrentLexer(); // const lexer = new ivprogLexer(new InputStream(input)); // const stream = new CommonTokenStream(lexer); // stream.fill(); // let i = 1; // let token = null; // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) { // console.log(`${token.type}-${token.text}`); // console.log('\n') // i++; // } // const anaSin = new IVProgParser(input, ivprogLexer); var editor = new JsonEditor('#json-renderer', {}); var domConsole = new _domConsole.DOMConsole("#console"); // proc.interpretAST().then( sto => { // console.log(sto.applyStore('a')); // }).catch(e => console.log(e)); try { $('#btn').click(function () { var input = $('#input').val(); var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer); try { var data = analiser.parseTree(); var semAna = new _semanticAnalyser.SemanticAnalyser(data); var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree()); proc.registerInput(domConsole); domConsole.clear(); proc.registerOutput(domConsole); proc.interpretAST().then(function (sto) { return editor.load(sto.store); }).catch(function (e) { alert(e);console.log(e); }); } catch (error) { alert(error); console.log(error); } }); } catch (a) { console.log(a); } } /***/ }), /***/ "./js/semantic/semantic.min.js": /*!*************************************!*\ !*** ./js/semantic/semantic.min.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* * # Semantic UI - 2.3.3 * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function (e, t, n, i) { e.site = e.fn.site = function (o) { var a, r, s = new Date().getTime(), l = [], c = arguments[0], u = "string" == typeof c, d = [].slice.call(arguments, 1), f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings), m = f.namespace, g = f.error, p = "module-" + m, h = e(n), v = this, b = h.data(p);return a = { initialize: function initialize() { a.instantiate(); }, instantiate: function instantiate() { a.verbose("Storing instance of site", a), b = a, h.data(p, a); }, normalize: function normalize() { a.fix.console(), a.fix.requestAnimationFrame(); }, fix: { console: function (_console) { function console() { return _console.apply(this, arguments); } console.toString = function () { return _console.toString(); }; return console; }(function () { a.debug("Normalizing window.console"), console !== i && console.log !== i || (a.verbose("Console not available, normalizing events"), a.disable.console()), void 0 !== console.group && void 0 !== console.groupEnd && void 0 !== console.groupCollapsed || (a.verbose("Console group not available, normalizing events"), t.console.group = function () {}, t.console.groupEnd = function () {}, t.console.groupCollapsed = function () {}), void 0 === console.markTimeline && (a.verbose("Mark timeline not available, normalizing events"), t.console.markTimeline = function () {}); }), consoleClear: function consoleClear() { a.debug("Disabling programmatic console clearing"), t.console.clear = function () {}; }, requestAnimationFrame: function requestAnimationFrame() { a.debug("Normalizing requestAnimationFrame"), t.requestAnimationFrame === i && (a.debug("RequestAnimationFrame not available, normalizing event"), t.requestAnimationFrame = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) { setTimeout(e, 0); }); } }, moduleExists: function moduleExists(t) { return e.fn[t] !== i && e.fn[t].settings !== i; }, enabled: { modules: function modules(t) { var n = [];return t = t || f.modules, e.each(t, function (e, t) { a.moduleExists(t) && n.push(t); }), n; } }, disabled: { modules: function modules(t) { var n = [];return t = t || f.modules, e.each(t, function (e, t) { a.moduleExists(t) || n.push(t); }), n; } }, change: { setting: function setting(t, n, o, r) { o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) { var s, l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;a.moduleExists(o) && (a.verbose("Changing default setting", t, n, o), e.fn[o].settings[t] = n, r && l && (s = e(":data(module-" + l + ")")).length > 0 && (a.verbose("Modifying existing settings", s), s[o]("setting", t, n))); }); }, settings: function settings(t, n, o) { n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) { var r;a.moduleExists(i) && (a.verbose("Changing default setting", t, i), e.extend(!0, e.fn[i].settings, t), o && m && (r = e(":data(module-" + m + ")")).length > 0 && (a.verbose("Modifying existing settings", r), r[i]("setting", t))); }); } }, enable: { console: function console() { a.console(!0); }, debug: function debug(e, t) { e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t); }, verbose: function verbose(e, t) { e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t); } }, disable: { console: function console() { a.console(!1); }, debug: function debug(e, t) { e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t); }, verbose: function verbose(e, t) { e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t); } }, console: function console(e) { if (e) { if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console; } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = { clear: function clear() {}, error: function error() {}, group: function group() {}, groupCollapsed: function groupCollapsed() {}, groupEnd: function groupEnd() {}, info: function info() {}, log: function log() {}, markTimeline: function markTimeline() {}, warn: function warn() {} }; }, destroy: function destroy() { a.verbose("Destroying previous site for", h), h.removeData(p); }, cache: {}, setting: function setting(t, n) { if (e.isPlainObject(t)) e.extend(!0, f, t);else { if (n === i) return f[t];f[t] = n; } }, internal: function internal(t, n) { if (e.isPlainObject(t)) e.extend(!0, a, t);else { if (n === i) return a[t];a[t] = n; } }, debug: function debug() { f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments))); }, verbose: function verbose() { f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments))); }, error: function error() { a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments); }, performance: { log: function log(e) { var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Element: v, Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500); }, display: function display() { var t = f.name + ":", n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) { n += t["Execution Time"]; }), t += " " + n + "ms", (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) { console.log(t.Name + ": " + t["Execution Time"] + "ms"); }), console.groupEnd()), l = []; } }, invoke: function invoke(t, n, o) { var s, l, c, u = b;return n = n || d, o = v || o, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) { var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else { if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o]; } })), e.isFunction(l) ? c = l.apply(o, n) : l !== i && (c = l), e.isArray(r) ? r.push(c) : r !== i ? r = [r, c] : c !== i && (r = c), l; } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this; }, e.site.settings = { name: "Site", namespace: "site", error: { console: "Console cannot be restored, most likely it was overwritten outside of module", method: "The method you called is not defined." }, debug: !1, verbose: !1, performance: !0, modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"], siteNamespace: "site", namespaceStub: { cache: {}, config: {}, sections: {}, section: {}, utilities: {} } }, e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) { return function (n) { return !!e.data(n, t); }; }) : function (t, n, i) { return !!e.data(t, i[3]); } }); }(jQuery, window, document), function (e, t, n, i) { "use strict"; t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) { var o, a = e(this), r = a.selector || "", s = new Date().getTime(), l = [], c = arguments[0], u = arguments[1], d = "string" == typeof c, f = [].slice.call(arguments, 1);return a.each(function () { var m, g, p, h, v, b, y, x, C, w, S, k, T, A, R, P, E = e(this), F = this, O = [], D = !1;(P = { initialize: function initialize() { P.get.settings(), d ? (R === i && P.instantiate(), P.invoke(c)) : (R !== i && R.invoke("destroy"), P.verbose("Initializing form validation", E, v), P.bindEvents(), P.set.defaults(), P.instantiate()); }, instantiate: function instantiate() { P.verbose("Storing instance of module", P), R = P, E.data(T, P); }, destroy: function destroy() { P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T); }, refresh: function refresh() { P.verbose("Refreshing selector cache"), m = E.find(x.field), g = E.find(x.group), p = E.find(x.message), E.find(x.prompt), h = E.find(x.submit), E.find(x.clear), E.find(x.reset); }, submit: function submit() { P.verbose("Submitting form", E), E.submit(); }, attachEvents: function attachEvents(t, n) { n = n || "submit", e(t).on("click" + A, function (e) { P[n](), e.preventDefault(); }); }, bindEvents: function bindEvents() { P.verbose("Attaching form events"), E.on("submit" + A, P.validate.form).on("blur" + A, x.field, P.event.field.blur).on("click" + A, x.submit, P.submit).on("click" + A, x.reset, P.reset).on("click" + A, x.clear, P.clear), v.keyboardShortcuts && E.on("keydown" + A, x.field, P.event.field.keydown), m.each(function () { var t = e(this), n = t.prop("type"), i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change); }); }, clear: function clear() { m.each(function () { var t = e(this), n = t.parent(), i = t.closest(g), o = i.find(x.prompt), a = t.data(y.defaultValue) || "", r = n.is(x.uiCheckbox), s = n.is(x.uiDropdown);i.hasClass(C.error) && (P.verbose("Resetting error on field", i), i.removeClass(C.error), o.remove()), s ? (P.verbose("Resetting dropdown value", n, a), n.dropdown("clear")) : r ? t.prop("checked", !1) : (P.verbose("Resetting field value", t, a), t.val("")); }); }, reset: function reset() { m.each(function () { var t = e(this), n = t.parent(), o = t.closest(g), a = o.find(x.prompt), r = t.data(y.defaultValue), s = n.is(x.uiCheckbox), l = n.is(x.uiDropdown), c = o.hasClass(C.error);r !== i && (c && (P.verbose("Resetting error on field", o), o.removeClass(C.error), a.remove()), l ? (P.verbose("Resetting dropdown value", n, r), n.dropdown("restore defaults")) : s ? (P.verbose("Resetting checkbox value", n, r), t.prop("checked", r)) : (P.verbose("Resetting field value", t, r), t.val(r))); }); }, determine: { isValid: function isValid() { var t = !0;return e.each(b, function (e, n) { P.validate.field(n, e, !0) || (t = !1); }), t; } }, is: { bracketedRule: function bracketedRule(e) { return e.type && e.type.match(v.regExp.bracket); }, shorthandFields: function shorthandFields(e) { var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t); }, shorthandRules: function shorthandRules(t) { return "string" == typeof t || e.isArray(t); }, empty: function empty(e) { return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e)); }, blank: function blank(t) { return "" === e.trim(t.val()); }, valid: function valid(t) { var n = !0;return t ? (P.verbose("Checking if field is valid", t), P.validate.field(b[t], t, !1)) : (P.verbose("Checking if form is valid"), e.each(b, function (e, t) { P.is.valid(e) || (n = !1); }), n); } }, removeEvents: function removeEvents() { E.off(A), m.off(A), h.off(A), m.off(A); }, event: { field: { keydown: function keydown(t) { var n = e(this), i = t.which, o = n.is(x.input), a = n.is(x.checkbox), r = n.closest(x.uiDropdown).length > 0, s = 13;i == 27 && (P.verbose("Escape key pressed blurring field"), n.blur()), t.ctrlKey || i != s || !o || r || a || (D || (n.one("keyup" + A, P.event.field.keyup), P.submit(), P.debug("Enter pressed on input submitting form")), D = !0); }, keyup: function keyup() { D = !1; }, blur: function blur(t) { var n = e(this), i = n.closest(g), o = P.get.validation(n);i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o); }, change: function change(t) { var n = e(this), i = n.closest(g), o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () { P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o); }, v.delay)); } } }, get: { ancillaryValue: function ancillaryValue(e) { return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + ""); }, ruleName: function ruleName(e) { return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type; }, changeEvent: function changeEvent(e, t) { return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent(); }, inputEvent: function inputEvent() { return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup"; }, fieldsFromShorthand: function fieldsFromShorthand(t) { var n = {};return e.each(t, function (t, i) { "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) { n[t].rules.push({ type: i }); }); }), n; }, prompt: function prompt(t, n) { var i, o, a = P.get.ruleName(t), r = P.get.ancillaryValue(t), s = P.get.field(n.identifier), l = s.val(), c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule, u = -1 !== c.search("{value}"), d = -1 !== c.search("{name}");return u && (c = c.replace("{value}", s.val())), d && (o = 1 == (i = s.closest(x.group).find("label").eq(0)).length ? i.text() : s.prop("placeholder") || v.text.unspecifiedField, c = c.replace("{name}", o)), c = (c = c.replace("{identifier}", n.identifier)).replace("{ruleValue}", r), t.prompt || P.verbose("Using default validation prompt for type", c, a), c; }, settings: function settings() { if (e.isPlainObject(t)) { var n = Object.keys(t);n.length > 0 && t[n[0]].identifier !== i && t[n[0]].rules !== i ? (v = e.extend(!0, {}, e.fn.form.settings, u), b = e.extend({}, e.fn.form.settings.defaults, t), P.error(v.error.oldSyntax, F), P.verbose("Extending settings from legacy parameters", b, v)) : (t.fields && P.is.shorthandFields(t.fields) && (t.fields = P.get.fieldsFromShorthand(t.fields)), v = e.extend(!0, {}, e.fn.form.settings, t), b = e.extend({}, e.fn.form.settings.defaults, v.fields), P.verbose("Extending settings", b, v)); } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);k = v.namespace, y = v.metadata, x = v.selector, C = v.className, w = v.regExp, S = v.error, T = "module-" + k, A = "." + k, R = E.data(T), P.refresh(); }, field: function field(t) { return P.verbose("Finding field with identifier", t), t = P.escape.string(t), m.filter("#" + t).length > 0 ? m.filter("#" + t) : m.filter('[name="' + t + '"]').length > 0 ? m.filter('[name="' + t + '"]') : m.filter('[name="' + t + '[]"]').length > 0 ? m.filter('[name="' + t + '[]"]') : m.filter("[data-" + y.validate + '="' + t + '"]').length > 0 ? m.filter("[data-" + y.validate + '="' + t + '"]') : e(""); }, fields: function fields(t) { var n = e();return e.each(t, function (e, t) { n = n.add(P.get.field(t)); }), n; }, validation: function validation(t) { var n, i;return !!b && (e.each(b, function (e, o) { i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o); }), n || !1); }, value: function value(e) { var t = [];return t.push(e), P.get.values.call(F, t)[e]; }, values: function values(t) { var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) { var a = e(o), r = (a.prop("type"), a.prop("name")), s = a.val(), l = a.is(x.checkbox), c = a.is(x.radio), u = -1 !== r.indexOf("[]"), d = !!l && a.is(":checked");r && (u ? (r = r.replace("[]", ""), n[r] || (n[r] = []), l ? d ? n[r].push(s || !0) : n[r].push(!1) : n[r].push(s)) : c ? n[r] !== i && 0 != n[r] || (n[r] = !!d && (s || !0)) : n[r] = l ? !!d && (s || !0) : s); }), n; } }, has: { field: function field(e) { return P.verbose("Checking for existence of a field with identifier", e), "string" != typeof (e = P.escape.string(e)) && P.error(S.identifier, e), m.filter("#" + e).length > 0 || m.filter('[name="' + e + '"]').length > 0 || m.filter("[data-" + y.validate + '="' + e + '"]').length > 0; } }, escape: { string: function string(e) { return (e = String(e)).replace(w.escape, "\\$&"); } }, add: { rule: function rule(e, t) { P.add.field(e, t); }, field: function field(t, n) { var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) { i[t].rules.push({ type: n }); })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b); }, fields: function fields(t) { var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n); }, prompt: function prompt(t, n) { var o = P.get.field(t).closest(g), a = o.children(x.prompt), r = 0 !== a.length;n = "string" == typeof n ? [n] : n, P.verbose("Adding field error state", t), o.addClass(C.error), v.inline && (r || (a = v.templates.prompt(n)).appendTo(o), a.html(n[0]), r ? P.verbose("Inline errors are disabled, no inline error added", t) : v.transition && e.fn.transition !== i && E.transition("is supported") ? (P.verbose("Displaying error with css transition", v.transition), a.transition(v.transition + " in", v.duration)) : (P.verbose("Displaying error with fallback javascript animation"), a.fadeIn(v.duration))); }, errors: function errors(e) { P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e)); } }, remove: { rule: function rule(t, n) { var o = e.isArray(n) ? n : [n];if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) { -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1)); }); }, field: function field(t) { var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) { P.remove.rule(t); }); }, rules: function rules(t, n) { e.isArray(t) ? e.each(fields, function (e, t) { P.remove.rule(t, n); }) : P.remove.rule(t, n); }, fields: function fields(e) { P.remove.field(e); }, prompt: function prompt(t) { var n = P.get.field(t).closest(g), o = n.children(x.prompt);n.removeClass(C.error), v.inline && o.is(":visible") && (P.verbose("Removing prompt for field", t), v.transition && e.fn.transition !== i && E.transition("is supported") ? o.transition(v.transition + " out", v.duration, function () { o.remove(); }) : o.fadeOut(v.duration, function () { o.remove(); })); } }, set: { success: function success() { E.removeClass(C.error).addClass(C.success); }, defaults: function defaults() { m.each(function () { var t = e(this), n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n); }); }, error: function error() { E.removeClass(C.success).addClass(C.error); }, value: function value(e, t) { var n = {};return n[e] = t, P.set.values.call(F, n); }, values: function values(t) { e.isEmptyObject(t) || e.each(t, function (t, n) { var i, o = P.get.field(t), a = o.parent(), r = e.isArray(n), s = a.is(x.uiCheckbox), l = a.is(x.uiDropdown), c = o.is(x.radio) && s;o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) { i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check"); })) : c ? (P.verbose("Selecting radio value", n, o), o.filter('[value="' + n + '"]').parent(x.uiCheckbox).checkbox("check")) : s ? (P.verbose("Setting checkbox value", n, a), !0 === n ? a.checkbox("check") : a.checkbox("uncheck")) : l ? (P.verbose("Setting dropdown value", n, a), a.dropdown("set selected", n)) : (P.verbose("Setting field value", n, o), o.val(n))); }); } }, validate: { form: function form(e, t) { var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) { if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n); } else if (P.debug("Form has errors"), P.set.error(), v.inline || P.add.errors(O), E.data("moduleApi") !== i && e.stopImmediatePropagation(), !0 !== t) return v.onFailure.call(F, O, n); }, field: function field(t, n, o) { o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n, r = P.get.field(a), s = !!t.depends && P.get.field(t.depends), l = !0, c = [];return t.identifier || (P.debug("Using field name as identifier", a), t.identifier = a), r.prop("disabled") ? (P.debug("Field is disabled. Skipping", a), l = !0) : t.optional && P.is.blank(r) ? (P.debug("Field is optional and blank. Skipping", a), l = !0) : t.depends && P.is.empty(s) ? (P.debug("Field depends on another value that is not present or empty. Skipping", s), l = !0) : t.rules !== i && e.each(t.rules, function (e, n) { P.has.field(a) && !P.validate.rule(t, n) && (P.debug("Field is invalid", a, n.type), c.push(P.get.prompt(n, t)), l = !1); }), l ? (o && (P.remove.prompt(a, c), v.onValid.call(r)), !0) : (o && (O = O.concat(c), P.add.prompt(a, c), v.onInvalid.call(r, c)), !1); }, rule: function rule(t, n) { var o = P.get.field(t.identifier), a = (n.type, o.val()), r = P.get.ancillaryValue(n), s = P.get.ruleName(n), l = v.rules[s];if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);P.error(S.noRule, s); } }, setting: function setting(t, n) { if (e.isPlainObject(t)) e.extend(!0, v, t);else { if (n === i) return v[t];v[t] = n; } }, internal: function internal(t, n) { if (e.isPlainObject(t)) e.extend(!0, P, t);else { if (n === i) return P[t];P[t] = n; } }, debug: function debug() { !v.silent && v.debug && (v.performance ? P.performance.log(arguments) : (P.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), P.debug.apply(console, arguments))); }, verbose: function verbose() { !v.silent && v.verbose && v.debug && (v.performance ? P.performance.log(arguments) : (P.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), P.verbose.apply(console, arguments))); }, error: function error() { v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments)); }, performance: { log: function log(e) { var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500); }, display: function display() { var t = v.name + ":", n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) { n += t["Execution Time"]; }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) { console.log(t.Name + ": " + t["Execution Time"] + "ms"); }), console.groupEnd()), l = []; } }, invoke: function invoke(t, n, a) { var r, s, l, c = R;return n = n || f, a = F || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) { var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else { if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o]; } })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s; } }).initialize(); }), o !== i ? o : this; }, e.fn.form.settings = { name: "Form", namespace: "form", debug: !1, verbose: !1, performance: !0, fields: !1, keyboardShortcuts: !0, on: "submit", inline: !1, delay: 200, revalidate: !0, transition: "scale", duration: 200, onValid: function onValid() {}, onInvalid: function onInvalid() {}, onSuccess: function onSuccess() { return !0; }, onFailure: function onFailure() { return !1; }, metadata: { defaultValue: "default", validate: "validate" }, regExp: { htmlID: /^[a-zA-Z][\w:.-]*$/g, bracket: /\[(.*)\]/i, decimal: /^\d+\.?\d*$/, email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, flags: /^\/(.*)\/(.*)?/, integer: /^\-?\d+$/, number: /^\-?\d*(\.\d+)?$/, url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i }, text: { unspecifiedRule: "Please enter a valid value", unspecifiedField: "This field" }, prompt: { empty: "{name} must have a value", checked: "{name} must be checked", email: "{name} must be a valid e-mail", url: "{name} must be a valid url", regExp: "{name} is not formatted correctly", integer: "{name} must be an integer", decimal: "{name} must be a decimal number", number: "{name} must be set to a number", is: '{name} must be "{ruleValue}"', isExactly: '{name} must be exactly "{ruleValue}"', not: '{name} cannot be set to "{ruleValue}"', notExactly: '{name} cannot be set to exactly "{ruleValue}"', contain: '{name} must contain "{ruleValue}"', containExactly: '{name} must contain exactly "{ruleValue}"', doesntContain: '{name} cannot contain "{ruleValue}"', doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"', minLength: "{name} must be at least {ruleValue} characters", length: "{name} must be at least {ruleValue} characters", exactLength: "{name} must be exactly {ruleValue} characters", maxLength: "{name} cannot be longer than {ruleValue} characters", match: "{name} must match {ruleValue} field", different: "{name} must have a different value than {ruleValue} field", creditCard: "{name} must be a valid credit card number", minCount: "{name} must have at least {ruleValue} choices", exactCount: "{name} must have exactly {ruleValue} choices", maxCount: "{name} must have {ruleValue} or less choices" }, selector: { checkbox: 'input[type="checkbox"], input[type="radio"]', clear: ".clear", field: "input, textarea, select", group: ".field", input: "input", message: ".error.message", prompt: ".prompt.label", radio: 'input[type="radio"]', reset: '.reset:not([type="reset"])', submit: '.submit:not([type="submit"])', uiCheckbox: ".ui.checkbox", uiDropdown: ".ui.dropdown" }, className: { error: "error", label: "ui prompt label", pressed: "down", success: "success" }, error: { identifier: "You must specify a string identifier for each field", method: "The method you called is not defined.", noRule: "There is no rule matching the one you specified", oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically." }, templates: { error: function error(t) { var n = '"); }, prompt: function prompt(t) { return e("
").addClass("ui basic red pointing prompt label").html(t[0]); } }, rules: { empty: function empty(t) { return !(t === i || "" === t || e.isArray(t) && 0 === t.length); }, checked: function checked() { return e(this).filter(":checked").length > 0; }, email: function email(t) { return e.fn.form.settings.regExp.email.test(t); }, url: function url(t) { return e.fn.form.settings.regExp.url.test(t); }, regExp: function regExp(t, n) { if (n instanceof RegExp) return t.match(n);var i, o = n.match(e.fn.form.settings.regExp.flags);return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i)); }, integer: function integer(t, n) { var o, a, r, s = e.fn.form.settings.regExp.integer;return n && -1 === ["", ".."].indexOf(n) && (-1 == n.indexOf("..") ? s.test(n) && (o = a = n - 0) : (r = n.split("..", 2), s.test(r[0]) && (o = r[0] - 0), s.test(r[1]) && (a = r[1] - 0))), s.test(t) && (o === i || t >= o) && (a === i || t <= a); }, decimal: function decimal(t) { return e.fn.form.settings.regExp.decimal.test(t); }, number: function number(t) { return e.fn.form.settings.regExp.number.test(t); }, is: function is(e, t) { return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t; }, isExactly: function isExactly(e, t) { return e == t; }, not: function not(e, t) { return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t); }, notExactly: function notExactly(e, t) { return e != t; }, contains: function contains(t, n) { return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i")); }, containsExactly: function containsExactly(t, n) { return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n)); }, doesntContain: function doesntContain(t, n) { return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i")); }, doesntContainExactly: function doesntContainExactly(t, n) { return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n)); }, minLength: function minLength(e, t) { return e !== i && e.length >= t; }, length: function length(e, t) { return e !== i && e.length >= t; }, exactLength: function exactLength(e, t) { return e !== i && e.length == t; }, maxLength: function maxLength(e, t) { return e !== i && e.length <= t; }, match: function match(t, n) { var o;e(this);return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() == o.toString(); }, different: function different(t, n) { var o;e(this);return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() !== o.toString(); }, creditCard: function creditCard(t, n) { var i, o, a = { visa: { pattern: /^4/, length: [16] }, amex: { pattern: /^3[47]/, length: [15] }, mastercard: { pattern: /^5[1-5]/, length: [16] }, discover: { pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/, length: [16] }, unionPay: { pattern: /^(62|88)/, length: [16, 17, 18, 19] }, jcb: { pattern: /^35(2[89]|[3-8][0-9])/, length: [16] }, maestro: { pattern: /^(5018|5020|5038|6304|6759|676[1-3])/, length: [12, 13, 14, 15, 16, 17, 18, 19] }, dinersClub: { pattern: /^(30[0-5]|^36)/, length: [14] }, laser: { pattern: /^(6304|670[69]|6771)/, length: [16, 17, 18, 19] }, visaElectron: { pattern: /^(4026|417500|4508|4844|491(3|7))/, length: [16] } }, r = {}, s = !1, l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) { if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) { (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0); }), !s)) return !1;if ((i = { number: -1 !== e.inArray(t.length, a.unionPay.length), pattern: -1 !== t.search(a.unionPay.pattern) }).number && i.pattern) return !0;for (var c = t.length, u = 0, d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]], f = 0; c--;) { f += d[u][parseInt(t.charAt(c), 10)], u ^= 1; }return f % 10 == 0 && f > 0; } }, minCount: function minCount(e, t) { return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t); }, exactCount: function exactCount(e, t) { return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t; }, maxCount: function maxCount(e, t) { return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t); } } }; }(jQuery, window, document), function (e, t, n, i) { "use strict"; t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) { var o, a = e(this), r = new Date().getTime(), s = [], l = arguments[0], c = "string" == typeof l, u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () { var d, f, m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings), g = m.className, p = m.namespace, h = m.selector, v = m.error, b = "." + p, y = "module-" + p, x = a.selector || "", C = e(this), w = C.find(h.title), S = C.find(h.content), k = this, T = C.data(y);f = { initialize: function initialize() { f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate(); }, instantiate: function instantiate() { T = f, C.data(y, f); }, destroy: function destroy() { f.debug("Destroying previous instance", C), C.off(b).removeData(y); }, refresh: function refresh() { w = C.find(h.title), S = C.find(h.content); }, observeChanges: function observeChanges() { "MutationObserver" in t && ((d = new MutationObserver(function (e) { f.debug("DOM tree modified, updating selector cache"), f.refresh(); })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d)); }, bind: { events: function events() { f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click); } }, event: { click: function click() { f.toggle.call(this); } }, toggle: function toggle(t) { var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title), o = n.next(S), a = o.hasClass(g.animating), r = o.hasClass(g.active), s = r && !a, l = !r && a;f.debug("Toggling visibility of content", n), s || l ? m.collapsible ? f.close.call(n) : f.debug("Cannot close accordion content collapsing is disabled") : f.open.call(n); }, open: function open(t) { var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title), o = n.next(S), a = o.hasClass(g.animating);o.hasClass(g.active) || a ? f.debug("Accordion already open, skipping", o) : (f.debug("Opening accordion content", n), m.onOpening.call(o), m.onChanging.call(o), m.exclusive && f.closeOthers.call(n), n.addClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({ animation: "fade in", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 1 }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () { o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this); })); }, close: function close(t) { var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title), o = n.next(S), a = o.hasClass(g.animating), r = o.hasClass(g.active);!r && !(!r && a) || r && a || (f.debug("Closing accordion content", o), m.onClosing.call(o), m.onChanging.call(o), n.removeClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({ animation: "fade out", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () { o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this); })); }, closeOthers: function closeOthers(t) { var n, o, a, r = t !== i ? w.eq(t) : e(this).closest(h.title), s = r.parents(h.content).prev(h.title), l = r.closest(h.accordion), c = h.title + "." + g.active + ":visible", u = h.content + "." + g.active + ":visible";m.closeNested ? a = (n = l.find(c).not(s)).next(S) : (n = l.find(c).not(s), o = l.find(u).find(c).not(s), a = (n = n.not(o)).next(S)), n.length > 0 && (f.debug("Exclusive enabled, closing other content", n), n.removeClass(g.active), a.removeClass(g.animating).stop(!0, !0), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? a.children().transition({ animation: "fade out", useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : a.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () { e(this).removeClass(g.active), f.reset.display.call(this); })); }, reset: { display: function display() { f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style"); }, opacity: function opacity() { f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style"); } }, setting: function setting(t, n) { if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else { if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n; } }, internal: function internal(t, n) { if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n; }, debug: function debug() { !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments))); }, verbose: function verbose() { !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments))); }, error: function error() { m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments)); }, performance: { log: function log(e) { var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500); }, display: function display() { var t = m.name + ":", n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) { n += t["Execution Time"]; }), t += " " + n + "ms", x && (t += " '" + x + "'"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) { console.log(t.Name + ": " + t["Execution Time"] + "ms"); }), console.groupEnd()), s = []; } }, invoke: function invoke(t, n, a) { var r, s, l, c = T;return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) { var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else { if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o]; } })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s; } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize()); }), o !== i ? o : this; }, e.fn.accordion.settings = { name: "Accordion", namespace: "accordion", silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", observeChanges: !0, exclusive: !0, collapsible: !0, closeNested: !1, animateChildren: !0, duration: 350, easing: "easeOutQuad", onOpening: function onOpening() {}, onClosing: function onClosing() {}, onChanging: function onChanging() {}, onOpen: function onOpen() {}, onClose: function onClose() {}, onChange: function onChange() {}, error: { method: "The method you called is not defined" }, className: { active: "active", animating: "animating" }, selector: { accordion: ".accordion", title: ".title", trigger: ".title", content: ".content" } }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) { return -i * (t /= o) * (t - 2) + n; } }); }(jQuery, window, document), function (e, t, n, i) { "use strict"; t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) { var a, r = e(this), s = r.selector || "", l = new Date().getTime(), c = [], u = arguments[0], d = "string" == typeof u, f = [].slice.call(arguments, 1);return r.each(function () { var r, m, g = e.extend(!0, {}, e.fn.checkbox.settings, o), p = g.className, h = g.namespace, v = g.selector, b = g.error, y = "." + h, x = "module-" + h, C = e(this), w = e(this).children(v.label), S = e(this).children(v.input), k = S[0], T = !1, A = !1, R = C.data(x), P = this;m = { initialize: function initialize() { m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup(); }, instantiate: function instantiate() { m.verbose("Storing instance of module", m), R = m, C.data(x, m); }, destroy: function destroy() { m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x); }, fix: { reference: function reference() { C.is(v.input) && (m.debug("Behavior called on adjusting invoked element"), C = C.closest(v.checkbox), m.refresh()); } }, setup: function setup() { m.set.initialLoad(), m.is.indeterminate() ? (m.debug("Initial value is indeterminate"), m.indeterminate()) : m.is.checked() ? (m.debug("Initial value is checked"), m.check()) : (m.debug("Initial value is unchecked"), m.uncheck()), m.remove.initialLoad(); }, refresh: function refresh() { w = C.children(v.label), S = C.children(v.input), k = S[0]; }, hide: { input: function input() { m.verbose("Modifying z-index to be unselectable"), S.addClass(p.hidden); } }, show: { input: function input() { m.verbose("Modifying z-index to be selectable"), S.removeClass(p.hidden); } }, observeChanges: function observeChanges() { "MutationObserver" in t && ((r = new MutationObserver(function (e) { m.debug("DOM tree modified, updating selector cache"), m.refresh(); })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r)); }, attachEvents: function attachEvents(t, n) { var i = e(t);n = e.isFunction(m[n]) ? m[n] : m.toggle, i.length > 0 ? (m.debug("Attaching checkbox events to element", t, n), i.on("click" + y, n)) : m.error(b.notFound); }, event: { click: function click(t) { var n = e(t.target);n.is(v.input) ? m.verbose("Using default check action on initialized checkbox") : n.is(v.link) ? m.debug("Clicking link inside checkbox, skipping toggle") : (m.toggle(), S.focus(), t.preventDefault()); }, keydown: function keydown(e) { var t = e.which, n = 13, i = 32;t == 27 ? (m.verbose("Escape key pressed blurring field"), S.blur(), A = !0) : e.ctrlKey || t != i && t != n ? A = !1 : (m.verbose("Enter/space key pressed, toggling checkbox"), m.toggle(), A = !0); }, keyup: function keyup(e) { A && e.preventDefault(); } }, check: function check() { m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k))); }, uncheck: function uncheck() { m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k))); }, indeterminate: function indeterminate() { m.should.allowIndeterminate() ? m.debug("Checkbox is already indeterminate") : (m.debug("Making checkbox indeterminate"), m.set.indeterminate(), m.should.ignoreCallbacks() || (g.onIndeterminate.call(k), g.onChange.call(k))); }, determinate: function determinate() { m.should.allowDeterminate() ? m.debug("Checkbox is already determinate") : (m.debug("Making checkbox determinate"), m.set.determinate(), m.should.ignoreCallbacks() || (g.onDeterminate.call(k), g.onChange.call(k))); }, enable: function enable() { m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k)); }, disable: function disable() { m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k)); }, get: { radios: function radios() { var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox); }, otherRadios: function otherRadios() { return m.get.radios().not(C); }, name: function name() { return S.attr("name"); } }, is: { initialLoad: function initialLoad() { return T; }, radio: function radio() { return S.hasClass(p.radio) || "radio" == S.attr("type"); }, indeterminate: function indeterminate() { return S.prop("indeterminate") !== i && S.prop("indeterminate"); }, checked: function checked() { return S.prop("checked") !== i && S.prop("checked"); }, disabled: function disabled() { return S.prop("disabled") !== i && S.prop("disabled"); }, enabled: function enabled() { return !m.is.disabled(); }, determinate: function determinate() { return !m.is.indeterminate(); }, unchecked: function unchecked() { return !m.is.checked(); } }, should: { allowCheck: function allowCheck() { return m.is.determinate() && m.is.checked() && !m.should.forceCallbacks() ? (m.debug("Should not allow check, checkbox is already checked"), !1) : !1 !== g.beforeChecked.apply(k) || (m.debug("Should not allow check, beforeChecked cancelled"), !1); }, allowUncheck: function allowUncheck() { return m.is.determinate() && m.is.unchecked() && !m.should.forceCallbacks() ? (m.debug("Should not allow uncheck, checkbox is already unchecked"), !1) : !1 !== g.beforeUnchecked.apply(k) || (m.debug("Should not allow uncheck, beforeUnchecked cancelled"), !1); }, allowIndeterminate: function allowIndeterminate() { return m.is.indeterminate() && !m.should.forceCallbacks() ? (m.debug("Should not allow indeterminate, checkbox is already indeterminate"), !1) : !1 !== g.beforeIndeterminate.apply(k) || (m.debug("Should not allow indeterminate, beforeIndeterminate cancelled"), !1); }, allowDeterminate: function allowDeterminate() { return m.is.determinate() && !m.should.forceCallbacks() ? (m.debug("Should not allow determinate, checkbox is already determinate"), !1) : !1 !== g.beforeDeterminate.apply(k) || (m.debug("Should not allow determinate, beforeDeterminate cancelled"), !1); }, forceCallbacks: function forceCallbacks() { return m.is.initialLoad() && g.fireOnInit; }, ignoreCallbacks: function ignoreCallbacks() { return T && !g.fireOnInit; } }, can: { change: function change() { return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly")); }, uncheck: function uncheck() { return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio(); } }, set: { initialLoad: function initialLoad() { T = !0; }, checked: function checked() { m.verbose("Setting class to checked"), C.removeClass(p.indeterminate).addClass(p.checked), m.is.radio() && m.uncheckOthers(), m.is.indeterminate() || !m.is.checked() ? (m.verbose("Setting state to checked", k), S.prop("indeterminate", !1).prop("checked", !0), m.trigger.change()) : m.debug("Input is already checked, skipping input property change"); }, unchecked: function unchecked() { m.verbose("Removing checked class"), C.removeClass(p.indeterminate).removeClass(p.checked), m.is.indeterminate() || !m.is.unchecked() ? (m.debug("Setting state to unchecked"), S.prop("indeterminate", !1).prop("checked", !1), m.trigger.change()) : m.debug("Input is already unchecked"); }, indeterminate: function indeterminate() { m.verbose("Setting class to indeterminate"), C.addClass(p.indeterminate), m.is.indeterminate() ? m.debug("Input is already indeterminate, skipping input property change") : (m.debug("Setting state to indeterminate"), S.prop("indeterminate", !0), m.trigger.change()); }, determinate: function determinate() { m.verbose("Removing indeterminate class"), C.removeClass(p.indeterminate), m.is.determinate() ? m.debug("Input is already determinate, skipping input property change") : (m.debug("Setting state to determinate"), S.prop("indeterminate", !1)); }, disabled: function disabled() { m.verbose("Setting class to disabled"), C.addClass(p.disabled), m.is.disabled() ? m.debug("Input is already disabled, skipping input property change") : (m.debug("Setting state to disabled"), S.prop("disabled", "disabled"), m.trigger.change()); }, enabled: function enabled() { m.verbose("Removing disabled class"), C.removeClass(p.disabled), m.is.enabled() ? m.debug("Input is already enabled, skipping input property change") : (m.debug("Setting state to enabled"), S.prop("disabled", !1), m.trigger.change()); }, tabbable: function tabbable() { m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0); } }, remove: { initialLoad: function initialLoad() { T = !1; } }, trigger: { change: function change() { var e = n.createEvent("HTMLEvents"), t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e)); } }, create: { label: function label() { S.prevAll(v.label).length > 0 ? (S.prev(v.label).detach().insertAfter(S), m.debug("Moving existing label", w)) : m.has.label() || (w = e("