Last active
March 23, 2018 02:15
-
-
Save davesque/11e40763e44336bc75919474cee1cfd3 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
import parsimonious | |
parser = parsimonious.Grammar(r""" | |
type = tuple_type / basic_type | |
tuple_type = "(" type ("," type)* ")" | |
basic_type = base sub? arrlist? | |
base = alphas | |
sub = (digits "x" digits) / digits | |
arrlist = (const_arr / dynam_arr)+ | |
const_arr = "[" digits "]" | |
dynam_arr = "[]" | |
alphas = ~"[a-z]+" | |
digits = ~"[0-9]+" | |
""") | |
uint = parser.parse('uint') | |
uint256 = parser.parse('uint256') | |
fixed128x19 = parser.parse('fixed128x19') | |
tup = parser.parse('(uint,bool,fixed128x19)') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment