From: AndreasK on 27 Jul 2010 13:21 On Jul 26, 2:44 pm, Fredrik Karlsson <dargo...(a)gmail.com> wrote: > Dear group, > > I am using the parser tools to generate a snit parser for a file > format. So far, I have been sucessful using this generator script: > > and this test script: > Usually, I get the last sucessfully parsed part of the file from this > script (through the return value of the statement within the "catch" > statement) which has been very helpful. > > Now, however, it seems that the entire file is parsed (at least I > cannot notice a difference beween the last parsed point in the file, > and the point where I would get an EOF), but instead of the expected > sucessful parsing, I get the strange error message "expected start <= > end for range" in $inast. > > What am I doing wrong? > > I attach the PEG and the file to be parsed below... > > I would very much appreciate all the help I could get! > > (Sorry for posting this here in case this is rather a PEG problem.. > but I just get the feeling that this might be a Tcl problem...?) Eliding the big set of files. It is neither a PEG nor a Tcl problem. It apparently is a problem of the pt::rde package. It derails when trying to handle a construct X* where nothing matched X. In this particular example it was the empty strings ("") which derailed the handling of symbol 'string_value'. While I have no fix yet, I am trying to find one. Have to make a test case of that, check if the critcl pt::rde code suffers as well, ditto for the PEG interpreter. -- Andreas Kupries Senior Tcl Developer ActiveState, The Dynamic Language Experts P: 778.786.1122 F: 778.786.1133 andreask(a)activestate.com http://www.activestate.com Get insights on Open Source and Dynamic Languages at www.activestate.com/blog
From: Andreas Kupries on 30 Jul 2010 02:11 AndreasK <andreas.kupries(a)gmail.com> writes: > Eliding the big set of files. It is neither a PEG nor a Tcl problem. > It apparently is a problem of the pt::rde package. It derails when > trying to handle a construct X* where nothing matched X. In this > particular example it was the empty strings ("") which derailed the > handling of symbol 'string_value'. > > While I have no fix yet, I am trying to find one. Have to make a test > case of that, check if the critcl pt::rde code suffers as well, ditto > for the PEG interpreter. Following up to myself on this the CVS of tcllib now contains pt::rde 1.0.1 pt::ast 1.1 with which the problem should be solved. A hacky workaround to getting them is to simply disable the check in the pt::ast package. The problem the runtime had was with rules of the form X <- Y* and X <- Y? where Y was not found in the input. It was fixed by allowing the construction of AST nodes which cover an empty string (character range) and updating to runtime to recognize this situation. -- So long, Andreas Kupries <akupries(a)shaw.ca> <http://www.purl.org/NET/akupries/> Developer @ <http://www.activestate.com/> -------------------------------------------------------------------------------
|
Pages: 1 Prev: using while in expect Next: Tcl code encryption best practice -- Please help |