reading
I ran the code on eclipse but the text file isn't reading as tokens? Please run the same code on eclipse and take screenshots of the code and the text file being read as tokens.
To address these points and ensure your code follows good practices, let's break it down:
Code Style:
Some good naming, some necessary comments (3)
Unit Tests:
At least one (3)
Main:
At least one of: Exists, reads file with GetAllBytes, calls lex, prints tokens (3)
Token class:
Has enum and string members (3)
Exists, members correct constructor correct (6)
String Handler:
Exists and holds string and index (3)
Lexer class:
Lexer- constructor (3)
Exists and loops over the string (3)
Two of: Accepts required characters, creates a token, doesn't accept characters it shouldn't (6)
Lexer - ProcessWord and ProcessNumber:
Accepts required characters, creates a token, doesn't accept characters it shouldn't (10)
Overall Lexing Process:
Exists, loops over the string, returns a LinkedList of tokens (6)
Skips appropriate values, calls ProcessWord and ProcessNumber, and adds their return values to the list (10)
To improve your code according to this checklist:
Make sure to use meaningful variable and method names.
Add comments where necessary, especially for complex logic and methods.
Write unit tests for your code to ensure it functions as expected.
Implement the required classes and methods, such as Lexer, Token, and StringHandler, according to the provided specifications.
Ensure that the lexing process follows the rules outlined in the original question.
Test your lexer with various input cases to verify its correctness.
If you have any specific questions or need assistance with a particular part of your code, feel free to ask
for help with that specific aspect.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps