tgl.compiler
クラス Lexer

java.lang.Object
  上位を拡張 tgl.compiler.Lexer
すべての実装されたインタフェース:
java_cup.runtime.Scanner

public class Lexer
extends java.lang.Object
implements java_cup.runtime.Scanner

This class is a lexer for TGL compiler.


フィールドの概要
(package private)  CompileErrorHandler handler
           
(package private)  java.lang.StringBuffer string
           
static int YYEOF
          This character denotes the end of file
static int YYINITIAL
          lexical states
 
コンストラクタの概要
Lexer(java.io.InputStream in)
          Creates a new scanner.
Lexer(java.io.Reader in)
          Creates a new scanner There is also a java.io.InputStream version of this constructor.
 
メソッドの概要
 java_cup.runtime.Symbol next_token()
          Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs.
 void setErrorHandler(CompileErrorHandler h)
           
 void yybegin(int newState)
          Enters a new lexical state
 char yycharat(int pos)
          Returns the character at position pos from the matched text.
 void yyclose()
          Closes the input stream.
 int yylength()
          Returns the length of the matched text region.
 void yypushback(int number)
          Pushes the specified amount of characters back into the input stream.
 void yyreset(java.io.Reader reader)
          Resets the scanner to read from a new input stream.
 int yystate()
          Returns the current lexical state.
 java.lang.String yytext()
          Returns the text matched by the current regular expression.
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

YYEOF

public static final int YYEOF
This character denotes the end of file

関連項目:
定数フィールド値

YYINITIAL

public static final int YYINITIAL
lexical states

関連項目:
定数フィールド値

string

java.lang.StringBuffer string

handler

CompileErrorHandler handler
コンストラクタの詳細

Lexer

public Lexer(java.io.Reader in)
Creates a new scanner There is also a java.io.InputStream version of this constructor.

パラメータ:
in - the java.io.Reader to read input from.

Lexer

public Lexer(java.io.InputStream in)
Creates a new scanner. There is also java.io.Reader version of this constructor.

パラメータ:
in - the java.io.Inputstream to read input from.
メソッドの詳細

setErrorHandler

public void setErrorHandler(CompileErrorHandler h)

yyclose

public final void yyclose()
                   throws java.io.IOException
Closes the input stream.

例外:
java.io.IOException

yyreset

public final void yyreset(java.io.Reader reader)
Resets the scanner to read from a new input stream. Does not close the old reader. All internal variables are reset, the old input stream cannot be reused (internal buffer is discarded and lost). Lexical state is set to ZZ_INITIAL.

パラメータ:
reader - the new input stream

yystate

public final int yystate()
Returns the current lexical state.


yybegin

public final void yybegin(int newState)
Enters a new lexical state

パラメータ:
newState - the new lexical state

yytext

public final java.lang.String yytext()
Returns the text matched by the current regular expression.


yycharat

public final char yycharat(int pos)
Returns the character at position pos from the matched text. It is equivalent to yytext().charAt(pos), but faster

パラメータ:
pos - the position of the character to fetch. A value from 0 to yylength()-1.
戻り値:
the character at position pos

yylength

public final int yylength()
Returns the length of the matched text region.


yypushback

public void yypushback(int number)
Pushes the specified amount of characters back into the input stream. They will be read again by then next call of the scanning method

パラメータ:
number - the number of characters to be read again. This number must not be greater than yylength()!

next_token

public java_cup.runtime.Symbol next_token()
                                   throws java.io.IOException
Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs.

定義:
インタフェース java_cup.runtime.Scanner 内の next_token
戻り値:
the next token
例外:
java.io.IOException - if any I/O-Error occurs