Support inline comments (#4196)

* Support inline comments

Closes https://github.com/Anuken/Mindustry-Suggestions/issues/1698.

* Apply suggestions from code review

Co-authored-by: Patrick 'Quezler' Mounier <Quezler@me.com>

* Stick with Mindustry formatting style

Co-authored-by: Patrick 'Quezler' Mounier <Quezler@me.com>
This commit is contained in:
Lonami 2020-12-31 22:30:35 +01:00 committed by GitHub
parent ab19e6ffbd
commit 044fb30b1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,9 @@ public class LAssembler{
int index = 0;
for(String line : lines){
//comments
if(line.startsWith("#") || line.isEmpty()) continue;
int commentIdx = line.indexOf('#');
if(commentIdx != -1) line = line.substring(0, commentIdx).trim();
if(line.isEmpty()) continue;
//remove trailing semicolons in case someone adds them in for no reason
if(line.endsWith(";")) line = line.substring(0, line.length() - 1);