1 21 22 package org.armedbear.j; 23 24 import gnu.regexp.RE; 25 import gnu.regexp.REMatch; 26 import gnu.regexp.UncheckedRE; 27 import java.util.ArrayList ; 28 29 public final class PHPTagger extends Tagger 30 { 31 private static final RE functionRE = 34 new UncheckedRE("^function\\s+&?([a-zA-Z_\u007f-\u00ff][a-zA-Z0-9_\u007f-\u00ff]*)\\s*\\("); 35 36 public PHPTagger(SystemBuffer buffer) 37 { 38 super(buffer); 39 } 40 41 public void run() 42 { 43 ArrayList tags = new ArrayList (); 44 Line line = buffer.getFirstLine(); 45 while (line != null) { 46 String s = line.trim(); 47 if (s != null && s.startsWith("function")) { 48 REMatch match = functionRE.getMatch(s); 49 if (match != null) { 50 String token = s.substring(match.getSubStartIndex(1), 51 match.getSubEndIndex(1)); 52 tags.add(new LocalTag(token, line)); 53 } 54 } 55 line = line.next(); 56 } 57 buffer.setTags(tags); 58 } 59 } 60 | Popular Tags |