DerekStride / tree-sitter-sql

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

Additional dollar quote support #217

Closed rliebz closed 1 year ago

rliebz commented 1 year 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 1 year ago

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

rliebz commented 1 year ago

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