1
- /** math-expression-evaluator version 1.3.8
2
- Dated:2021-07-03 */
1
+ /******/ ( ( ) => { // webpackBootstrap
2
+ /******/ var __webpack_modules__ = ( {
3
3
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 ) ;
6
8
Mexp . prototype . formulaEval = function ( ) {
7
9
"use strict" ;
8
10
var stack = [ ] , pop1 , pop2 , pop3 ;
@@ -43,9 +45,15 @@ Mexp.prototype.formulaEval = function () {
43
45
return disp [ 0 ] . value ;
44
46
} ;
45
47
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 )
49
57
function inc ( arr , val ) {
50
58
for ( var i = 0 ; i < arr . length ; i ++ ) {
51
59
arr [ i ] += val
@@ -98,7 +106,8 @@ var token = [
98
106
'Sigma' ,
99
107
'n' ,
100
108
'Pi' ,
101
- 'pow'
109
+ 'pow' ,
110
+ '&'
102
111
]
103
112
var show = [
104
113
'sin' ,
@@ -146,7 +155,8 @@ var show = [
146
155
'Σ' ,
147
156
'n' ,
148
157
'Π' ,
149
- 'pow'
158
+ 'pow' ,
159
+ '&'
150
160
]
151
161
var eva = [
152
162
Mexp . math . sin ,
@@ -194,7 +204,8 @@ var eva = [
194
204
Mexp . math . sigma ,
195
205
'n' ,
196
206
Mexp . math . Pi ,
197
- Math . pow
207
+ Math . pow ,
208
+ Mexp . math . and
198
209
]
199
210
var preced = {
200
211
0 : 11 ,
@@ -215,7 +226,7 @@ var preced = {
215
226
} // stores precedence by types
216
227
var type = [
217
228
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
219
230
]
220
231
/*
221
232
0 : function with syntax function_name(Maths_exp)
@@ -310,7 +321,8 @@ var newAr = [
310
321
'.' ,
311
322
',' ,
312
323
'n' ,
313
- ' '
324
+ ' ' ,
325
+ '&'
314
326
] ,
315
327
[ 'pi' , 'ln' , 'Pi' ] ,
316
328
[ 'sin' , 'cos' , 'tan' , 'Del' , 'int' , 'Mod' , 'log' , 'pow' ] ,
@@ -461,7 +473,7 @@ Mexp.lex = function (inp, tokens) {
461
473
str . push ( closingParObj )
462
474
allowed = type1
463
475
asterick = type3Asterick
464
- inc ( ptc , - 1 ) . pop ( )
476
+ ptc . pop ( )
465
477
}
466
478
} else break
467
479
}
@@ -484,9 +496,13 @@ Mexp.lex = function (inp, tokens) {
484
496
if ( cType === 0 ) {
485
497
allowed = type0
486
498
asterick = empty
487
- inc ( ptc , 2 ) . push ( 2 )
499
+ inc ( ptc , 2 )
488
500
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++
490
506
} else if ( cType === 1 ) {
491
507
if ( pre . type === 1 ) {
492
508
pre . value += cEv
@@ -532,7 +548,7 @@ Mexp.lex = function (inp, tokens) {
532
548
pre : 0
533
549
} // pre needs to be changed as it will the last value now to be safe in later code
534
550
str . push ( pre )
535
- inc ( ptc , - 1 )
551
+ // inc(ptc, 1)
536
552
}
537
553
allowed = type6
538
554
inc ( ptc , 1 )
@@ -548,9 +564,13 @@ Mexp.lex = function (inp, tokens) {
548
564
if ( cType === 8 ) {
549
565
allowed = type0
550
566
asterick = empty
551
- inc ( ptc , 4 ) . push ( 4 )
567
+ inc ( ptc , 4 )
552
568
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
+ }
554
574
} else if ( cType === 9 ) {
555
575
if ( pre . type === 9 ) {
556
576
if ( pre . value === Mexp . math . add ) {
@@ -597,23 +617,24 @@ Mexp.lex = function (inp, tokens) {
597
617
} else if ( cType === 12 ) {
598
618
allowed = type0
599
619
asterick = empty
600
- inc ( ptc , 6 ) . push ( 6 )
620
+ inc ( ptc , 6 )
601
621
str . push ( obj )
602
- str . push ( openingParObj )
622
+ if ( nodes [ i + 1 ] . type !== 4 ) {
623
+ str . push ( openingParObj )
624
+ ptc . push ( 6 )
625
+ }
603
626
} else if ( cType === 13 ) {
604
627
allowed = type1
605
628
asterick = type3Asterick
606
629
str . push ( obj )
607
630
}
608
631
inc ( ptc , - 1 )
609
632
prevKey = cToken
633
+
610
634
}
611
635
for ( j = ptc . length ; j -- ; ) {
612
636
// 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 )
617
638
}
618
639
if ( allowed [ 5 ] !== true ) {
619
640
throw new Mexp . Exception ( 'complete the expression' )
@@ -628,8 +649,14 @@ Mexp.lex = function (inp, tokens) {
628
649
}
629
650
module . exports = Mexp
630
651
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
+
633
660
var Mexp = function ( parsed ) {
634
661
this . value = parsed
635
662
}
@@ -754,16 +781,24 @@ Mexp.math = {
754
781
} ,
755
782
toRadian : function ( x ) {
756
783
return x * Math . PI / 180
784
+ } ,
785
+ and : function ( a , b ) {
786
+ return a & b
757
787
}
758
788
}
759
789
Mexp . Exception = function ( message ) {
760
790
this . message = message
761
791
}
762
792
module . exports = Mexp
763
793
764
- } , { } ] , 4 :[ function ( require , module , exports ) {
794
+
795
+ /***/ } ) ,
796
+
797
+ /***/ 477 :
798
+ /***/ ( ( module , __unused_webpack_exports , __webpack_require__ ) => {
799
+
765
800
766
- var Mexp = require ( './lexer.js' ) ;
801
+ var Mexp = __webpack_require__ ( 618 ) ;
767
802
768
803
Mexp . prototype . toPostfix = function ( ) {
769
804
'use strict' ;
@@ -812,8 +847,13 @@ Mexp.prototype.toPostfix = function () {
812
847
return new Mexp ( post ) ;
813
848
} ;
814
849
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 ) ;
817
857
Mexp . prototype . postfixEval = function ( UserDefined ) {
818
858
'use strict' ;
819
859
UserDefined = UserDefined || { } ;
@@ -917,5 +957,41 @@ Mexp.eval=function(str,tokens,obj){
917
957
return this . lex ( str , tokens ) . toPostfix ( ) . postfixEval ( obj ) ;
918
958
} ;
919
959
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