Below is my code that requires the user to input HTML code, which displays the token ID's:
Expand|Select|Wrap|Line Numbers
- import java.io.*;
- public class Test {
- public static void main (String[] args) throws Exception {
- // prompt the user to enter their Noddy HTML text
- System.out.print("Enter your Noddy HTML Text: ");
- // open up standard input
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- Arithmetic lexer = new Arithmetic(br);
- Symbol s;
- do
- {
- s = lexer.next_token();
- System.out.println(s);
- }
- while (s.id != SymbolId.EOF);
- }
- }
Expand|Select|Wrap|Line Numbers
- import java.io.*;
- public class Test {
- public static void main (String[] args) throws Exception {
- final FileReader inputFile = new FileReader("TestFile.txt");
- final BufferedReader inputBuffer = new BufferedReader(inputFile);
- String line = inputBuffer.readLine();
- System.out.println(line);
- NoddyHTML lexer = new NoddyHTML(inputBuffer);
- Symbol s;
- do
- {
- s = lexer.next_token();
- System.out.println(s);
- }
- while (s.id != SymbolId.EOF);
- }
- }
Any help would be greatly appreciated. Thanks.