harpoon.Util
Class ParseUtil

java.lang.Object
  extended by harpoon.Util.ParseUtil

public abstract class ParseUtil
extends Object

ParseUtil implements simple parsers for common string data types. Input is from named resource files.

Version:
$Id: ParseUtil.java,v 1.3 2002/08/06 21:16:20 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Nested Class Summary
static class ParseUtil.BadLineException
          Exception thrown by the methods in ParseUtil to indicate an unparsable line in an input file.
static interface ParseUtil.StringParser
          Callback interface for the resource parsing routines.
 
Constructor Summary
ParseUtil()
           
 
Method Summary
static HClass parseClass(Linker l, String className)
          Parse a string as a class name.
static HField parseField(Linker l, String fieldName)
          Parse a string as a field name.
static HMethod parseMethod(Linker l, String methodName)
          Parse a string as a method name + descriptor string.
static void parseSet(String s, ParseUtil.StringParser sp)
          Parse a string as a set.
static void readResource(String resourceName, ParseUtil.StringParser sp)
          Reads from the given resource, ignoring '#' comments and blank lines, obeying 'include' directives, and invoking the given StringParser on any other lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParseUtil

public ParseUtil()
Method Detail

readResource

public static void readResource(String resourceName,
                                ParseUtil.StringParser sp)
                         throws IOException
Reads from the given resource, ignoring '#' comments and blank lines, obeying 'include' directives, and invoking the given StringParser on any other lines.

Throws:
IOException

parseClass

public static HClass parseClass(Linker l,
                                String className)
                         throws ParseUtil.BadLineException
Parse a string as a class name.

Throws:
ParseUtil.BadLineException

parseField

public static HField parseField(Linker l,
                                String fieldName)
                         throws ParseUtil.BadLineException
Parse a string as a field name.

Throws:
ParseUtil.BadLineException

parseMethod

public static HMethod parseMethod(Linker l,
                                  String methodName)
                           throws ParseUtil.BadLineException
Parse a string as a method name + descriptor string.

Throws:
ParseUtil.BadLineException

parseSet

public static void parseSet(String s,
                            ParseUtil.StringParser sp)
                     throws ParseUtil.BadLineException
Parse a string as a set. The string may be surrounded by optional curly braces, and elements may be delimited either spaces or commas or both. The given StringParser is invoked on each element in the set.

Throws:
ParseUtil.BadLineException