This commit is contained in:
Anuken
2020-08-16 23:30:49 -04:00
parent 91c1c004c7
commit 0fe8836db4
7 changed files with 31 additions and 21 deletions

View File

@@ -83,22 +83,29 @@ public class LAssembler{
if(index++ > max) break;
try{
//yes, I am aware that this can be split with regex, but that's slow and even more incomprehensible
Seq<String> tokens = new Seq<>();
boolean inString = false;
int lastIdx = 0;
String[] arr;
for(int i = 0; i < line.length() + 1; i++){
char c = i == line.length() ? ' ' : line.charAt(i);
if(c == '"'){
inString = !inString;
}else if(c == ' ' && !inString){
tokens.add(line.substring(lastIdx, i).replace("\\n", "\n"));
lastIdx = i + 1;
//yes, I am aware that this can be split with regex, but that's slow and even more incomprehensible
if(line.contains(" ")){
Seq<String> tokens = new Seq<>();
boolean inString = false;
int lastIdx = 0;
for(int i = 0; i < line.length() + 1; i++){
char c = i == line.length() ? ' ' : line.charAt(i);
if(c == '"'){
inString = !inString;
}else if(c == ' ' && !inString){
tokens.add(line.substring(lastIdx, i).replace("\\n", "\n"));
lastIdx = i + 1;
}
}
arr = tokens.toArray(String.class);
}else{
arr = new String[]{line};
}
String[] arr = tokens.toArray(String.class);
LStatement st = LogicIO.read(arr);
if(st != null){
statements.add(st);