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.List;
7
8 public class PHPTokenizer implements Tokenizer {
9
10 public void tokenize(SourceCode tokens, Tokens tokenEntries) {
11 List code = tokens.getCode();
12 for (int i = 0; i < code.size(); i++) {
13 String currentLine = (String) code.get(i);
14 for (int j = 0; j < currentLine.length(); j++) {
15 char tok = currentLine.charAt(j);
16 if (!Character.isWhitespace(tok) &&
17 tok != '{' &&
18 tok != '}' &&
19 tok != ';') {
20 tokenEntries.add(new TokenEntry(String.valueOf(tok), tokens.getFileName(), i + 1));
21 }
22 }
23 }
24 tokenEntries.add(TokenEntry.getEOF());
25 }
26 }