MCPcopy Create free account
hub / github.com/davidkingzyb/SCAST / parse_if

Function parse_if

js/SCAST.js:459–482  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

457 }
458 }
459 function parse_if(){
460 var n = input.next();
461 var r={
462 type:"IfStatement",
463 poi:{line:n.poi.line,start:n.poi.start},
464 value:n.value,
465 }
466 if(is_kw("if")){
467 r.value='elif'
468 input.next()
469 }
470 if(is_punc('(')){
471 r.condition=parse_condition()
472 if(is_punc('{')){
473 r.body=parse_block().body
474 }else{//if(condition)express without block
475 r.body=[until_next_kw()]
476 return r
477 }
478 return r
479 }
480 if(is_punc('{'))r.body=parse_block().body//else
481 return r
482 }
483
484 function until_next_kw(){
485 let _body=[]

Callers 1

parse_statementFunction · 0.70

Calls 5

is_kwFunction · 0.70
is_puncFunction · 0.70
parse_conditionFunction · 0.70
parse_blockFunction · 0.70
until_next_kwFunction · 0.70

Tested by

no test coverage detected