View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.cpd;
5   
6   import java.util.ArrayList;
7   
8   /**
9    * Tokenizer for Ruby.
10   * 
11   * @author Zev Blut zb@ubit.com
12   */
13  public class RubyTokenizer extends AbstractTokenizer {
14  
15      /**
16       * Creates a new Ruby tokenizer.
17       */
18      public RubyTokenizer() {
19          // setting markers for "string" in ruby
20          this.stringToken = new ArrayList<>();
21          this.stringToken.add("\'");
22          this.stringToken.add("\"");
23          // setting markers for 'ignorable character' in Ruby
24          this.ignorableCharacter = new ArrayList<>();
25          this.ignorableCharacter.add("{");
26          this.ignorableCharacter.add("}");
27          this.ignorableCharacter.add("(");
28          this.ignorableCharacter.add(")");
29          this.ignorableCharacter.add(";");
30          this.ignorableCharacter.add(",");
31  
32          // setting markers for 'ignorable string' in Ruby
33          this.ignorableStmt = new ArrayList<>();
34          this.ignorableStmt.add("while");
35          this.ignorableStmt.add("do");
36          this.ignorableStmt.add("end");
37      }
38  }