Class SourceFile

  • All Implemented Interfaces:
    Constants, RuntimeConstants

    public class SourceFile
    extends java.lang.Object
    implements Constants
    An input stream for java programs. The stream treats either "\n", "\r" or "\r\n" as the end of a line, it always returns \n. It also parses UNICODE characters expressed as ￿. However, if it sees "\\", the second slash cannot begin a unicode sequence. It keeps track of the current position in the input stream. An position consists of: ((linenr << OFFSETBITS) | offset) this means that both the line number and the exact offset into the file are encoded in each postion value.

    • Field Detail

      • nerrors

        public int nerrors
        The number of errors and warnings
      • nwarnings

        public int nwarnings
    • Constructor Detail

      • SourceFile

        public SourceFile​(Tool tool,
                          java.io.DataInputStream dataInputStream,
                          java.lang.String inputFileName,
                          java.io.PrintWriter out)
    • Method Detail

      • getInputFileName

        public java.lang.String getInputFileName()
      • closeInp

        public void closeInp()
      • read

        public int read()
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • lineNumber

        public int lineNumber​(int pos)
      • lineNumber

        public int lineNumber()
      • flushErrors

        public void flushErrors()
        Flush outstanding errors
      • output

        public void output​(java.lang.String msg)
        Output a string. This can either be an error message or something for debugging. This should be used instead of print.
      • outputln

        public void outputln​(java.lang.String msg)
        Output a string. This can either be an error message or something for debugging. This should be used instead of println.
      • error

        public void error​(int where,
                          java.lang.String err,
                          java.lang.Object arg1,
                          java.lang.Object arg2,
                          java.lang.Object arg3)
        Issue an error
      • error

        public final void error​(int where,
                                java.lang.String err,
                                java.lang.Object arg1,
                                java.lang.Object arg2)
      • error

        public final void error​(int where,
                                java.lang.String err,
                                java.lang.Object arg1)
      • error

        public final void error​(int where,
                                java.lang.String err)
      • error

        public final void error​(java.lang.String err)
      • error

        public final void error​(java.lang.String err,
                                java.lang.Object arg1)
      • trace

        public void trace​(java.lang.String message)
      • traceln

        public void traceln​(java.lang.String message)