Skip to content

Commit

Permalink
Update grammar to be more precise wrt lists
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Dec 24, 2024
1 parent fadba1d commit a931eda
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +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
queryOperationName.identifier.headOption match {
queryOperationName.identifier.flatMap(_.qualified_identifier) match {
case Some(explicitRef) => resolveExplicitTs(serviceIndex, explicitRef, opName)

case None => resolveImplicitTs(opName, serviceIndex, useClauses)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ object CompletionProvider {
// includes the current query's service reference
// as it wouldn't result in ading a use clause
val presentServiceIdentifiers = {
q.select(_.operation_name.identifier) ++
q.select(_.operation_name.identifier.qualified_identifier) ++
sf.select(_.prelude.use_clause.identifier)
}.flatMap(ASTAdapter.decodeQI)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions tree-sitter-smithyql/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ module.exports = grammar({
field("selection", $.identifier)
),

operation_name_qualifier: ($) => seq($.qualified_identifier, "."),

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

Expand Down

0 comments on commit a931eda

Please sign in to comment.