Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Jan 3, 2024
1 parent 122b4cb commit a4bf4a2
Show file tree
Hide file tree
Showing 11 changed files with 6,476 additions and 3,097 deletions.
22 changes: 10 additions & 12 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = grammar({
choice(
seq(
"set",
field("name", $.NAME),
field("setting_name", $.NAME),
field("right", optional(seq(":=", choice($.boolean, $.settinglist)))),
$.eol,
),
Expand All @@ -63,7 +63,7 @@ module.exports = grammar({
"[",
// field("lang", $.string),
'"',
field("lang", $.NAME),
seq(field("lang", $.NAME), optional(/.*/)),
'"',
repeat(seq(optional(","), $.string)),
"]",
Expand Down Expand Up @@ -107,19 +107,19 @@ module.exports = grammar({
"if",
$.condition,
"{",
field("if_body", $.expression),
field("if_block", $.expression),
"}",
repeat(
seq(
"else",
"if",
$.condition,
"{",
field("else_if_body", $.expression),
field("else_if_block", $.expression),
"}",
),
),
optional(seq("else", "{", field("else_body", $.expression), "}")),
optional(seq("else", "{", field("else_block", $.expression), "}")),
),

// condition : expression '==' expression
Expand Down Expand Up @@ -166,15 +166,14 @@ module.exports = grammar({

// recipe : attribute? '@'? NAME parameter* variadic_parameters? ':' dependency* body?
recipe: ($) =>
seq(optional($.attribute), $.recipeheader, $.NEWLINE, optional($.body)),
seq(optional($.attribute), $.recipe_header, $.eol, optional($.body)),

recipeheader: ($) =>
recipe_header: ($) =>
seq(
optional("@"),
$.NAME,
optional($.parameters),
":",
optional(" "),
optional($.dependencies),
),

Expand All @@ -192,8 +191,7 @@ module.exports = grammar({

// variadic_parameters : '*' parameter
// | '+' parameter
variadic_parameters: ($) =>
choice(seq("*", $.parameter), seq("+", $.parameter)),
variadic_parameters: ($) => seq(choice("*", "+"), $.parameter),

dependencies: ($) => repeat1($.dependency),

Expand Down Expand Up @@ -236,11 +234,11 @@ module.exports = grammar({
$.notcomment,
// repeat(choice($.interpolation, $.notinterpolation)),
repeat(choice($.interpolation, $.TEXT)),
$.NEWLINE,
$.eol,
),
// notcomment: ($) => /[^#\s{]\S*/,
notcomment: ($) => /[^#\s]\S*/,
comment: ($) => seq(/#[^!].*/, /.*/, $.NEWLINE),
comment: ($) => seq("#", choice($.NEWLINE, seq(/[^!].*/, $.NEWLINE))),

// notinterpolation: ($) => /[^{][^{]\S*/,
notinterpolation: ($) => /[^\s{][^\s{]\S*/,
Expand Down
Loading

0 comments on commit a4bf4a2

Please sign in to comment.