Hi,
I have asked this question on Reddit, unfortunately I did not got a response back. So I will try my luck here:
I have SQL queries in Julia code and I want to add Syntax highlighting to them.
My SQL statements are prefixed_string_literal
nodes and the prefix: indentifier
is “sql”
In Julia it looks like this:
x = sql"""
select * from table
"""
The AST looks like this:
assignment_expression [3, 0] - [6, 3]
identifier [3, 0] - [3, 1]
operator [3, 2] - [3, 3]
prefixed_string_literal [3, 4] - [6, 3]
prefix: identifier [3, 4] - [3, 7]
…and I can capture everything with the following scheme query:
( assignment_expression
(
(prefixed_string_literal
prefix: (identifier) @prefix (#eq? @prefix "sql")
) @sql_query
)
) @sql
My problem is now that the prefix is part of the prefixed_string_literal
, but I think I only want the text in between the quotes. How do I achieve that?
I have tried adding this regex, but I get all sorts of errors (Vim:E866 and Vim:E871)
( assignment_expression
(
(prefixed_string_literal
prefix: (identifier) @prefix (#eq? @prefix "sql")
) @sql_query
)
(#match? @sql_query "\"{3}([\s\S]*?){3}\"")
) @sql
How do I add a regex and escape the quotes properly?
Can someone help me?
Thanks & Cheers,
Matt