-
Notifications
You must be signed in to change notification settings - Fork 5
ScriptLauncher
The ScriptLauncher class is used as a main class for the program, and is located in the interpreter package. The only method is the main method, which is executed upon running the program. The purpose of the class is to allow the program to function. The procedure it follows includes determining the script's name and location and creating a BufferedReader to read the file.
The input for the method, String[] args, which is supplied when running from a command prompt, is used to determine the file's location, although it is not needed. The first index (index 0) is always the filename. If you do not want to use script.txt, it can be specified. The second index (index 1) is always the directory of the file. If it is not with the .JAR file, this should be used. Keep in mind that neither of these are used, although it will always look for script.txt in the directory of the .JAR file if nothing is specified. If running from an IDE, the debugLocation variable must be changed in the code manually in order to tell the program where the file is located.
After creating the BufferedReader, the program will use a while loop to read each line of the program, which is done by calling the BufferedReader class's readLine() method. Each line that is read is sent to the Interpreter class's interpretLine() method, which interprets and executes the user's code. After each line is read, the program will read a value of null, which will break the while loop and end the program.
Home | About | Help Guide | SQSL | Created by Christopher Hittner