DerekStride / tree-sitter-sql

SQL grammar for tree-sitter
http://derek.stride.host/tree-sitter-sql/
MIT License
147 stars 47 forks source link

Additional dollar quote support #217

Closed rliebz closed 10 months ago

rliebz commented 10 months ago

Using Postgres syntax, I've found a couple situations where valid dollar quote syntax is not parsed correctly.

One is that dollar quotes do not seem to be respected in COMMENT statements:

COMMENT ON SCHEMA "my_schema"
  IS $$My Schema Comment$$;

Based on my read of the Postgres docs, I would assume dollar-quoted strings are valid anywhere regular strings are. I'm not sure what other situations this would pop up in, but it might not be an issue particular to comment statements.

The other is that the optional tags do not seem to be supported. For example, this works:

CREATE FUNCTION foo(TEXT)
RETURNS BOOLEAN
LANGUAGE SQL
AS $$
  RETURN TRUE
$$;

But this equivalent function does not:

CREATE FUNCTION foo(TEXT)
RETURNS BOOLEAN
LANGUAGE SQL
AS $function$
  RETURN TRUE
$function$;
antoineB commented 10 months ago

Hello I suspect you haven't run the make compile command the file parser.c is not up to date.

rliebz commented 10 months ago

You're so right. Appreciate the quick response and apologies for the false alarm.