Skip to content

Instantly share code, notes, and snippets.

@sfpgmr
Last active November 16, 2018 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfpgmr/18a371b3579915113e54b9a0b2ddeb25 to your computer and use it in GitHub Desktop.
Save sfpgmr/18a371b3579915113e54b9a0b2ddeb25 to your computer and use it in GitHub Desktop.
/ ForToken __
"(" & __
init:(ExpressionNoIn __ )? ";" __
test:(Expression __)? ";" __
update:(Expression __)?
")" __
body:Statement
{
/*scope.pop();*/
return {
nodeType: "ForStatement",
init: extractOptional(init, 0),
test: extractOptional(test, 0),
update: extractOptional(update, 0),
body: body
};
}
/ ForToken __
"(" & __
declarations:VariableDecl __ ";" __
test:(Expression __)? ";" __
update:(Expression __)?
")" __
body:Statement
{
/*scope.pop();*/
return {
nodeType: "ForStatement",
init: {
nodeType: "VariableDeclaration",
declarations: declarations,
kind: "var"
},
test: extractOptional(test, 0),
update: extractOptional(update, 0),
body: body
};
}
/ ForToken __
"(" __
left:LeftHandSideExpression __
InToken __
right:Expression __
")" __
body:Statement
{
/*scope.pop();*/
return {
nodeType: "ForInStatement",
left: left,
right: right,
body: body
};
}
/ ForToken __
"(" __
declarations:VariableDecl __
InToken __
right:Expression __
")" __
body:Statement
{
/*scope.pop();*/
return {
nodeType: "ForInStatement",
left: {
nodeType: "VariableDeclaration",
declarations: declarations,
kind: "var"
},
right: right,
body: body
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment