jeops.compiler.parser
Class Scanner

java.lang.Object
  |
  +--jeops.compiler.parser.Scanner

public class Scanner
extends java.lang.Object
implements TokenConstants

Class used in the parsing of the rules file. It's the first step in the converting of the rules into Java classes.

Version:
0.01 04.01.2000
Author:
Carlos Figueira Filho (csff@di.ufpe.br)

Fields inherited from interface jeops.compiler.parser.TokenConstants
ACTIONS, ASTERISK, CLOSE_CURLY_BRACKET, COMMA, COMMENT, DECLARATIONS, DOT, EOF, EQUALS, ERROR, EXTENDS, IDENT, IMPORT, LOCALDECL, NONE_ABOVE, OPEN_CURLY_BRACKET, PACKAGE, PRECONDITIONS, PUBLIC, RULE, RULE_BASE, SEMICOLON, STRING, WHITE_SPACE
 
Constructor Summary
Scanner(java.lang.String ruleFileName)
          Class constructor.
 
Method Summary
 int getCurrentColumn()
          Returns the current column from the file.
 int getCurrentLine()
          Returns the current line from the file.
 Token getLastNonWhiteSpaceToken()
          Returns the last non-whitespace token.
static void main(java.lang.String[] args)
          Test method for this class.
 Token nextToken()
          Returns the next token from the file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scanner

public Scanner(java.lang.String ruleFileName)
        throws java.io.IOException
Class constructor.
Parameters:
ruleFileName - the name of the rules file.
Throws:
java.io.IOException - if some IO error occurs.
Method Detail

getCurrentLine

public int getCurrentLine()
Returns the current line from the file.
Returns:
the current line from the file.

getCurrentColumn

public int getCurrentColumn()
Returns the current column from the file.
Returns:
the current column from the file.

getLastNonWhiteSpaceToken

public Token getLastNonWhiteSpaceToken()
Returns the last non-whitespace token. A whitespace token is one whose type is COMMENT or WHITE_SPACE.
Returns:
the last non-whitespace token.

nextToken

public Token nextToken()
                throws java.io.IOException
Returns the next token from the file.
Returns:
the next token from the file.
Throws:
java.io.IOException - if some IO error occurs.

main

public static void main(java.lang.String[] args)
Test method for this class.
Parameters:
args - command-line arguments. None is needed, but one can pass the rule file name for the scanning.