|
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
>
>
|