Class TokenReader


  • public class TokenReader
    extends java.lang.Object
    The TokenReader, given a text file, generates a series of Tokens (in the compiler sense, not AppleSoft) for the AppleSoft program.

    Note that this relies on the Java StreamTokenizer. The goal is to provide a more modern parsing of tokens (in which it succeeds), however, AppleSoft itself is dated and mixes with what a modern syntax would consist of. Specifically, the '#' is out of place as part of a token and not a syntax element. Hence there is some funny business embedded in the code.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Queue<Token> tokenize​(java.io.File file)
      A handy method to generate a list of Tokens from a file.
      static java.util.Queue<Token> tokenize​(java.io.InputStream inputStream)
      A handy method to generate a list of Tokens from an InputStream.
      static java.util.Queue<Token> tokenize​(java.lang.String filename)
      A handy method to generate a list of Tokens from a file name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • tokenize

        public static java.util.Queue<Token> tokenize​(java.lang.String filename)
                                               throws java.io.FileNotFoundException,
                                                      java.io.IOException
        A handy method to generate a list of Tokens from a file name.
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
      • tokenize

        public static java.util.Queue<Token> tokenize​(java.io.File file)
                                               throws java.io.FileNotFoundException,
                                                      java.io.IOException
        A handy method to generate a list of Tokens from a file.
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
      • tokenize

        public static java.util.Queue<Token> tokenize​(java.io.InputStream inputStream)
                                               throws java.io.IOException
        A handy method to generate a list of Tokens from an InputStream.
        Throws:
        java.io.IOException