View Javadoc
1 package jsdsi; 2 3 import java.util.Iterator; 4 5 import jsdsi.sexp.Sexp; 6 import jsdsi.sexp.SexpList; 7 import jsdsi.sexp.SexpParseException; 8 import jsdsi.sexp.SexpString; 9 import jsdsi.sexp.SexpUtil; 10 11 /*** 12 * Distinguishes tags defined by expressions from tags in general (the 13 * latter includes Tag.ALL_TAG and Tag.NULL_TAG). Only ExprTags can 14 * appear within other tags (like SetTags or SimpleTags). 15 * 16 * @author Sameer Ajmani 17 * @author Sean Radford 18 * @version $Revision: 1.4.2.1 $ $Date: 2005/11/08 03:12:52 $ 19 */ 20 public abstract class ExprTag extends Tag { 21 22 private static final long serialVersionUID = -5113636612205223121L; 23 24 static ExprTag parseExprTag(Sexp s) throws SexpParseException { 25 if (s instanceof SexpString) { 26 return new StringTag(((SexpString) s).toString()); 27 } 28 SexpList l = (SexpList) s; 29 if (!l.getType().equals("*")) { 30 return SimpleTag.parseSimpleTag(l); 31 } 32 Iterator tbody = SexpUtil.getBody(l); 33 String type = SexpUtil.getNextString(tbody, "ExprTag type"); 34 if (type.equals("set")) 35 return SetTag.parseSetTag(tbody); 36 if (type.equals("range")) 37 return RangeTag.parseRangeTag(tbody); 38 if (type.equals("prefix")) 39 return PrefixTag.parsePrefixTag(tbody); 40 if (type.equals("reverse-prefix")) 41 return ReversePrefixTag.parseReversePrefixTag(tbody); 42 throw new SexpParseException("Unrecognized ExprTag type: " + type); 43 } 44 }

This page was automatically generated by Maven