Re: re question

2006-06-23 Thread Daniel Sch
"Paul McGuire" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Shouldn't > > End Package Test; > > read: > > End Package Test123; > > > -- Paul yes it must :) my mistake thx -- http://mail.python.org/mailman/listinfo/python-list

Re: re question

2006-06-23 Thread Daniel Sch
Hi [...] hm, that's wired I just tried it in python shell and it works but same code as script file fails for anyone who want to see for himself # package.vhd file bash % cat package.vhd library ieee; use ieee.std_logic_1164.all; package TEST123 is constant BASE End Package Test; #

Re: what exceptions may file() and read() throw?

2006-06-23 Thread Daniel Sch
Hi > You can't easily list the exceptions that your code could throw. There are > some obvious ones apart from IOError: say filename was an int (or even > certain strings) you would get TypeError, or you might get MemoryError or > KeyboardInterrupt. More obscurely, if you reused file as a global v

what exceptions may file() and read() throw?

2006-06-23 Thread Daniel Sch
Hello, currently I am using this instance method def getFilecontent(self, filename): try: return file(filename).read() except IOError, err_msg: print err_msg sys.exit(1)

re question

2006-06-23 Thread Daniel Sch
Hello re gurus, I wrote this pattern trying to get the "name" and the "content" of VHDL package I know that the file is a valid VHDL code, so actually there is no need to perform validation after 'end' token is found, but since it works fine I don't want to touch it. this is the pattern patte

Re: parser question

2005-10-19 Thread Daniel Sch
> pattern = re.compile(r"^\s*A\s*{.*}\s*", re.MULTILINE | re.DOTALL) correction pattern = re.compile(r"^\s*A\s*{.*?}\s*", re.MULTILINE | re.DOTALL) I forgot to make it non gready :) -- http://mail.python.org/mailman/listinfo/python-list

parser question

2005-10-19 Thread Daniel Sch
Hello *, I have one format with this structure A { x=1 y=3 B { z = "something here" } } C { } A { x=0 y=0 B { z = "other" } } are there parsers for this kind of structure? specially I am inter