New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove comments from Lua code when bundle project #8187
Conversation
# Conflicts: # com.dynamo.cr/com.dynamo.cr.bob.test/src/com/dynamo/bob/pipeline/LuaScannerTest.java # com.dynamo.cr/com.dynamo.cr.bob/src/com/dynamo/bob/pipeline/LuaScanner.java
|
||
int linesInFile = file.split("\r\n|\r|\n").length; | ||
int linesAfterScanner = scanner.getParsedLua().split("\r\n|\r|\n").length; | ||
assertEquals(linesInFile, linesAfterScanner); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure that after processing, we keep the same count of code lines
for (String line : lines) { | ||
result.append(line.trim()).append("\n"); | ||
} | ||
return result.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using of this function is a bit tricky. It's easier to take into account spaces in expected results
ParseTreeWalker walker = new ParseTreeWalker(); | ||
walker.walk(this, parser.chunk()); | ||
String resultText = rewriter.getText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to include the first rewriter.getText()
call in TimeProfiler.
From documentation about rewriter:
https://www.antlr.org/api/JavaTool/org/antlr/v4/runtime/TokenStreamRewriter.html
You can insert stuff, replace, and delete chunks. Note that the operations are done lazily--only if you convert the buffer to a String with TokenStream.getText(). This is very efficient because you are not moving data around all the time. As the buffer of tokens is converted to strings, the getText() method(s) scan the input token stream and check to see if there is an operation at the current index. If so, the operation is done and then normal String rendering continues on the buffer. This is like having multiple Turing machine instruction streams (programs) operating on a single input tape. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Remove all the comments from Lua code in all Lua files (
*.lua
,*.script
etc) during the bundle process.PR checklist
Example of a well written PR description:
### Technical changes
Technical changes:
Technical notes: