This commit is contained in:
Anuken
2021-01-05 11:17:20 -05:00
parent 68535bfcaa
commit 315cbaec47
2 changed files with 29 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ package mindustry.logic;
import arc.struct.*;
public class LParser{
Seq<LStatement> statements = new Seq<>();
char[] chars;
int position;
@@ -14,8 +15,34 @@ public class LParser{
return new LParser(text).parse();
}
void comment(){
//read until \n or eof
while(position < chars.length && chars[position++] != '\n');
}
void statement(){
//read jump
if(chars[position] == '['){
}
while(position < chars.length){
char c = chars[position ++];
//reached end of line, bail out.
if(c == '\n') break;
if(c == '#'){
comment();
break;
}
}
}
Seq<LStatement> parse(){
Seq<LStatement> statements = new Seq<>();
while(position < chars.length){
statement();
}
//TODO
return statements;
}