fix: bootstrap parser newline skipping + nexus compile errors
- Add tkNewLine skipping in bootstrap parser parsePrimary, parseUnary, parsePostfix - Fix nexus: req.String_Len(path) -> String_Len(req.path) - Fix nexus: bux_sb_append_char with char literal -> bux_sb_append with string
This commit is contained in:
@@ -198,7 +198,7 @@ func Http_ParseRequest(raw: String) -> HttpRequest {
|
|||||||
if bux_strlen(requestLine) > 0 {
|
if bux_strlen(requestLine) > 0 {
|
||||||
req.method = Http_ParseMethod(bux_str_split_part(requestLine, " ", 0));
|
req.method = Http_ParseMethod(bux_str_split_part(requestLine, " ", 0));
|
||||||
req.path = bux_str_split_part(requestLine, " ", 1);
|
req.path = bux_str_split_part(requestLine, " ", 1);
|
||||||
if String_Eq(req.path, "") || req.String_Len(path) == 0 {
|
if String_Eq(req.path, "") || String_Len(req.path) == 0 {
|
||||||
req.path = "/";
|
req.path = "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ func Http_BuildResponse(resp: HttpResponse) -> String {
|
|||||||
// Status line
|
// Status line
|
||||||
bux_sb_append(sb, "HTTP/1.1 ");
|
bux_sb_append(sb, "HTTP/1.1 ");
|
||||||
bux_sb_append_int(sb, resp.statusCode as int64);
|
bux_sb_append_int(sb, resp.statusCode as int64);
|
||||||
bux_sb_append_char(sb, ' ');
|
bux_sb_append(sb, " ");
|
||||||
bux_sb_append(sb, resp.statusText);
|
bux_sb_append(sb, resp.statusText);
|
||||||
bux_sb_append(sb, "\r\n");
|
bux_sb_append(sb, "\r\n");
|
||||||
|
|
||||||
|
|||||||
@@ -392,6 +392,8 @@ proc parseExpr(p: var Parser): Expr =
|
|||||||
p.parseAssign()
|
p.parseAssign()
|
||||||
|
|
||||||
proc parsePrimary(p: var Parser): Expr =
|
proc parsePrimary(p: var Parser): Expr =
|
||||||
|
while p.check(tkNewLine):
|
||||||
|
discard p.advance()
|
||||||
let loc = p.currentLoc
|
let loc = p.currentLoc
|
||||||
case p.peek()
|
case p.peek()
|
||||||
of tkIntLiteral, tkFloatLiteral, tkStringLiteral, tkCharLiteral, tkBoolLiteral:
|
of tkIntLiteral, tkFloatLiteral, tkStringLiteral, tkCharLiteral, tkBoolLiteral:
|
||||||
@@ -509,6 +511,8 @@ proc parsePrimary(p: var Parser): Expr =
|
|||||||
proc parsePostfix(p: var Parser): Expr =
|
proc parsePostfix(p: var Parser): Expr =
|
||||||
var left = p.parsePrimary()
|
var left = p.parsePrimary()
|
||||||
while true:
|
while true:
|
||||||
|
while p.check(tkNewLine):
|
||||||
|
discard p.advance()
|
||||||
let loc = p.currentLoc
|
let loc = p.currentLoc
|
||||||
case p.peek()
|
case p.peek()
|
||||||
of tkLParen:
|
of tkLParen:
|
||||||
@@ -605,6 +609,8 @@ proc parsePostfix(p: var Parser): Expr =
|
|||||||
return left
|
return left
|
||||||
|
|
||||||
proc parseUnary(p: var Parser): Expr =
|
proc parseUnary(p: var Parser): Expr =
|
||||||
|
while p.check(tkNewLine):
|
||||||
|
discard p.advance()
|
||||||
let loc = p.currentLoc
|
let loc = p.currentLoc
|
||||||
case p.peek()
|
case p.peek()
|
||||||
of tkBorrow:
|
of tkBorrow:
|
||||||
|
|||||||
Reference in New Issue
Block a user