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
| // Phantom types - http://web.archive.org/web/20100615031841/http://blog.matthewdoig.com/?p=138 | |
| // Rather than DUs, just use simple marker interfaces | |
| type Zero = interface end | |
| type Succ<'length> = interface end | |
| type Phantom<'a,'length> = Phantom of 'a list | |
| let toList (Phantom l) = l | |
| let nil = Phantom [] : Phantom<_,Zero> |
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
| from pyparsing import * | |
| # By default, PyParsing treats \n as whitespace and ignores it | |
| # In our grammer, \n is significant, so tell PyParsing not to ignore it | |
| ParserElement.setDefaultWhitespaceChars(" \t") | |
| def parse(input_string): | |
| def convert_prop_to_dict(tokens): | |
| """Convert a list of field property tokens to a dict""" | |
| prop_dict = {} |