Skip to content

Instantly share code, notes, and snippets.

@hellais
Created December 1, 2012 21:17
Show Gist options
  • Save hellais/4185160 to your computer and use it in GitHub Desktop.
Save hellais/4185160 to your computer and use it in GitHub Desktop.
import parsley
works = """
bar = token('\x01') -> 'spam'
| token('\x02') -> 'eggs'
"""
not_works = """
bar = token('\x00') -> 'foo'
| token('\x01') -> 'spam'
"""
#g = parsley.makeGrammar(works, {})
g = parsley.makeGrammar(not_works, {})
assert g("\x01").bar() == 'spam'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment