org.sonar.cxx.api.CppPunctuator Maven / Gradle / Ivy
The newest version!
/*
* Sonar C++ Plugin (Community)
* Copyright (C) 2011 Waleri Enns and CONTACT Software GmbH
* [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
package org.sonar.cxx.api;
import com.sonar.sslr.api.AstNode;
import com.sonar.sslr.api.TokenType;
/**
* C++ Standard, 2.13 Operators and punctuators
*/
public enum CppPunctuator implements TokenType {
// Basic arithmetic operators
PLUS("+"),
MINUS("-"),
MUL("*"),
DIV("/"),
MODULO("%"),
INCR("++"),
DECR("--"),
ASSIGN("="),
// Comparison/relational operators
EQ("=="),
NOT_EQ("!="),
LT("<"),
GT(">"),
LT_EQ("<="),
GT_EQ(">="),
// Logical operators
NOT("!"),
AND("&&"),
OR("||"),
// Bitwise Operators
BW_NOT("~"),
BW_AND("&"),
BW_OR("|"),
BW_XOR("ˆ"),
BW_LSHIFT("<<"),
BW_RSHIFT(">>"),
// Compound assignment operators
PLUS_ASSIGN("+="),
MINUS_ASSIGN("-="),
MUL_ASSIGN("*="),
DIV_ASSIGN("/="),
MODULO_ASSIGN("%="),
BW_AND_ASSIGN("&="),
BW_OR_ASSIGN("|="),
BW_XOR_ASSIGN("ˆ="),
BW_LSHIFT_ASSIGN("<<="),
BW_RSHIFT_ASSIGN(">>="),
// Member and pointer operators
ARROW("->"),
DOT("."),
DOT_STAR(".*"),
ARROW_STAR("->*"),
// Delimiters
SEMICOLON(";"),
COLON(":"),
COMMA(","),
DOUBLECOLON("::"),
BR_LEFT("("),
BR_RIGHT(")"),
CURLBR_LEFT("{"),
CURLBR_RIGHT("}"),
SQBR_LEFT("["),
SQBR_RIGHT("]"),
// Other operators
QUEST("?"),
ELLIPSIS("..."),
HASH("#"),
HASHHASH("##"),
// Trigraphs etc.
LT_COLON("<:"),
GT_COLON(":>"),
LT_MOD("<%"),
GT_MOD("%>"),
MOD_COLON("%:"),
MOD_COLON_MOD_COLON("%:%:"),
NEW("new"),
DELETE("delete"),
// Aliases
AL_AND("and"),
AL_AND_EQ("and_eq"),
AL_BITAND("bitand"),
AL_BITOR("bitor"),
AL_COMPL("compl"),
AL_NOT("not"),
AL_NOT_EQ("not_eq "),
AL_OR("or"),
AL_OR_EQ("or_eq"),
AL_AL_XOR("xor"),
AL_XOR_EQ("xor_eq");
private final String value;
private CppPunctuator(String word) {
this.value = word;
}
public String getName() {
return name();
}
public String getValue() {
return value;
}
public boolean hasToBeSkippedFromAst(AstNode node) {
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy