checkpoint
[sbp.git] / src / edu / berkeley / sbp / Token.java
1 package edu.berkeley.sbp;
2 import java.io.*;
3 import java.util.*;
4 import java.lang.reflect.*;
5 import java.lang.ref.*;
6 import edu.berkeley.sbp.*;
7 import edu.berkeley.sbp.util.*;
8
9 /** a token of input -- note that this represents an <i>actual input token</i> rather than an <tt>Element</tt> which <i>matches</i> a token */
10 public interface Token {
11
12     /** this is declared abstract as a way of forcing subclasses to provide a thoughtful implementation */
13     public abstract String toString();
14
15     /** a sequence of input tokens; returns null when EOF is reached */
16     public static interface Stream<Tok> {
17         public Tok next(int numstates, int resets, int waits) throws IOException;
18         public abstract Location getLocation();
19     }
20
21     /** a location *between tokens* in the input stream */
22     public static interface Location {
23         public String toString();
24     }
25 }
26
27