Package antlr

Class CharScanner

    • Field Detail

      • saveConsumedInput

        protected boolean saveConsumedInput
      • tokenObjectClass

        protected java.lang.Class tokenObjectClass
      • caseSensitive

        protected boolean caseSensitive
      • caseSensitiveLiterals

        protected boolean caseSensitiveLiterals
      • literals

        protected java.util.Hashtable literals
      • tabsize

        protected int tabsize
        Tab chars are handled by tab() according to this value; override method to do anything weird with tabs.
      • _returnToken

        protected Token _returnToken
      • commitToPath

        protected boolean commitToPath
        Used during filter mode to indicate that path is desired. A subsequent scan error will report an error as usual if acceptPath=true;
      • traceDepth

        protected int traceDepth
        Used to keep track of indentdepth for traceIn/Out
    • Method Detail

      • append

        public void append​(char c)
      • append

        public void append​(java.lang.String s)
      • commit

        public void commit()
      • getCaseSensitive

        public boolean getCaseSensitive()
      • getCaseSensitiveLiterals

        public final boolean getCaseSensitiveLiterals()
      • getColumn

        public int getColumn()
      • setColumn

        public void setColumn​(int c)
      • getCommitToPath

        public boolean getCommitToPath()
      • getFilename

        public java.lang.String getFilename()
      • getLine

        public int getLine()
      • getText

        public java.lang.String getText()
        return a copy of the current text buffer
      • getTokenObject

        public Token getTokenObject()
      • makeToken

        protected Token makeToken​(int t)
      • mark

        public int mark()
      • newline

        public void newline()
      • tab

        public void tab()
        advance the current column number by an appropriate amount according to tab size. This method is called from consume().
      • setTabSize

        public void setTabSize​(int size)
      • getTabSize

        public int getTabSize()
      • panic

        public void panic​(java.lang.String s)
        This method is executed by ANTLR internally when it detected an illegal state that cannot be recovered from. The default implementation of this method calls {@link java.lang.System.exit(int)} and writes directly to {@link java.lang.System.err)} , which is usually not appropriate when a translator is embedded into a larger application. It is highly recommended that this method be overridden to handle the error in a way appropriate for your application (e.g. throw an unchecked exception).
      • reportError

        public void reportError​(RecognitionException ex)
        Parser error-reporting function can be overridden in subclass
      • reportError

        public void reportError​(java.lang.String s)
        Parser error-reporting function can be overridden in subclass
      • reportWarning

        public void reportWarning​(java.lang.String s)
        Parser warning-reporting function can be overridden in subclass
      • resetText

        public void resetText()
      • rewind

        public void rewind​(int pos)
      • setCaseSensitive

        public void setCaseSensitive​(boolean t)
      • setCommitToPath

        public void setCommitToPath​(boolean commit)
      • setFilename

        public void setFilename​(java.lang.String f)
      • setLine

        public void setLine​(int line)
      • setText

        public void setText​(java.lang.String s)
      • setTokenObjectClass

        public void setTokenObjectClass​(java.lang.String cl)
      • testLiteralsTable

        public int testLiteralsTable​(int ttype)
      • testLiteralsTable

        public int testLiteralsTable​(java.lang.String text,
                                     int ttype)
        Test the text passed in against the literals table Override this method to perform a different literals test This is used primarily when you want to test a portion of a token.
      • toLower

        public char toLower​(char c)
      • traceIndent

        public void traceIndent()
      • uponEOF

        public void uponEOF()
                     throws TokenStreamException,
                            CharStreamException
        This method is called by YourLexer.nextToken() when the lexer has hit EOF condition. EOF is NOT a character. This method is not called if EOF is reached during syntactic predicate evaluation or during evaluation of normal lexical rules, which presumably would be an IOException. This traps the "normal" EOF condition. uponEOF() is called after the complete evaluation of the previous token and only if your parser asks for another token beyond that last non-EOF token. You might want to throw token or char stream exceptions like: "Heh, premature eof" or a retry stream exception ("I found the end of this file, go back to referencing file").
        Throws:
        TokenStreamException
        CharStreamException