Main { static void die(String reason) (@ System.err.println(reason); System.exit(1); @) static void die(Throwable e) (@ e.printStackTrace(); die(e.getMessage()); @) } TypeDecl { public abstract String image(); } ReturnDecl { public String image() (@ return prefix+suffix; @) } ArgumentDecl { public String image() (@ StringBuffer value = new StringBuffer(prefix); value.append(" "); value.append(get_name().get_value()); value.append(suffix); if( get_initializer() != null){ value.append("="); value.append(get_initializer().get_image()); } return value.toString(); @) } CodeCategory { protected String expandPattern(Entity entity, String pattern) (@ // This implementation is a kludge until I find some classes that // do regular expression matching and substitution or develop such // facilities in cycle 6. // In the interrum, I will assume that a class name pattern // contains at most one instance of the variable '$[Entity]' and // no other. StringBuffer result = new StringBuffer(); String entityName = entity.get_name().get_value(); final String macroRef = "$[Entity]"; // Locate the only occurence of '$[Entity]' int here = pattern.indexOf(macroRef); if( here < 0){ return pattern; } result.append(pattern.substring(0,here)); result.append(entityName); result.append(pattern.substring(here+macroRef.length())); return result.toString(); @) String className(Entity entity) (@ return expandPattern(entity,get_classNamePattern()); @) File headerFile(Entity entity) (@ return new File(expandPattern(entity,get_headerNamePattern())); @) } GeneratedCodeCategory{ File implFile(Entity entity) (@ return new File(expandPattern(entity,get_implNamePattern())); @) } AccessKeyList{ public boolean intersects(AccessKeyList other) to AccessKey { (@ boolean result;@) init (@ result = false; @) return (@ result; @) before AccessKey (@ if(other.contains(host)) result = true; @) } } SourceList { init (@ set_value(new String_List(null)); @) void add(String fileName) (@ get_value().addElement(fileName); @) boolean isEmpty() (@ return get_value().isEmpty(); @) }