From: Baptiste L. <gai...@fr...> - 2002-12-17 16:59:11
|
Quoting Andre Baresel <and...@gm...>: > I'm currently implementing that item "adding parsing for 'for'-statement > > condition declaration" and didn't > find it to complicated however I have a general question about the > parsing. > > Should we directly call the parser for the for-iteration-expression > within the for-statment-parser or > does this lazy parsing continue also in here. For a lazy parsing of > for-iteration-expressions I would > add a 'unparsedForIterationExpression' node and write the mutator for > this. > > Within the for-iteration-expression-parser I would do the same - adding > > unparsed elements for the three properties > ( unparsedDeclarationOrExpression , unparsedExpressionStatement, > unparsedExpressionStatement ) > Well "unparsedDeclarationOrExpression" doesn't exist at the moment... > > For checking the code I'm currently using direct parsing. But it will be > no problem to > transform this, since the code only needs to be move than into the > mutator. Weither you use lazy parsing or not is related to two issues: 1) Fault tolerance 2) Level of detail (lazy parsing) The first one is easy to understand, what you don't parse will not cause failure. For the second one (still ill defined), lazy parsing is used to parse up to a given level of details. At the current time, there is roughly three levels: - statement - variable declaration - use of identifier in expression The statement parser is a parser at the 'statement level' and should therefore only do direct parsing for the same level. The first expression of the for statement should use lazy parsing (unparsedDeclarationOrExpression). For the other, you can directly create the expression (no check is done on what is an expression). It seems reasonnable for me that the for statement parser break the iteration declaration into its three sub-expressions. > > Implementation will still need some time since I also want to go through > the tests ... Take your time, but do commit once you have a version is somewhat working. It allow other to start working with the new feature (for example, modification the IdentifierResolver to handle for statement declaration). Baptiste. > -- Andre --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/index.html Language: English, French |