Created
January 11, 2017 15:43
-
-
Save bakso/cd6117fa7f93d9b917192cae7fd8df78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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