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