Mercurial > hg > Members > shinya > pyrect
view src/cbcTranslator.py @ 16:100efeeb2ad9
remove unnecessary variable "s_local" in cTranslator.
author | Ryoma SHINYA <shinya@firefly.cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 05 Jul 2010 06:25:44 +0900 |
parents | 55684cb51347 |
children |
line wrap: on
line source
#!/usr/bin/env python from dfareg import Regexp, CallGraph from cTranslator import CTranslator class CbCTranslateExeption(Exception): pass class CbCTranslator(CTranslator): """ CbCTranslator >>> string = \"(A|B)*C\" >>> reg = Regexp(string) >>> dfacg = CallGraph(reg.dfa) >>> ct = CbCTranslator(string, dfacg) >>> ct.translate() >>> ct.debug = True >>> ct.translate() """ def __init__(self, regexp, cg): if cg.type == "NFA": raise CbCTranslateExeption("can't translate CbC from NFA") CTranslator.__init__(self, regexp, cg) self.funType = '__code ' self.callType = 'goto ' self.breakStatement = '' def test(): import doctest doctest.testmod() if __name__ == '__main__' : test()