[SimpleParse] BUG
Brought to you by:
mcfletch
From: gr <gr...@i-...> - 2003-10-21 20:21:40
|
Hi all, I think that the following example illustrates a bug. I use Enthought Python 2.3 on Windows 2000 and the latest simpleParse and TextTools version. Workaround: Use the second version and the example works as expected. declaration = r''' IDENT := NONDIGIT, ( DIGIT / NONDIGIT )*, whsp* NONDIGIT := [a-zA-Z] DIGIT := [0-9] whsp := [ \t\r\n] start := whsp*, class_definition, ";", whsp* # 1st version: class_definition := "model ", IDENT, composition, "end", whsp+, IDENT composition := ( NONDIGIT+, whsp, NONDIGIT*, ";", whsp* )* # 2nd version: #class_definition := "model ", IDENT, composition*, "end", whsp+, IDENT #composition := NONDIGIT+, whsp, NONDIGIT*, ";", whsp* ''' print '---------------START-------------' testString = ''' model Test Real x; end Test; ''' from simpleparse import generator from mx import TextTools import pprint parser = generator.buildParser( declaration ).parserbyname('start' ) pprint.pprint( TextTools.tag( testString, parser )) Thank you for your attention, gr |