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 VHDLTagger extends Tagger 30 { 31 private static final RE entityRE = 34 new UncheckedRE("^entity\\s+([a-z][a-z0-9_]*[a-z0-9])", RE.REG_ICASE); 35 36 public VHDLTagger(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.length() > 0) { 48 char c = s.charAt(0); 49 if (c == 'e' || c == 'E') { 50 REMatch match = entityRE.getMatch(s); 51 if (match != null) { 52 String name = s.substring(match.getSubStartIndex(1), 53 match.getSubEndIndex(1)); 54 tags.add(new LocalTag(name, line)); 55 } 56 } 57 } 58 line = line.next(); 59 } 60 buffer.setTags(tags); 61 } 62 } 63 | Popular Tags |