MCPcopy Index your code
hub / github.com/josdejong/mathjs / parseMultiplyDivideModulus

Function parseMultiplyDivideModulus

src/expression/parse.js:1065–1094  ·  view source on GitHub ↗

* multiply, divide, modulus * @return {Node} node * @private

(state)

Source from the content-addressed store, hash-verified

1063 * @private
1064 */
1065 function parseMultiplyDivideModulus (state) {
1066 let node, last, name, fn
1067
1068 node = parseImplicitMultiplication(state)
1069 last = node
1070
1071 const operators = {
1072 '*': 'multiply',
1073 '.*': 'dotMultiply',
1074 '/': 'divide',
1075 './': 'dotDivide',
1076 '%': 'mod',
1077 mod: 'mod'
1078 }
1079
1080 while (true) {
1081 if (hasOwnProperty(operators, state.token)) {
1082 // explicit operators
1083 name = state.token
1084 fn = operators[name]
1085 getTokenSkipNewline(state)
1086 last = parseImplicitMultiplication(state)
1087 node = new OperatorNode(name, fn, [node, last])
1088 } else {
1089 break
1090 }
1091 }
1092
1093 return node
1094 }
1095
1096 /**
1097 * implicit multiplication

Callers 1

parseAddSubtractFunction · 0.85

Calls 3

hasOwnPropertyFunction · 0.90
getTokenSkipNewlineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…