From a47f773b7befeb2f2f6489fe222732233dd9a3ec Mon Sep 17 00:00:00 2001 From: Melvic Ybanez Date: Wed, 1 Nov 2023 19:45:33 +0800 Subject: [PATCH] Fix grammar doc --- README.md | 8 ++++---- src/main/scala/com/melvic/dry/parsers/ExprParser.scala | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1fa5834..1f18be8 100644 --- a/README.md +++ b/README.md @@ -197,9 +197,9 @@ The syntax of Dry should be familiar to Python and Scala developers. Here's the ::= "return" ? ";" ::= "import" (".")* ";" ::= | - ::= ( | ) "=" - ::= ("(" ( | ("," )*)? ")" | "." - | "[" "]")+ + ::= "=" + ::= ("(" ( | ("," )*)? ")" | "." | )* + ::= "[" "]" ::= (??)* ::= "lambda" | ::= "{" * "}" @@ -211,7 +211,7 @@ The syntax of Dry should be familiar to Python and Scala developers. Here's the ::= ("-" | "+" | "&" | "|" | "^" | "<<" | ">>" | ">>>" | "<=" )* ::= ("/" | "*" | "%" )* - ::= ("!" | "-" | "+" | "not") | + ::= ("!" | "-" | "+" | "not")* ::= | "self" | | | "(" ")" ::= "false" | "true" | "none" | | ::= "{" ( ("," )*)? "}" diff --git a/src/main/scala/com/melvic/dry/parsers/ExprParser.scala b/src/main/scala/com/melvic/dry/parsers/ExprParser.scala index 6c90806..f329eb2 100644 --- a/src/main/scala/com/melvic/dry/parsers/ExprParser.scala +++ b/src/main/scala/com/melvic/dry/parsers/ExprParser.scala @@ -20,7 +20,7 @@ private[parsers] trait ExprParser { _: Parser => assignment /** - * {{{ ::= ( | ) "=" }}} + * {{{ ::= "=" }}} */ def assignment: ParseResult[Expr] = { // parse the left value as a lambda to cover all possible expression (including chained `get`s) @@ -105,7 +105,7 @@ private[parsers] trait ExprParser { _: Parser => leftAssocBinary(_.unary, TokenType.Slash, TokenType.Star, TokenType.Modulo) /** - * {{{ ::= ("!" | "-" | "+") | }}} + * {{{ ::= ("!" | "-" | "+" | "not")* }}} */ def unary: ParseResult[Expr] = matchAny(TokenType.Not, TokenType.Minus, TokenType.Plus) @@ -117,8 +117,7 @@ private[parsers] trait ExprParser { _: Parser => /** * {{{ - * ::= ("(" ( | ("," )*)? ")" | "." - * | "[" "]")* + * ::= ("(" ( | ("," )*)? ")" | "." | )* * }}} */ def call: ParseResult[Expr] = {