public class Main
extends java.lang.Object
This class creates a lexical analyzer and feeds him with the entries of the user.
LexicalAnalyzer
Constructor and Description |
---|
Main() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
espaceChar(java.lang.String input)
Escapes special characters by placing them inside
rackets.
|
static void |
main(java.lang.String[] args)
Executed method.
|
private static java.lang.String |
unEscpaceChar(java.lang.String input)
Un-escape the special characters
|
public static void main(java.lang.String[] args)
Executed method.
This method creates the lexical analyzer, then ask the user to enter S-COBOL code lines. It feeds them to the analyzer until the user enters an empty String (by simply hitting the return key without entering anything). After each line of code, the method prints the tokens found in the line by the analyzer or notify the user of the failure of the analysis. When the user stops entering code, the method asks the analyzer to print the table of symbols on the standard output.
args
- LexicalAnalyzer.nextToken(String, boolean, int)
,
LexicalAnalyzer.printSymbolsTable()
private static java.lang.String unEscpaceChar(java.lang.String input)
Un-escape the special characters
Removes the brackets around the special characters so that the working String can be subtracted to the main String being analyzed.
input
- String containing special characters previously escaped.private static java.lang.String espaceChar(java.lang.String input)
Escapes special characters by placing them inside rackets.
This is to avoid confusion the string is used in regular expressions.
input
- String containing the characters to escape.