Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pyparsing import *
- indentStack = [1]
- stmt = Forward()
- suite = indentedBlock(stmt, indentStack)
- funcDecl = "def" + Word(printables)
- funcDef = Group( funcDecl + suite )
- stmt << ( funcDef | "open" | "close")
- module_body = OneOrMore(stmt)
- code="""
- def process
- open
- close"""
- funcDef.parseString(code) ### works fine
- funcDef.parseString(code) ### throws excepotion
- pyparsing.ParseException: not a subentry (at char 16), (line:2, col:5)
Add Comment
Please, Sign In to add comment