diff --git a/.gitignore b/.gitignore index 229800b1ec..47a1dcba1e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ bin/ .pmd .ruleset .settings/ +*.iml +.idea *.patch pmd-java/src/site/site.xml pmd-javascript/src/site/site.xml diff --git a/pmd/src/main/java/net/sourceforge/pmd/cpd/GoLanguage.java b/pmd/src/main/java/net/sourceforge/pmd/cpd/GoLanguage.java new file mode 100644 index 0000000000..c997669fdf --- /dev/null +++ b/pmd/src/main/java/net/sourceforge/pmd/cpd/GoLanguage.java @@ -0,0 +1,15 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ +package net.sourceforge.pmd.cpd; + +/** + * GoLang + * + * @author oinume@gmail.com + */ +public class GoLanguage extends AbstractLanguage { + public GoLanguage() { + super(new GoTokenizer(), ".go"); + } +} diff --git a/pmd/src/main/java/net/sourceforge/pmd/cpd/GoTokenizer.java b/pmd/src/main/java/net/sourceforge/pmd/cpd/GoTokenizer.java new file mode 100644 index 0000000000..0ec970d4c1 --- /dev/null +++ b/pmd/src/main/java/net/sourceforge/pmd/cpd/GoTokenizer.java @@ -0,0 +1,27 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ +package net.sourceforge.pmd.cpd; + +import java.util.ArrayList; + +/** + * GoLang + * + * @author oinume@gmail.com + */ +public class GoTokenizer extends AbstractTokenizer { + public GoTokenizer() { + // setting markers for "string" in Go + this.stringToken = new ArrayList(); + this.stringToken.add("\""); + this.stringToken.add("`"); + + // setting markers for 'ignorable character' in Go + this.ignorableCharacter = new ArrayList(); + this.ignorableCharacter.add(";"); + + // setting markers for 'ignorable string' in Go + this.ignorableStmt = new ArrayList(); + } +}