diff --git a/.grit/patterns/js/curly.md b/.grit/patterns/js/curly.md index 929c1c03..5a1aaedb 100644 --- a/.grit/patterns/js/curly.md +++ b/.grit/patterns/js/curly.md @@ -10,10 +10,13 @@ engine marzano(1.0) language js or { - `if($_) $body`, + if_statement(consequence = $body), for_statement($body), while_statement($body), do_statement($body), + else_clause(else = $body) where { + $body <: ! if_statement() + } } where { $body <: not statement_block(), $body => `{$body}`, @@ -33,6 +36,23 @@ if (x > 0) { doStuff(); } ``` + +##else +```js +if (x > 0) + doStuff(); +else + console.log("e"); +``` +will become +```js +if (x > 0) { + doStuff(); +} else { + console.log("e"); +} +``` + ## for ```js for (var i = 0; i < 10; i++)