[prql] fix double quoted string highlighting

master
Tim Stack 1 month ago
parent 572c758dcc
commit e71ec01ac3

@ -4634,20 +4634,11 @@ from *table*
.. code-block:: custsqlite
;from db.http_status_codes | take 3
✘ error: failed to compile SQL statement
reason: no such table: db.http_status_codes
--> command:1
| SELECT
| *
| FROM
| db.http_status_codes
| LIMIT
| 3
|
| -- Generated by PRQL compiler version:0.11.5 target:sql.sqlite (https://prql-lang.org)
|
;from http_status_codes | take 3
status message
100 Continue
101 Switchi⋯otocols
102 Processing
To use an array literal as a source:

@ -280,9 +280,7 @@ readline_sqlite_highlighter_int(attr_line_t& al, int x, line_range sub)
|| attr.sa_type == &lnav::sql::PRQL_NUMBER_ATTR)
{
alb.overlay_attr(lr, VC_ROLE.value(role_t::VCR_NUMBER));
} else if (attr.sa_type == &SQL_STRING_ATTR
|| attr.sa_type == &lnav::sql::PRQL_STRING_ATTR)
{
} else if (attr.sa_type == &SQL_STRING_ATTR) {
if (lr.length() > 1 && al.al_string[lr.lr_end - 1] == '\'') {
alb.overlay_attr(lr, VC_ROLE.value(role_t::VCR_STRING));
} else {
@ -291,6 +289,8 @@ readline_sqlite_highlighter_int(attr_line_t& al, int x, line_range sub)
alb.overlay_attr_for_char(lr.lr_start,
VC_ROLE.value(role_t::VCR_ERROR));
}
} else if (attr.sa_type == &lnav::sql::PRQL_STRING_ATTR) {
alb.overlay_attr(lr, VC_ROLE.value(role_t::VCR_STRING));
} else if (attr.sa_type == &SQL_OPERATOR_ATTR
|| attr.sa_type == &lnav::sql::PRQL_OPERATOR_ATTR)
{

@ -485,7 +485,7 @@ static readline_context::command_t sql_commands[] = {
.with_parameter({"table", "The table to use as a source"})
.with_example({
"To pull data from the 'http_status_codes' database table",
"from db.http_status_codes | take 3",
"from http_status_codes | take 3",
help_example::language::prql,
})
.with_example({

@ -1397,7 +1397,7 @@ annotate_prql_statement(attr_line_t& al)
&PRQL_STRING_ATTR,
},
{
lnav::pcre2pp::code::from_const(R"(\A(?:f|r|s)?\"([^\"]|\\.)*\")"),
lnav::pcre2pp::code::from_const(R"(\A(?:f|r|s)?"([^\"]|\\.)*")"),
&PRQL_STRING_ATTR,
},
{

Loading…
Cancel
Save