fix: function body comments.
This commit is contained in:
@@ -153,7 +153,7 @@ public class Parser {
|
||||
Node pn = nf.createBlock(ts.tokenPosition);
|
||||
try {
|
||||
int tt;
|
||||
while ((tt = ts.peekToken()) > TokenStream.EOF && tt != TokenStream.RC) {
|
||||
while ((tt = ts.peekTokenWithComment()) > TokenStream.EOF && tt != TokenStream.RC) {
|
||||
if (tt == TokenStream.FUNCTION) {
|
||||
ts.getToken();
|
||||
pn.addChildToBack(function(ts, false));
|
||||
|
||||
@@ -536,13 +536,19 @@ public class TokenStream {
|
||||
}
|
||||
|
||||
public int peekToken() throws IOException {
|
||||
int result = getToken();
|
||||
return peekTokenHelper(getToken());
|
||||
}
|
||||
|
||||
this.pushbackToken = result;
|
||||
public int peekTokenWithComment() throws IOException {
|
||||
return peekTokenHelper(getTokenWithComment());
|
||||
}
|
||||
|
||||
private int peekTokenHelper(int token) throws IOException {
|
||||
this.pushbackToken = token;
|
||||
lastPosition = secondToLastPosition;
|
||||
lastTokenPosition = tokenPosition;
|
||||
tokenno--;
|
||||
return result;
|
||||
return token;
|
||||
}
|
||||
|
||||
public int peekTokenSameLine() throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user