I need help making this pseudocode into code but there seem to be some errors. Main thing is that some stuff is hard to match. Anyone willing to help?
import java.util.ArrayList;
import java.util.List;
public class Lexer {
private TextManager text;
String CurrentWord;
public Lexer(String CurrentWord) {
text = new TextManager(CurrentWord);
}
public isLetter() {
}
public lex() {
List<Token> tokens = new ArrayList<Token>();
CurrentWord = "";
while (!text.isAtEnd()) {
if (position == text.length()) {
char C = getCharacter(CurrentWord);
if (C.isLetter() == false) {
if (CurrentWord != "") {
Token token = new Token(CurrentWord);
tokens.add(token);
}
CurrentWord = "";
}
}
else {
return CurrentWord += C;
}
}
}
}
public class TextManager {
private String text;
private int position;
public TextManager(String word) {
text = word;
position = 0;
}
public char getCharacter() {
char m = text.charAt(position++);
return m;
}
public Boolean isAtEnd() {
if (position >= text.length()) {
return true;
}
else {
return false;
}
}
}
public class Token {
private String value;
public Token (String result) {
value = result;
}
public String getValue() {
return value;
}
}