1 52 53 package freemarker.core; 54 55 import freemarker.template.TemplateException; 56 57 61 final class StopInstruction extends TemplateElement { 62 63 private Expression exp; 64 65 StopInstruction(Expression exp) { 66 this.exp = exp; 67 } 68 69 void accept(Environment env) throws TemplateException { 70 if (exp == null) { 71 throw new StopException(env); 72 } 73 throw new StopException(env, exp.getStringValue(env)); 74 } 75 76 public String getCanonicalForm() { 77 String expString = exp == null ? "" : " " + exp.getCanonicalForm(); 78 return "<#stop" + expString + "/>"; 79 } 80 81 public String getDescription() { 82 return "stop" + " [" + getStartLocation() + "]"; 83 } 84 } 85 86 87 | Popular Tags |