Updated Token::Match documentation

This commit is contained in:
Daniel Marjamäki 2015-12-31 01:25:36 +01:00
parent 8171154e12
commit 8ee3a8d168
1 changed files with 9 additions and 15 deletions

View File

@ -150,19 +150,20 @@ public:
* *
* Possible patterns * Possible patterns
* - "%any%" any token * - "%any%" any token
* - "%name%" any token which is a name, variable or type e.g. "hello" or "int" * - "%assign%" a assignment operand
* - "%type%" Anything that can be a variable type, e.g. "int", but not "delete".
* - "%num%" Any numeric token, e.g. "23"
* - "%bool%" true or false * - "%bool%" true or false
* - "%char%" Any token enclosed in '-character. * - "%char%" Any token enclosed in '-character.
* - "%comp%" Any token such that isComparisonOp() returns true. * - "%comp%" Any token such that isComparisonOp() returns true.
* - "%cop%" Any token such that isConstOp() returns true.
* - "%name%" any token which is a name, variable or type e.g. "hello" or "int"
* - "%num%" Any numeric token, e.g. "23"
* - "%op%" Any token such that isOp() returns true.
* - "%or%" A bitwise-or operator '|'
* - "%oror%" A logical-or operator '||'
* - "%type%" Anything that can be a variable type, e.g. "int", but not "delete".
* - "%str%" Any token starting with "-character (C-string). * - "%str%" Any token starting with "-character (C-string).
* - "%var%" Match with token with varId > 0 * - "%var%" Match with token with varId > 0
* - "%varid%" Match with parameter varid * - "%varid%" Match with parameter varid
* - "%op%" Any token such that isOp() returns true.
* - "%cop%" Any token such that isConstOp() returns true.
* - "%or%" A bitwise-or operator '|'
* - "%oror%" A logical-or operator '||'
* - "[abc]" Any of the characters 'a' or 'b' or 'c' * - "[abc]" Any of the characters 'a' or 'b' or 'c'
* - "int|void|char" Any of the strings, int, void or char * - "int|void|char" Any of the strings, int, void or char
* - "int|void|char|" Any of the strings, int, void or char or empty string * - "int|void|char|" Any of the strings, int, void or char or empty string
@ -170,16 +171,9 @@ public:
* - "someRandomText" If token contains "someRandomText". * - "someRandomText" If token contains "someRandomText".
* *
* multi-compare patterns such as "int|void|char" can contain %%or%, %%oror% and %%op% * multi-compare patterns such as "int|void|char" can contain %%or%, %%oror% and %%op%
* but it is not recommended to put such an %%cmd% as the first pattern. * it is recommended to put such an %%cmd% as the first pattern.
*
* It's possible to use multi-compare patterns with all the other %%cmds%,
* except for %%varid%, and normal names, but the %%cmds% should be put as
* the first patterns in the list, then the normal names.
* For example: "%var%|%num%|)" means yes to a variable, a number or ')'. * For example: "%var%|%num%|)" means yes to a variable, a number or ')'.
* *
* @todo Make it possible to use the %%cmds% and the normal names in the
* multicompare list without an order.
*
* The patterns can be also combined to compare to multiple tokens at once * The patterns can be also combined to compare to multiple tokens at once
* by separating tokens with a space, e.g. * by separating tokens with a space, e.g.
* ") const|void {" will return true if first token is ')' next token is either * ") const|void {" will return true if first token is ')' next token is either