Skip to content

Instantly share code, notes, and snippets.

@hellais
Created December 2, 2012 15:14
Show Gist options
  • Save hellais/4189278 to your computer and use it in GitHub Desktop.
Save hellais/4189278 to your computer and use it in GitHub Desktop.
import parsley
grammar = """
byte = anything:b
-> ord(b)
data = byte:len <byte{len}>
"""
x = parsley.makeGrammar(grammar, {})
print x("\x09ninechars").data()
print x("\x13thirteenchars").data()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment