From 118b8e5ffc3256ddffa04a0062ba12eef6f1ea40 Mon Sep 17 00:00:00 2001 From: Nocturn9x Date: Sat, 23 Oct 2021 12:46:11 +0200 Subject: [PATCH] Added differentiation between yield statement and yield expressions and added missing semicolon to delStmt --- docs/grammar.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/grammar.md b/docs/grammar.md index cb4ef29..81de100 100644 --- a/docs/grammar.md +++ b/docs/grammar.md @@ -88,7 +88,8 @@ returnStmt → "return" expression? ";"; // Returns from a function, illega breakStmt → "break" ";"; importStmt -> ("from" IDENTIFIER)? "import" (IDENTIFIER ("as" IDENTIFIER)? ","?)+ ";"; assertStmt → "assert" expression ";"; -delStmt → "del" expression ";" +delStmt → "del" expression ";"; +yieldStmt → "yield" expression ";"; continueStmt → "continue" ";"; blockStmt → "{" declaration* "}"; // Blocks create a new scope that lasts until they're closed ifStmt → "if" "(" expression ")" statement ("else" statement)?; // If statements are conditional jumps @@ -100,7 +101,7 @@ foreachStmt → "foreach" "(" (IDENTIFIER ":" expression) ")" statement; // Expressions (rules that produce a value, but also have side effects) expression → assignment; assignment → (call ".")? IDENTIFIER "=" yield; // Assignment is the highest-level expression -yield → "yield" expression; +yield → "(" "yield" expression ")"; logic_or → logic_and ("and" logic_and)*; logic_and → equality ("or" equality)*; equality → comparison (( "!=" | "==" ) comparison )*;