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

Function setup_stative_parsers

MathBox/mathbox-core.js:33520–33707  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33518
33519
33520 function setup_stative_parsers() {
33521
33522 // could also be
33523 // struct { } decllist
33524 parse_struct =
33525 stative(
33526 advance('struct', 'keyword')
33527 , function() {
33528 if(token.data === '{') {
33529 state.fake(mknode(IDENT, {data:'', position: token.position, type:'ident'}))
33530 return Advance
33531 }
33532
33533 return advance_ident(true)()
33534 }
33535 , function() { state.scope.enter(); return Advance }
33536 , advance('{')
33537 , function() {
33538 if(token.data === '}') {
33539 state.scope.exit()
33540 tokens.shift()
33541 return state.shift()
33542 }
33543 if(token.data === ';') { tokens.shift(); return }
33544 state.unshift(decl(DECL_STRUCT))
33545 }
33546 )
33547
33548 parse_precision =
33549 stative(
33550 function() { return tokens.shift(), Advance }
33551 , function() {
33552 return assert(
33553 'keyword', ['lowp', 'mediump', 'highp']
33554 ) && (state.unshift(keyword()), Advance)
33555 }
33556 , function() { return (state.unshift(keyword()), Advance) }
33557 , function() { return state.shift() }
33558 )
33559
33560 parse_quantifier =
33561 stative(
33562 advance('[')
33563 , advance_expr(']')
33564 , advance(']')
33565 , function() { return state.shift() }
33566 )
33567
33568 parse_forloop =
33569 stative(
33570 advance('for', 'keyword')
33571 , advance('(')
33572 , function() {
33573 var lookup
33574 if(token.type === 'ident') {
33575 if(!(lookup = state.scope.find(token.data))) {
33576 lookup = state.create_node()
33577 }

Callers 1

parserFunction · 0.70

Calls 14

stativeFunction · 0.70
advanceFunction · 0.70
mknodeFunction · 0.70
advance_identFunction · 0.70
declFunction · 0.70
assertFunction · 0.70
keywordFunction · 0.70
advance_exprFunction · 0.70
maybe_stmtlistFunction · 0.70
advance_stmtlistFunction · 0.70
popstmtFunction · 0.70
exprFunction · 0.70

Tested by

no test coverage detected