01 /**
02 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03 */
04 package net.sourceforge.pmd.cpd;
05
06 import java.util.List;
07
08 public class PHPTokenizer implements Tokenizer {
09
10 public void tokenize(SourceCode tokens, Tokens tokenEntries) {
11 List<String> code = tokens.getCode();
12 for (int i = 0; i < code.size(); i++) {
13 String currentLine = code.get(i);
14 for (int j = 0; j < currentLine.length(); j++) {
15 char tok = currentLine.charAt(j);
16 if (!Character.isWhitespace(tok) && tok != '{' && tok != '}' && tok != ';') {
17 tokenEntries.add(new TokenEntry(String.valueOf(tok), tokens.getFileName(), i + 1));
18 }
19 }
20 }
21 tokenEntries.add(TokenEntry.getEOF());
22 }
23 }
|