att.grappa
Class Lexer

java.lang.Object
  extended by att.grappa.Lexer

public class Lexer
extends java.lang.Object

A class for doing lexical analysis of dot formatted input.

Version:
1.2, ; Copyright 1996 - 2010 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Constructor Summary
Lexer(java.io.Reader input, java.io.PrintWriter error)
          Create an instance of Lexer that reads from input and sends error messages to error.
 
Method Summary
 void advance()
          Advance the scanner one character in the input stream.
 java.lang.String getLocation()
          Get the current location in the form "[line_number(character_offser)]".
static boolean id_char(char ch)
          Check if character is a valid id character;
static boolean id_char(int ch)
          Check if character is a valid id character;
 void init()
          Initialize internal tables and read two characters of input for look-ahead purposes.
 Symbol next_token(int debugLevel)
          Return one Symbol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Lexer

public Lexer(java.io.Reader input,
             java.io.PrintWriter error)
      throws java.lang.IllegalArgumentException
Create an instance of Lexer that reads from input and sends error messages to error.

Parameters:
input - input Reader object
error - error output Writer object
Throws:
java.lang.IllegalArgumentException - whenever input is null
Method Detail

init

public void init()
          throws java.io.IOException
Initialize internal tables and read two characters of input for look-ahead purposes.

Throws:
java.io.IOException - if advance() does
See Also:
advance()

advance

public void advance()
             throws java.io.IOException
Advance the scanner one character in the input stream. This moves next_char2 to next_char and then reads a new next_char2.

Throws:
java.io.IOException - whenever a problem reading from input is encountered

getLocation

public java.lang.String getLocation()
Get the current location in the form "[line_number(character_offser)]".

Returns:
info about the current position in the input

id_char

public static boolean id_char(int ch)
Check if character is a valid id character;

Parameters:
ch - the character in question.

id_char

public static boolean id_char(char ch)
Check if character is a valid id character;

Parameters:
ch - the character in question.

next_token

public Symbol next_token(int debugLevel)
                  throws java.io.IOException
Return one Symbol. This method is the main external interface to the scanner. It consumes sufficient characters to determine the next input Symbol and returns it.

Throws:
java.io.IOException - if advance() does


Grappa 1.2