Last active
August 29, 2015 14:16
-
-
Save lukashavrlant/44ecfd2c0aa054262762 to your computer and use it in GitHub Desktop.
This file contains 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
expr | |
= m:metric separator e:expr { if (e.length > 1) {return e.concat(m[0]); } else { return e.concat(m); } } | |
/ metric | |
metric=n:number w:word { return [{unit:w, amount: n}]; } | |
number=num:([0-9]+) { return parseInt(num.join("")); } | |
word=str:([a-zA-Z]+) { return str.join(""); } | |
separator="," |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment