-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #644 from jmecosta/feature/improve-logging
change colourizer
- Loading branch information
Showing
9 changed files
with
135 additions
and
412 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
133 changes: 133 additions & 0 deletions
133
sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/CxxSourceCodeColorizer.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
* Sonar C++ Plugin (Community) | ||
* Copyright (C) 2010 Neticoa SAS France | ||
* [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.plugins.cxx; | ||
|
||
import com.google.common.collect.ImmutableSet; | ||
import org.sonar.api.web.CodeColorizerFormat; | ||
import org.sonar.colorizer.CDocTokenizer; | ||
import org.sonar.colorizer.CppDocTokenizer; | ||
import org.sonar.colorizer.KeywordsTokenizer; | ||
import org.sonar.colorizer.LiteralTokenizer; | ||
import org.sonar.colorizer.RegexpTokenizer; | ||
import org.sonar.colorizer.Tokenizer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class CxxSourceCodeColorizer extends CodeColorizerFormat { | ||
|
||
private static final Set<String> KEYWORDS = ImmutableSet.of( | ||
"abstract", | ||
"as", | ||
"base", | ||
"bool", | ||
"break", | ||
"byte", | ||
"case", | ||
"catch", | ||
"char", | ||
"checked", | ||
"class", | ||
"const", | ||
"continue", | ||
"decimal", | ||
"default", | ||
"delegate", | ||
"do", | ||
"double", | ||
"else", | ||
"enum", | ||
"event", | ||
"explicit", | ||
"extern", | ||
"false", | ||
"finally", | ||
"fixed", | ||
"float", | ||
"for", | ||
"foreach", | ||
"goto", | ||
"if", | ||
"implicit", | ||
"in", | ||
"int", | ||
"interface", | ||
"internal", | ||
"is", | ||
"lock", | ||
"long", | ||
"namespace", | ||
"new", | ||
"null", | ||
"object", | ||
"operator", | ||
"out", | ||
"override", | ||
"params", | ||
"private", | ||
"protected", | ||
"public", | ||
"readonly", | ||
"ref", | ||
"return", | ||
"sbyte", | ||
"sealed", | ||
"short", | ||
"sizeof", | ||
"stackalloc", | ||
"static", | ||
"string", | ||
"struct", | ||
"switch", | ||
"this", | ||
"throw", | ||
"true", | ||
"try", | ||
"typeof", | ||
"uint", | ||
"ulong", | ||
"unchecked", | ||
"unsafe", | ||
"ushort", | ||
"using", | ||
"virtual", | ||
"void", | ||
"volatile", | ||
"while"); | ||
private static final String SPAN = "</span>"; | ||
|
||
public CxxSourceCodeColorizer() { | ||
super(CxxLanguage.KEY); | ||
} | ||
|
||
@Override | ||
public List<Tokenizer> getTokenizers() { | ||
List<Tokenizer> tokenizers = new ArrayList<Tokenizer>(); | ||
tokenizers.add(new CDocTokenizer("<span class=\"cd\">", SPAN)); | ||
tokenizers.add(new CppDocTokenizer("<span class=\"cppd\">", SPAN)); | ||
tokenizers.add(new KeywordsTokenizer("<span class=\"k\">", SPAN, KEYWORDS)); | ||
tokenizers.add(new LiteralTokenizer("<span class=\"s\">", SPAN)); | ||
tokenizers.add(new RegexpTokenizer("<span class=\"j\">", SPAN, "#[^\\n\\r]*+")); | ||
tokenizers.add(new RegexpTokenizer("<span class=\"c\">", SPAN, "[+-]?[0-9]++(\\.[0-9]*+)?")); | ||
return tokenizers; | ||
} | ||
|
||
} |
129 changes: 0 additions & 129 deletions
129
sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/highlighter/CxxHighlighter.java
This file was deleted.
Oops, something went wrong.
79 changes: 0 additions & 79 deletions
79
sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/highlighter/SourceFileOffsets.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/highlighter/package-info.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.