Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1)Implement another declaration of 'Token::eraseTokens' with paramete…
…rs: the starting token and the number of times needed to call 'deleteNext'. 2)Use the overloaded 'eraseTokens' where needed instead of using consecutively 'deleteNext'. 3)Tokenizer: general optimizations about the deletion of some tokens. 4)Run astyle.
- Loading branch information
Edoardo Prezioso
committed
Dec 7, 2011
1 parent
b922443
commit 612b3c5
Showing
5 changed files
with
121 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
612b3c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that there is a subtle difference how Token::eraseTokens behaves if it is given a token or a value. It would make more sense to me if these calls where the same:
Token::eraseTokens(tok, tok->tokAt(4));
Token::eraseTokens(tok, 4);
How about:
tok->deleteNext(3);
tok->deleteThis(3);
612b3c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could also change Token::eraseTokens so it will also delete the start and end tokens. However I would want to see a pull request or patch for this first then so I see what changes this would mean.
612b3c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imho if Token::eraseTokens should be changed, let it delete also the end token, but not the beginning one. Removing also the beginning one makes it easy to do this kind of code:
this code would cause a memory corruption IIRC (if not, whatever it happens, valgrind would write tons of errors), because you lose 'tok'.
612b3c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer tok->deleteNext(4) instead of Token::eraseTokens(tok,4).
612b3c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right, I'll make deleteNext(default value = 1).
Question: is it possible to optimize this code:
612b3c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question.. I guess:
612b3c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'll do that.