Skip to content

Commit db9e327

Browse files
committed
fix: replace Grunt with Webpack
1 parent afffcb4 commit db9e327

6 files changed

+1696
-195
lines changed

Gruntfile.js

-60
This file was deleted.

dist/browser/math-expression-evaluator.js

+108-32
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
/** math-expression-evaluator version 1.3.8
2-
Dated:2021-07-03 */
1+
/******/ (() => { // webpackBootstrap
2+
/******/ var __webpack_modules__ = ({
33

4-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mexp = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
5-
var Mexp=require('./postfix_evaluator.js');
4+
/***/ 28:
5+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6+
7+
var Mexp=__webpack_require__(733);
68
Mexp.prototype.formulaEval = function () {
79
"use strict";
810
var stack=[],pop1,pop2,pop3;
@@ -43,9 +45,15 @@ Mexp.prototype.formulaEval = function () {
4345
return disp[0].value;
4446
};
4547
module.exports=Mexp;
46-
},{"./postfix_evaluator.js":5}],2:[function(require,module,exports){
47-
'use strict'
48-
var Mexp = require('./math_function.js')
48+
49+
/***/ }),
50+
51+
/***/ 618:
52+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
53+
54+
"use strict";
55+
56+
var Mexp = __webpack_require__(178)
4957
function inc (arr, val) {
5058
for (var i = 0; i < arr.length; i++) {
5159
arr[i] += val
@@ -98,7 +106,8 @@ var token = [
98106
'Sigma',
99107
'n',
100108
'Pi',
101-
'pow'
109+
'pow',
110+
'&'
102111
]
103112
var show = [
104113
'sin',
@@ -146,7 +155,8 @@ var show = [
146155
'&Sigma;',
147156
'n',
148157
'&Pi;',
149-
'pow'
158+
'pow',
159+
'&'
150160
]
151161
var eva = [
152162
Mexp.math.sin,
@@ -194,7 +204,8 @@ var eva = [
194204
Mexp.math.sigma,
195205
'n',
196206
Mexp.math.Pi,
197-
Math.pow
207+
Math.pow,
208+
Mexp.math.and
198209
]
199210
var preced = {
200211
0: 11,
@@ -215,7 +226,7 @@ var preced = {
215226
} // stores precedence by types
216227
var type = [
217228
0, 0, 0, 3, 4, 5, 10, 10, 14, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 10, 0, 1, 1, 1, 2, 7, 0, 0, 2, 1, 1,
218-
1, 2, 0, 0, 3, 0, 1, 6, 9, 9, 11, 12, 13, 12, 8
229+
1, 2, 0, 0, 3, 0, 1, 6, 9, 9, 11, 12, 13, 12, 8, 9
219230
]
220231
/*
221232
0 : function with syntax function_name(Maths_exp)
@@ -310,7 +321,8 @@ var newAr = [
310321
'.',
311322
',',
312323
'n',
313-
' '
324+
' ',
325+
'&'
314326
],
315327
['pi', 'ln', 'Pi'],
316328
['sin', 'cos', 'tan', 'Del', 'int', 'Mod', 'log', 'pow'],
@@ -461,7 +473,7 @@ Mexp.lex = function (inp, tokens) {
461473
str.push(closingParObj)
462474
allowed = type1
463475
asterick = type3Asterick
464-
inc(ptc, -1).pop()
476+
ptc.pop()
465477
}
466478
} else break
467479
}
@@ -484,9 +496,13 @@ Mexp.lex = function (inp, tokens) {
484496
if (cType === 0) {
485497
allowed = type0
486498
asterick = empty
487-
inc(ptc, 2).push(2)
499+
inc(ptc, 2)
488500
str.push(obj)
489-
str.push(openingParObj)
501+
if (nodes[i + 1].type !== 4) {
502+
str.push(openingParObj)
503+
ptc.push(2)
504+
}
505+
// bracToClose++
490506
} else if (cType === 1) {
491507
if (pre.type === 1) {
492508
pre.value += cEv
@@ -532,7 +548,7 @@ Mexp.lex = function (inp, tokens) {
532548
pre: 0
533549
} // pre needs to be changed as it will the last value now to be safe in later code
534550
str.push(pre)
535-
inc(ptc, -1)
551+
// inc(ptc, 1)
536552
}
537553
allowed = type6
538554
inc(ptc, 1)
@@ -548,9 +564,13 @@ Mexp.lex = function (inp, tokens) {
548564
if (cType === 8) {
549565
allowed = type0
550566
asterick = empty
551-
inc(ptc, 4).push(4)
567+
inc(ptc, 4)
552568
str.push(obj)
553-
str.push(openingParObj)
569+
// str.push(openingParObj)
570+
if (nodes[i + 1].type !== 4) {
571+
str.push(openingParObj)
572+
ptc.push(4)
573+
}
554574
} else if (cType === 9) {
555575
if (pre.type === 9) {
556576
if (pre.value === Mexp.math.add) {
@@ -597,23 +617,24 @@ Mexp.lex = function (inp, tokens) {
597617
} else if (cType === 12) {
598618
allowed = type0
599619
asterick = empty
600-
inc(ptc, 6).push(6)
620+
inc(ptc, 6)
601621
str.push(obj)
602-
str.push(openingParObj)
622+
if (nodes[i + 1].type !== 4) {
623+
str.push(openingParObj)
624+
ptc.push(6)
625+
}
603626
} else if (cType === 13) {
604627
allowed = type1
605628
asterick = type3Asterick
606629
str.push(obj)
607630
}
608631
inc(ptc, -1)
609632
prevKey = cToken
633+
610634
}
611635
for (j = ptc.length; j--;) {
612636
// loop over ptc
613-
if (ptc[j] === 0) {
614-
str.push(closingParObj)
615-
inc(ptc, -1).pop()
616-
} else break // if it is not zero so before ptc also cant be zero
637+
str.push(closingParObj)
617638
}
618639
if (allowed[5] !== true) {
619640
throw new Mexp.Exception('complete the expression')
@@ -628,8 +649,14 @@ Mexp.lex = function (inp, tokens) {
628649
}
629650
module.exports = Mexp
630651

631-
},{"./math_function.js":3}],3:[function(require,module,exports){
632-
"use strict";
652+
653+
/***/ }),
654+
655+
/***/ 178:
656+
/***/ ((module) => {
657+
658+
"use strict";
659+
633660
var Mexp = function (parsed) {
634661
this.value = parsed
635662
}
@@ -754,16 +781,24 @@ Mexp.math = {
754781
},
755782
toRadian: function (x) {
756783
return x * Math.PI / 180
784+
},
785+
and: function (a, b) {
786+
return a & b
757787
}
758788
}
759789
Mexp.Exception = function (message) {
760790
this.message = message
761791
}
762792
module.exports = Mexp
763793

764-
},{}],4:[function(require,module,exports){
794+
795+
/***/ }),
796+
797+
/***/ 477:
798+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
799+
765800

766-
var Mexp = require('./lexer.js');
801+
var Mexp = __webpack_require__(618);
767802

768803
Mexp.prototype.toPostfix = function () {
769804
'use strict';
@@ -812,8 +847,13 @@ Mexp.prototype.toPostfix = function () {
812847
return new Mexp(post);
813848
};
814849
module.exports = Mexp;
815-
},{"./lexer.js":2}],5:[function(require,module,exports){
816-
var Mexp=require('./postfix.js');
850+
851+
/***/ }),
852+
853+
/***/ 733:
854+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
855+
856+
var Mexp=__webpack_require__(477);
817857
Mexp.prototype.postfixEval = function (UserDefined) {
818858
'use strict';
819859
UserDefined=UserDefined||{};
@@ -917,5 +957,41 @@ Mexp.eval=function(str,tokens,obj){
917957
return this.lex(str,tokens).toPostfix().postfixEval(obj);
918958
};
919959
module.exports=Mexp;
920-
},{"./postfix.js":4}]},{},[1])(1)
921-
});
960+
961+
/***/ })
962+
963+
/******/ });
964+
/************************************************************************/
965+
/******/ // The module cache
966+
/******/ var __webpack_module_cache__ = {};
967+
/******/
968+
/******/ // The require function
969+
/******/ function __webpack_require__(moduleId) {
970+
/******/ // Check if module is in cache
971+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
972+
/******/ if (cachedModule !== undefined) {
973+
/******/ return cachedModule.exports;
974+
/******/ }
975+
/******/ // Create a new module (and put it into the cache)
976+
/******/ var module = __webpack_module_cache__[moduleId] = {
977+
/******/ // no module.id needed
978+
/******/ // no module.loaded needed
979+
/******/ exports: {}
980+
/******/ };
981+
/******/
982+
/******/ // Execute the module function
983+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
984+
/******/
985+
/******/ // Return the exports of the module
986+
/******/ return module.exports;
987+
/******/ }
988+
/******/
989+
/************************************************************************/
990+
/******/
991+
/******/ // startup
992+
/******/ // Load entry module and return exports
993+
/******/ // This entry module is referenced by other modules so it can't be inlined
994+
/******/ var __webpack_exports__ = __webpack_require__(28);
995+
/******/
996+
/******/ })()
997+
;

0 commit comments

Comments
 (0)