1
This commit is contained in:
@@ -236,6 +236,7 @@ pub fn lex(mut code: &str, use_whitespace: bool) -> Result<Vec<Token>, (LexerSta
|
|||||||
"\n" => {
|
"\n" => {
|
||||||
code = code.strip_prefix(fch.as_str()).expect("");
|
code = code.strip_prefix(fch.as_str()).expect("");
|
||||||
state.line += 1;
|
state.line += 1;
|
||||||
|
state.column = 0;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if inside_str > 0 || brvct.len() > 0 {
|
if inside_str > 0 || brvct.len() > 0 {
|
||||||
|
|||||||
+3
-1
@@ -82,7 +82,8 @@ impl Parser {
|
|||||||
ast_res.ast_type = AstType::FunctionDeceleration;
|
ast_res.ast_type = AstType::FunctionDeceleration;
|
||||||
}
|
}
|
||||||
self.index += 3;
|
self.index += 3;
|
||||||
} else if self.tokens.len()-index > 1 && token.value == "cb" && self.tokens[index+1].token_type == TokenType::Curly {
|
} else if self.tokens.len()-index > 1 {
|
||||||
|
if token.value == "cb" && self.tokens[index+1].token_type == TokenType::Curly {
|
||||||
ast_res.tokens.push(self.tokens[index+1].clone());
|
ast_res.tokens.push(self.tokens[index+1].clone());
|
||||||
ast_res.ast_type = AstType::CodeBlock;
|
ast_res.ast_type = AstType::CodeBlock;
|
||||||
self.index += 1;
|
self.index += 1;
|
||||||
@@ -96,6 +97,7 @@ impl Parser {
|
|||||||
self.index += 2;
|
self.index += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
TokenType::Include => {
|
TokenType::Include => {
|
||||||
if let Some(caps) = self.include_regex.captures(&token.value) {
|
if let Some(caps) = self.include_regex.captures(&token.value) {
|
||||||
ast_res.tokens.push(Token {token_type: TokenType::String, value: caps[2].to_owned().to_string(), line: 0, column: 0});
|
ast_res.tokens.push(Token {token_type: TokenType::String, value: caps[2].to_owned().to_string(), line: 0, column: 0});
|
||||||
|
|||||||
Reference in New Issue
Block a user