Compare commits

..

No commits in common. "f203da328b5e1af80360dafa1b5439600aa0cbdc" and "26871aa9aed93b5e35a5824ab9eba9f1906e41e9" have entirely different histories.

3 changed files with 7 additions and 41 deletions

View file

@ -422,9 +422,7 @@ fn statement_let(p: &mut CParser) {
p.expect(TokenKind::Identifier, "expected a name for the variable");
p.expect(TokenKind::Equal, "expected a '=' after the variable name");
expression(p);
if !p.at(TokenKind::RightBrace) {
p.expect(TokenKind::Semicolon, "expect ';' to end a let statement");
}
p.end(m, TreeKind::LetStatement);
}
@ -438,9 +436,7 @@ fn statement_return(p: &mut CParser) {
"expect 'return' to start a return statement",
);
expression(p);
if !p.at(TokenKind::RightBrace) {
p.expect(TokenKind::Semicolon, "expect ';' to end a return statement");
}
p.end(m, TreeKind::ReturnStatement);
}
@ -449,12 +445,10 @@ fn statement_expression(p: &mut CParser) {
let m = p.start();
expression(p);
if !p.at(TokenKind::RightBrace) {
p.expect(
TokenKind::Semicolon,
"expect ';' to end an expression statement",
);
}
p.end(m, TreeKind::ExpressionStatement);
}

View file

@ -2,13 +2,13 @@ use fine::parser::concrete::Tree;
use pretty_assertions::assert_eq;
fn rebase_concrete(source_path: &str, dump: &str) {
// RE-BASE
let contents = std::fs::read_to_string(source_path)
.expect(&format!("unable to read input file {}", source_path));
let mut result = String::new();
let mut lines = contents.lines();
// Search for the "concrete:" section.
let mut found_concrete_section = false;
while let Some(line) = lines.next() {
result.push_str(line);
@ -26,8 +26,6 @@ fn rebase_concrete(source_path: &str, dump: &str) {
);
}
// We've found the section we care about, replace all the lines we care
// about with the actual lines.
let mut replaced_output = false;
while let Some(line) = lines.next() {
if line.starts_with("// | ") {

View file

@ -1,26 +0,0 @@
// concrete:
// | File
// | IfStatement
// | ConditionalExpression
// | If:'"if"'
// | LiteralExpression
// | True:'"true"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | LiteralExpression
// | String:'"\"discarded\""'
// | Semicolon:'";"'
// | ExpressionStatement
// | LiteralExpression
// | Number:'"23"'
// | RightBrace:'"}"'
// | Else:'"else"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | LiteralExpression
// | Number:'"45"'
// | RightBrace:'"}"'
//
if true { "discarded"; 23 } else { 45 }