use of me.itay.idemodthingy.languages.js.tokens.JSKeywordGroup in project IDEProgram by Itay2805.
the class IDELanguageJavaScript method parse.
@Override
public List<Token> parse(Project project, ProjectFile currentFile) {
List<Token> ret = new ArrayList<>();
String text = currentFile.getCode();
if (text.length() == 0) {
return ret;
}
String[] tokens = text.split(DELIMITER);
StringBuilder sb = new StringBuilder();
for (String token : tokens) {
if (text.contains("\"")) {
if (quote) {
quote = false;
ret.add(new DynamicToken(sb.toString()));
continue;
}
quote = true;
}
if (quote) {
sb.append(token);
continue;
}
if (JSKeywordGroup.getTokens().contains(token)) {
ret.add(new JSKeywordGroup());
continue;
}
if (lastToken.equals("function")) {
ret.add(new DynamicToken(text));
}
lastToken = text;
}
return ret;
}
Aggregations