Class Scanner

java.lang.Object
com.oracle.js.parser.Scanner
Direct Known Subclasses:
Lexer

public class Scanner extends Object
Utility for scanning thru a char array.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected char
    Current character in stream
    protected char
    1 character lookahead
    protected char
    2 character lookahead
    protected char
    3 character lookahead
    protected final String
    Characters to scan.
    protected final int
    Scan limit.
    protected int
    Current line number.
    protected int
    Position in content.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Scanner(String content, int line, int start, int length)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final boolean
    Returns true of scanner is at end of input
    protected final char
    charAt(int i)
    Get the ith character from the content.
    protected final void
    reset(int i)
    Reset to a character position.
    protected final void
    skip(int n)
    Skip ahead a number of characters.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • content

      protected final String content
      Characters to scan.
    • position

      protected int position
      Position in content.
    • limit

      protected final int limit
      Scan limit.
    • line

      protected int line
      Current line number.
    • ch0

      protected char ch0
      Current character in stream
    • ch1

      protected char ch1
      1 character lookahead
    • ch2

      protected char ch2
      2 character lookahead
    • ch3

      protected char ch3
      3 character lookahead
  • Constructor Details

    • Scanner

      protected Scanner(String content, int line, int start, int length)
      Constructor
      Parameters:
      content - content to scan
      line - start line number
      start - position index in content where to start
      length - length of input
  • Method Details

    • atEOF

      protected final boolean atEOF()
      Returns true of scanner is at end of input
      Returns:
      true if no more input
    • charAt

      protected final char charAt(int i)
      Get the ith character from the content.
      Parameters:
      i - Index of character.
      Returns:
      ith character or '\0' if beyond limit.
    • reset

      protected final void reset(int i)
      Reset to a character position.
      Parameters:
      i - Position in content.
    • skip

      protected final void skip(int n)
      Skip ahead a number of characters.
      Parameters:
      n - Number of characters to skip.