From: Sven R. <rei...@ma...> - 2002-11-06 16:36:01
|
I added a few more tests for rename temp. It looks that so far it does a simple text replacement (after extracting the correct variable name from the declaration). I could make some more of these tests run, but only with some crude hacks. What do you think of one further parsing step that splits an expression into tokens (applied only when it contains the string we're interested in)? Tokens so far are just legal identifier names, "::", "->" and "."; the rest can be kept as source code. Sven. -- Sven Reichard Dept. of Math. Sci. University of Delaware rei...@ma... |
From: Baptiste L. <gai...@fr...> - 2002-11-06 22:14:26
|
Completly forgot about the fact that there might be spaces around '::'... Instead of parsing for those, I was thinking of moving the identifier parsing at a level below expression. I haven't though too much about it yet, but it would be something like: Format: [node-type] => pattern node format specification (see ASTStructure in doc/ for the format) [qualified-identifier] => '::' identifier | '::'? (identifier '::')+ identifiier member-by-reference-identifier => any-identifier '.' identifier member-by-pointer-identifier => any-identifier '->' identifier locale-identifier // local variable and parameter identifiers => identifier // when nothing else is matched Notes that some might be recursive: "vector.origin.x" matches member-by-reference-identifier twice .The produced AST would probably be something like: [member-by-reference-identifier] object-identifier => [{any-identfiier}] member-identifier => identifier In our case: [member-by-reference-identifier] object-identifier => [member-by-reference-identifier] object-identifier => [identifier] = "vector" member-identifier => [identifier] = "origin" member-identifier => [identifier] = "x" Later, we could add: function-call => any-identifier '(' ... ')' where any-identifier is any of the identifier node-type defined above. This would allow the refactoring component to work at a higher level, just like for the variable declarations, using a visitor for example. What do you think ? Baptiste. ----- Original Message ----- From: "Sven Reichard" <rei...@ma...> To: "CppTool Mailing List" <Cpp...@li...> Sent: Wednesday, November 06, 2002 5:35 PM Subject: [Cpptool-develop] tests added > > I added a few more tests for rename temp. It looks that so far it does a > simple text replacement (after extracting the correct variable name from > the declaration). I could make some more of these tests run, but only with > some crude hacks. What do you think of one further parsing step that > splits an expression into tokens (applied only when it contains the string > we're interested in)? Tokens so far are just legal identifier names, "::", > "->" and "."; the rest can be kept as source code. > > Sven. > > -- > Sven Reichard > Dept. of Math. Sci. > University of Delaware > rei...@ma... > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: See the NEW Palm > Tungsten T handheld. Power & Color in a compact size! > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en > _______________________________________________ > Cpptool-develop mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cpptool-develop > > |
From: Sven R. <rei...@ma...> - 2002-11-06 23:27:09
|
On Wed, 6 Nov 2002, Baptiste Lepilleur wrote: > Completly forgot about the fact that there might be spaces around '::'... That's why you should have at least 2 developers :) (if you can't pair-program) > Instead of parsing for those, I was thinking of moving the identifier > parsing at a level below expression. I haven't though too much about it yet, > but it would be something like: > <snip> > This would allow the refactoring component to work at a higher level, just > like for the variable declarations, using a visitor for example. > > What do you think ? I think that for now it is sufficient to check that we match a complete identifier, and if it is preceded by a scope operator. Let's think about more complicated approaches later. BTW, did you manage to set up your public key pair? For me it works nicely now. -- Sven Reichard Dept. of Math. Sci. University of Delaware rei...@ma... |
From: Baptiste L. <gai...@fr...> - 2002-11-07 07:33:49
|
----- Original Message ----- From: "Sven Reichard" <rei...@ma...> To: "CppTool Mailing List" <Cpp...@li...> Sent: Thursday, November 07, 2002 12:27 AM Subject: [Cpptool-develop] Re: [Cpptool-develop]Identifying variable occurrences (was: tests added) > On Wed, 6 Nov 2002, Baptiste Lepilleur wrote: > > > Completly forgot about the fact that there might be spaces around '::'... > > That's why you should have at least 2 developers :) (if you can't > pair-program) You got it ;-) > > Instead of parsing for those, I was thinking of moving the identifier > > parsing at a level below expression. I haven't though too much about it yet, > > but it would be something like: > > <snip> > > This would allow the refactoring component to work at a higher level, just > > like for the variable declarations, using a visitor for example. > > > > What do you think ? > > I think that for now it is sufficient to check that we match a complete > identifier, and if it is preceded by a scope operator. Let's think about > more complicated approaches later. So we only do the [variable-identifier] parsing for now. That's sound fine with me. > BTW, did you manage to set up your public key pair? For me it works nicely > now. No, I never managed to get it working (even with just open-ssh) :-( Baptiste. > > -- > Sven Reichard > Dept. of Math. Sci. > University of Delaware > rei...@ma... |