pascalinterpreter.analysis
Class Analyser
java.lang.Object
pascalinterpreter.analysis.Analyser
- public class Analyser
- extends java.lang.Object
Field Summary |
private static int |
ASCII__
|
private static int |
ASCII_0
|
private static int |
ASCII_9
|
private static int |
ASCII_a
|
private static int |
ASCII_A
|
private static int |
ASCII_z
|
private static int |
ASCII_Z
|
(package private) static int |
BEGIN
|
private Code |
code
|
(package private) static int |
CONST
|
(package private) static int |
DISPOSE
|
(package private) static int |
DO
|
(package private) static int |
ELSE
|
(package private) static int |
END
|
(package private) static int |
FOR
|
(package private) static int |
IF
|
private static java.lang.String[] |
keywords
|
private Line |
line
|
private java.lang.StringBuffer |
lineTextBuffer
|
(package private) static int |
NEW
|
(package private) static int |
PROGRAM
|
(package private) static int |
READ
|
(package private) static int |
READLN
|
private int |
section
|
(package private) static int |
THEN
|
(package private) static int |
TO
|
(package private) static int |
VAR
|
(package private) static int |
WHILE
|
(package private) static int |
WRITE
|
(package private) static int |
WRITELN
|
Constructor Summary |
Analyser(java.lang.String text)
Metoda powoduje załadowanie kodu programu, oraz jego wstępną obróbkę w obiekcie Code. |
Method Summary |
private void |
checkDeclarSection()
|
(package private) int |
getActualLineNo()
|
(package private) static java.lang.String |
getKeyword(int keyword)
|
java.lang.String |
getLine()
|
(package private) boolean |
isAssignOperator(java.lang.String text)
|
(package private) boolean |
isBinaryOperatorExceptAssign(java.lang.String text)
|
static boolean |
isKeyword(java.lang.String word)
|
(package private) boolean |
isRelOperator(java.lang.String text)
Metoda sprawdza, czy przekazany tekst zawierasymbole operatora relacji. |
(package private) boolean |
isType(java.lang.String text)
|
(package private) static boolean |
isVal(java.lang.String text)
|
static boolean |
isValidID(java.lang.String word)
Metoda sprawdza czy przekazane słowo może być poprawnym identyfikatorem zmiennej. |
private boolean |
isVarOrVal(java.lang.String text)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lineTextBuffer
private java.lang.StringBuffer lineTextBuffer
line
private Line line
section
private int section
ASCII_A
private static final int ASCII_A
- See Also:
- Constant Field Values
ASCII_Z
private static final int ASCII_Z
- See Also:
- Constant Field Values
ASCII_a
private static final int ASCII_a
- See Also:
- Constant Field Values
ASCII_z
private static final int ASCII_z
- See Also:
- Constant Field Values
ASCII_0
private static final int ASCII_0
- See Also:
- Constant Field Values
ASCII_9
private static final int ASCII_9
- See Also:
- Constant Field Values
ASCII__
private static final int ASCII__
- See Also:
- Constant Field Values
code
private Code code
PROGRAM
static final int PROGRAM
- See Also:
- Constant Field Values
CONST
static final int CONST
- See Also:
- Constant Field Values
VAR
static final int VAR
- See Also:
- Constant Field Values
BEGIN
static final int BEGIN
- See Also:
- Constant Field Values
END
static final int END
- See Also:
- Constant Field Values
IF
static final int IF
- See Also:
- Constant Field Values
THEN
static final int THEN
- See Also:
- Constant Field Values
ELSE
static final int ELSE
- See Also:
- Constant Field Values
WHILE
static final int WHILE
- See Also:
- Constant Field Values
DO
static final int DO
- See Also:
- Constant Field Values
FOR
static final int FOR
- See Also:
- Constant Field Values
TO
static final int TO
- See Also:
- Constant Field Values
NEW
static final int NEW
- See Also:
- Constant Field Values
DISPOSE
static final int DISPOSE
- See Also:
- Constant Field Values
READLN
static final int READLN
- See Also:
- Constant Field Values
READ
static final int READ
- See Also:
- Constant Field Values
WRITELN
static final int WRITELN
- See Also:
- Constant Field Values
WRITE
static final int WRITE
- See Also:
- Constant Field Values
keywords
private static final java.lang.String[] keywords
Analyser
public Analyser(java.lang.String text)
throws AnalyseException
- Metoda powoduje załadowanie kodu programu, oraz jego wstępną obróbkę w obiekcie Code.
- Throws:
AnalyseException
- wyjątek generowany w przypadku "niesparowanych" znaków komentarzy w programie.
getLine
public java.lang.String getLine()
throws InternalException,
AnalyseException
- Throws:
InternalException
AnalyseException
isKeyword
public static boolean isKeyword(java.lang.String word)
getKeyword
static java.lang.String getKeyword(int keyword)
isValidID
public static boolean isValidID(java.lang.String word)
- Metoda sprawdza czy przekazane słowo może być poprawnym identyfikatorem zmiennej.
- Parameters:
word
- - sprawdzane słowo.
- Returns:
- Tru, jeśli poprawny identyfikator - w przeciwnym razie false.
isRelOperator
boolean isRelOperator(java.lang.String text)
- Metoda sprawdza, czy przekazany tekst zawierasymbole operatora relacji.
- Parameters:
text
- Sprawdzany tekst.
- Returns:
- True, jeśli tekst to operator relacji, jeśli nie to false.
isVal
static boolean isVal(java.lang.String text)
isVarOrVal
private boolean isVarOrVal(java.lang.String text)
isAssignOperator
boolean isAssignOperator(java.lang.String text)
checkDeclarSection
private void checkDeclarSection()
throws AnalyseException
- Throws:
AnalyseException
isType
boolean isType(java.lang.String text)
isBinaryOperatorExceptAssign
boolean isBinaryOperatorExceptAssign(java.lang.String text)
getActualLineNo
int getActualLineNo()