MCPcopy Index your code
hub / github.com/stemkoski/stemkoski.github.com / parse_expr

Function parse_expr

MathBox/mathbox-bundle.js:80019–80053  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80017
80018
80019 function parse_expr() {
80020 var expecting = state[0].expecting
80021
80022 state[0].tokens = state[0].tokens || []
80023
80024 if(state[0].parenlevel === undefined) {
80025 state[0].parenlevel = 0
80026 state[0].bracelevel = 0
80027 }
80028 if(state[0].parenlevel < 1 && expecting.indexOf(token.data) > -1) {
80029 return parseexpr(state[0].tokens)
80030 }
80031 if(token.data === '(') {
80032 ++state[0].parenlevel
80033 } else if(token.data === ')') {
80034 --state[0].parenlevel
80035 }
80036
80037 switch(token.data) {
80038 case '{': ++state[0].bracelevel; break
80039 case '}': --state[0].bracelevel; break
80040 case '(': ++state[0].parenlevel; break
80041 case ')': --state[0].parenlevel; break
80042 }
80043
80044 if(state[0].parenlevel < 0) return unexpected('unexpected `)`')
80045 if(state[0].bracelevel < 0) return unexpected('unexpected `}`')
80046
80047 state[0].tokens.push(tokens.shift())
80048 return
80049
80050 function parseexpr(tokens) {
80051 return full_parse_expr(state, tokens), state.shift()
80052 }
80053 }
80054
80055 // node types ---------------
80056

Callers 1

writeFunction · 0.70

Calls 2

parseexprFunction · 0.70
unexpectedFunction · 0.70

Tested by

no test coverage detected