SQL folding question

Discuss syntax highlighting or submit new syntax files.
Post Reply
akari
Posts: 11
Joined: 16 Aug 2013 09:07

SQL folding question

Post by akari » 02 May 2019 09:04

Hi,
I'm trying to add some logic to SQL syntax for oracle SQL.
I wish to fold the if else statement.

if
xx;
elsif
xx;
elsif
xx;
else
xx;
end if;

I try to write the fold syntax like:
1_Id=if
1_Begin=if
1_End=end if;
1_EndBefore=elsif
2_Id=elsif
2_Begin=elsif
2_End=elsif
2_EndBefore=elsif

it only can fold those if to elsif and elsif to elsif:

I try to refer the php one.
1_EndBefore=} elseif|} else
but seem like is not working.

by the way, i notice php syntax cant fold else statement, if the else statement the same line with the close bracket.
Attachments
result2.png
PHP else Syntax
result2.png (3.81 KiB) Viewed 635 times
result1.png
Oracle SQL
result1.png (4.36 KiB) Viewed 635 times
result2.png
PHP syntax
result2.png (3.81 KiB) Viewed 636 times
result2.png
result2.png (3.81 KiB) Viewed 636 times
result2.png
result2
result2.png (3.81 KiB) Viewed 637 times

User avatar
Rickard Johansson
Site Admin
Posts: 5787
Joined: 19 Jul 2006 14:29

Re: SQL folding question

Post by Rickard Johansson » 03 May 2019 13:19

Does this work better?

Code: Select all

1_Id=if
1_Begin=
1_End=end if
1_EndBefore=elseif|else
1_Section=
1_NoParentOfId=0
1_NotAlwaysEnded=0
1_ListItem=
2_Id=elseif
2_Begin=
2_End=end if
2_EndBefore=elseif|else
2_Section=
2_NoParentOfId=0
2_NotAlwaysEnded=0
2_ListItem=
3_Id=else
3_Begin=
3_End=end if
3_EndBefore=
3_Section=
3_NoParentOfId=0
3_NotAlwaysEnded=0
3_ListItem=

akari
Posts: 11
Joined: 16 Aug 2013 09:07

Re: SQL folding question

Post by akari » 09 Jul 2019 02:13

sorry that time I was busy and forget this case,
After I test still the same.
result.png
result
result.png (4.01 KiB) Viewed 104 times
It is correct I put under the last line in the syx file?
syx file.png
sql syx file
syx file.png (37.53 KiB) Viewed 104 times

User avatar
Rickard Johansson
Site Admin
Posts: 5787
Joined: 19 Jul 2006 14:29

Re: SQL folding question

Post by Rickard Johansson » 13 Jul 2019 14:54

Try this instead:

Code: Select all

[Fold]
1_Id=if
1_Begin=
1_End=end if
1_EndBefore=\in|elsif|else
1_Section=
1_NoParentOfId=0
1_NotAlwaysEnded=0
1_ListItem=
2_Id=elsif
2_Begin=
2_End=end if
2_EndBefore=\in|elsif|else
2_Section=
2_NoParentOfId=0
2_NotAlwaysEnded=0
2_ListItem=
3_Id=else
3_Begin=
3_End=end if
3_EndBefore=\in
3_Section=
3_NoParentOfId=0
3_NotAlwaysEnded=0
3_ListItem=

Post Reply