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.*; import arc.struct.*;
public class LParser{ public class LParser{
Seq<LStatement> statements = new Seq<>();
char[] chars; char[] chars;
int position; int position;
@@ -14,8 +15,34 @@ public class LParser{
return new LParser(text).parse(); 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> parse(){
Seq<LStatement> statements = new Seq<>(); while(position < chars.length){
statement();
}
//TODO //TODO
return statements; return statements;
} }

View File

@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=5e9176c3feefa5ee2f14b08f82da1f01f790e64a archash=224199824e400942bc2da35fd6445720f135720d