Package sleep.parser

Class StringIterator


  • public class StringIterator
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int begin  
      protected int lineNo  
      protected java.util.LinkedList mark1  
      protected java.util.LinkedList mark2  
      protected int position  
      protected char[] text  
      protected java.lang.String texts  
    • Constructor Summary

      Constructors 
      Constructor Description
      StringIterator​(java.lang.String text)  
      StringIterator​(java.lang.String _text, int _lineNo)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getEntireLine()  
      Token getErrorToken()  
      int getLineMarker()  
      int getLineNumber()  
      boolean hasNext()
      check that there is another character out there for us to get
      boolean hasNext​(int n)
      check that there are at least n chars we can still get
      boolean isNextChar​(char n)  
      boolean isNextString​(java.lang.String n)  
      static void main​(java.lang.String[] args)  
      void mark()  
      char next()
      moves the iterator forward one char
      java.lang.String next​(int n)
      returns the string consisting of the next n characters.
      char peek()  
      java.lang.String reset()  
      void skip​(int n)
      does a direct skip of n characters, use only when you know what the chars are..
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • position

        protected int position
      • lineNo

        protected int lineNo
      • text

        protected char[] text
      • texts

        protected java.lang.String texts
      • begin

        protected int begin
      • mark1

        protected java.util.LinkedList mark1
      • mark2

        protected java.util.LinkedList mark2
    • Constructor Detail

      • StringIterator

        public StringIterator​(java.lang.String text)
      • StringIterator

        public StringIterator​(java.lang.String _text,
                              int _lineNo)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasNext

        public boolean hasNext()
        check that there is another character out there for us to get
      • hasNext

        public boolean hasNext​(int n)
        check that there are at least n chars we can still get
      • getLineNumber

        public int getLineNumber()
      • getErrorToken

        public Token getErrorToken()
      • getEntireLine

        public java.lang.String getEntireLine()
      • getLineMarker

        public int getLineMarker()
      • isNextString

        public boolean isNextString​(java.lang.String n)
      • isNextChar

        public boolean isNextChar​(char n)
      • peek

        public char peek()
      • skip

        public void skip​(int n)
        does a direct skip of n characters, use only when you know what the chars are.. this will not increment the line number counter
      • next

        public java.lang.String next​(int n)
        returns the string consisting of the next n characters.
      • next

        public char next()
        moves the iterator forward one char
      • mark

        public void mark()
      • reset

        public java.lang.String reset()
      • main

        public static void main​(java.lang.String[] args)