Skip to content

Instantly share code, notes, and snippets.

@bakso
Created January 11, 2017 15:43
Show Gist options
  • Save bakso/cd6117fa7f93d9b917192cae7fd8df78 to your computer and use it in GitHub Desktop.
Save bakso/cd6117fa7f93d9b917192cae7fd8df78 to your computer and use it in GitHub Desktop.
ExpressionList
= e:Expression*
Expression
= ae:AssignExpression
/ we:WatchExpression
AssignExpression
= id: Identifier f: Factory "(" (params:ParameterList)? ")"
ParameterList
= DomElement
/ EventType
/ ArrowFunction
ArrowFunction
EventType
= "click"
/ "tap"
/ "keyup"
/ "keydown"
/ "mouseenter"
/ "mouseleave"
Factory
= "fromEvent"
/ "merge"
ReservedWord
= EventType
/ Factory
Identifier
= !ReservedWord head:[a-zA-z_$] tails:[a-zA-z0-9_$]* _ {
var ret = [head];
tails.forEach(function (item) {
ret.push(item);
});
return {
type: "Identifier",
name: ret.join('')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment