----- Original Message -----
From: "Sven Reichard" <rei...@ma...>
To: "CppTool Mailing List" <Cpp...@li...>
Sent: Friday, November 08, 2002 8:45 PM
Subject: [Cpptool-develop] ExpressionMutator
> Baptiste,
>
> I don't understand your code. Could you for example explain the parameters
> of the ExpressionMutator constructor?
Its called from a mutator such as DeclarationOrExpressionMutator (just like
the VariableDeclMutator), except that I moved the computation of the
start/end source range into the constructor since it makes no sense passing
anything else.
I added a test to help (and fixed a bug).
The parsing is done in two steps. Firstly, the expression is parsed and for
each 'token' in the expression, its range and token type are stored.
Secondly, the expression seen as a list of token is analysed and we search
the pattern that match an identifier (an identifier token which is neither
preceeded nor followed by a '.', '->' or '::').
I do like to think that this makes the code a lot clearer (at least much
more that the VariableDeclMutator).
A mutator (like DeclarationOrExpressionMutator ) still need to be added and
the ASTNodeTypes updated to help 'finding' identifier. Also, the variable
declaration statement node structure need to be changed to use a
variable-identifier instead of a variable-name.
Baptiste.
>
> Sven
>
> --
> Sven Reichard
> Dept. of Math. Sci.
> University of Delaware
> rei...@ma...
|