Updating Oracle pl/sql syntax highlighting file

22 views
Skip to first unread message

Ron Lamb

unread,
Apr 17, 2012, 11:48:25 AM4/17/12
to v...@vim.org
Oracle 11 added the new quoteing method that
Startin quote is
q'X where X is any character not used in the string
ends
X'

Example
q'[select 'V' from dual]'

The current highlighting plsql.vim file doesn't handle that type of
string correctly. I tried a fix but can't seem to get it to work.
Here is what I tried to do. I made another syntax match based off
plsqlStringLiteral as follows
syn match plsqlQuotedString "'\([^q'\(.\)]\|''\)*\2'"

I am not very good at following the regular expression, that it is based from
syn match plsqlStringLiteral "'\([^']\|''\)*'"

Can someone fix this so that syntax highlighting doesn't flag every
semicolon in the file after this as a red error.

Michael Ludwig

unread,
Apr 17, 2012, 5:28:33 PM4/17/12
to v...@vim.org
Ron Lamb schrieb am 17.04.2012 um 11:48 (-0400):
> Oracle 11 added the new quoteing method that
> Startin quote is
> q'X where X is any character not used in the string
> ends
> X'
>
> Example
> q'[select 'V' from dual]'

Hey, that's almost as good as Perl, which has the q and qq operators,
so you could write q/no slash in here/ or qq[no bracket in here but
variable $interpolation possible].

> The current highlighting plsql.vim file doesn't handle that type of
> string correctly. I tried a fix but can't seem to get it to work.
> Here is what I tried to do. I made another syntax match based off
> plsqlStringLiteral as follows
> syn match plsqlQuotedString "'\([^q'\(.\)]\|''\)*\2'"

I would suggest looking at the Perl syntax file and specifically at
what they have for the q, qq, m, s and tr operators because that solves
the problem nicely for *any* character as delimiter. You could then copy
their tricks.

Michael

Reply all
Reply to author
Forward
0 new messages