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.List;
    7
    8   public class PHPTokenizer implements Tokenizer {
    9
    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  }