UNPKG

3.05 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5function last() {
6 var _ref;
7 return _ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref];
8}
9function negation(a) {
10 return -a;
11}
12function addition(a, b) {
13 return a + b;
14}
15function subtraction(a, b) {
16 return a - b;
17}
18function multiplication(a, b) {
19 return a * b;
20}
21function division(a, b) {
22 return a / b;
23}
24function max() {
25 return Math.max.apply(Math, arguments);
26}
27function min() {
28 return Math.min.apply(Math, arguments);
29}
30function comma() {
31 return Array.of.apply(Array, arguments);
32}
33var defaultSymbols = {
34 symbols: {
35 '*': {
36 infix: {
37 symbol: '*',
38 f: multiplication,
39 notation: 'infix',
40 precedence: 4,
41 rightToLeft: 0,
42 argCount: 2
43 },
44 symbol: '*',
45 regSymbol: '\\*'
46 },
47 '/': {
48 infix: {
49 symbol: '/',
50 f: division,
51 notation: 'infix',
52 precedence: 4,
53 rightToLeft: 0,
54 argCount: 2
55 },
56 symbol: '/',
57 regSymbol: '/'
58 },
59 '+': {
60 infix: {
61 symbol: '+',
62 f: addition,
63 notation: 'infix',
64 precedence: 2,
65 rightToLeft: 0,
66 argCount: 2
67 },
68 prefix: {
69 symbol: '+',
70 f: last,
71 notation: 'prefix',
72 precedence: 3,
73 rightToLeft: 0,
74 argCount: 1
75 },
76 symbol: '+',
77 regSymbol: '\\+'
78 },
79 '-': {
80 infix: {
81 symbol: '-',
82 f: subtraction,
83 notation: 'infix',
84 precedence: 2,
85 rightToLeft: 0,
86 argCount: 2
87 },
88 prefix: {
89 symbol: '-',
90 f: negation,
91 notation: 'prefix',
92 precedence: 3,
93 rightToLeft: 0,
94 argCount: 1
95 },
96 symbol: '-',
97 regSymbol: '-'
98 },
99 ',': {
100 infix: {
101 symbol: ',',
102 f: comma,
103 notation: 'infix',
104 precedence: 1,
105 rightToLeft: 0,
106 argCount: 2
107 },
108 symbol: ',',
109 regSymbol: ','
110 },
111 '(': {
112 prefix: {
113 symbol: '(',
114 f: last,
115 notation: 'prefix',
116 precedence: 0,
117 rightToLeft: 0,
118 argCount: 1
119 },
120 symbol: '(',
121 regSymbol: '\\('
122 },
123 ')': {
124 postfix: {
125 symbol: ')',
126 f: undefined,
127 notation: 'postfix',
128 precedence: 0,
129 rightToLeft: 0,
130 argCount: 1
131 },
132 symbol: ')',
133 regSymbol: '\\)'
134 },
135 min: {
136 func: {
137 symbol: 'min',
138 f: min,
139 notation: 'func',
140 precedence: 0,
141 rightToLeft: 0,
142 argCount: 1
143 },
144 symbol: 'min',
145 regSymbol: 'min\\b'
146 },
147 max: {
148 func: {
149 symbol: 'max',
150 f: max,
151 notation: 'func',
152 precedence: 0,
153 rightToLeft: 0,
154 argCount: 1
155 },
156 symbol: 'max',
157 regSymbol: 'max\\b'
158 }
159 }
160};
161var _default = exports["default"] = defaultSymbols;
162module.exports = exports.default;
\No newline at end of file