Skip to content

Commit

Permalink
tiny grammar cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Nov 12, 2024
1 parent d3fc988 commit 88ce227
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object MultiServiceResolver {
): EitherNel[CompilationError, QualifiedIdentifier] =
queryOperationName.name match {
case Some(opName) =>
// todo: this should be an option in codegen. might be a bad grammar
// todo: this should be an Option in codegen. might be a bad grammar
queryOperationName.identifier.headOption match {
case Some(explicitRef) => resolveExplicitTs(serviceIndex, explicitRef, opName)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 9 additions & 7 deletions tree-sitter-smithyql/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,22 @@ module.exports = grammar({
field("input", $.struct)
),

_namespace: ($) => seq($.identifier, repeat(seq(".", $.identifier))),

qualified_identifier: ($) =>
seq(
field("namespace", seq($.identifier, repeat(seq(".", $.identifier)))),
field("namespace", $._namespace),
"#",
field("selection", $.identifier)
),

query_operation_name: ($) =>
prec.left(
1,
seq(
field("identifier", optional(seq($.qualified_identifier, "."))),
field("name", $.operation_name)
)
seq(
field(
"identifier",
optional(prec.left(seq($.qualified_identifier, ".")))
),
field("name", $.operation_name)
),

operation_name: ($) => $.identifier,
Expand Down

0 comments on commit 88ce227

Please sign in to comment.