jEdit Community - Resources for users of the jEdit Text Editor
Pro*C syntax
Submitted by gabebear on Monday, 24 November, 2008 - 20:21
I'm trying to make a ruleset for Pro*C syntax. Pro*C is C run through Oracle's precompiler which allows you to embed SQL directly into C. Here are the simple rules I have that come close to working. EXEC SQL CREATE END-EXEC; EXEC SQL EXECUTE BEGIN END-EXEC; EXEC SQL EXECUTE DECLARE END-EXEC; EXEC SQL ; The problem with these rules is that "EXEC", "SQL", "CREATE", "EXECUTE", "BEGIN", and "DECLARE" can all appear on separate lines. I tried creating separate rule sets, but I don't see a way to include a default case that changes the ending delimiter for the block. I also messed with regular-expressions via SPAN_REGEXP, but these only work on a single line at a time (which makes sense for speed) and can't just match the first character. Any ideas? Here's snippit that I've been using for testing. EXEC SQL CREATE select * from should_be_highlighted; END-EXEC; select * from should_NOT_be_highlighted; EXEC SQL EXECUTE select * from should_be_highlighted; select * from should_NOT_be_highlighted; EXEC SQL EXECUTE select * from should_be_highlighted; select * from should_NOT_be_highlighted; EXEC SQL select * from should_be_highlighted; select * from should_NOT_be_highlighted; EXEC SQL BEGIN DECLARE SECTION; select * from should_NOT_be_highlighted; EXEC SQL END DECLARE SECTION; select * from should_NOT_be_highlighted; EXEC SQL EXECUTE BEGIN select * from should_be_highlighted; select * from should_be_highlighted; END-EXEC; select * from should_NOT_be_highlighted; EXEC SQL select * from should_be_highlighted ; select * from should_NOT_be_highlighted; EXEC SQL EXECUTE BEGIN select * from should_be_highlighted;select * from should_be_highlighted;select * from should_be_highlighted;END-EXEC; select * from should_NOT_be_highlighted; EXEC SQL EXECUTE BEGIN select * from should_be_highlighted;select * from should_be_highlighted;select * from should_be_highlighted;END-EXEC; select * from should_NOT_be_highlighted;
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
My god... sorry, that got REA
by gabebear on Mon, 24/11/2008 - 20:32
My god... sorry, that got REALLY messed up while posting... Where did all my line-breaks go?

I'm trying to make a ruleset for Pro*C syntax. Pro*C is C run through Oracle's precompiler which allows you to embed SQL directly into C. I want to use the C mode and delegate the correct parts to the pl-sql mode.

The basic rules are:
Begin = "EXEC SQL CREATE" End = "END-EXEC;"
Begin = "EXEC SQL EXECUTE BEGIN" End = "END-EXEC;"
Begin = "EXEC SQL EXECUTE DECLARE" End = "END-EXEC;"
Begin = "EXEC SQL" End = ";"

The problem with these rules is that "EXEC", "SQL", "CREATE", "EXECUTE", "BEGIN", and "DECLARE" can all appear on separate lines and the delimiter for "EXEC SQL" is a ";" while the others are "END-EXEC;". I've tried creating separate rule sets, but I don't see a way to include a default case that changes the ending delimiter for the block.

I've also messed with regular-expressions via SPAN_REGEXP, but these only work on a single line at a time (which makes sense for speed) and can't just match the first character.

Any ideas?

Here's a snippit that I've been using for testing.

EXEC
SQL CREATE
select * from should_be_highlighted;
END-EXEC;
select * from should_NOT_be_highlighted;
EXEC SQL
EXECUTE select * from should_be_highlighted;
select * from should_NOT_be_highlighted;
EXEC SQL EXECUTE select * from should_be_highlighted;
select * from should_NOT_be_highlighted;
EXEC SQL select * from should_be_highlighted;
select * from should_NOT_be_highlighted;
EXEC SQL BEGIN DECLARE SECTION;
select * from should_NOT_be_highlighted;
EXEC SQL END DECLARE SECTION;
select * from should_NOT_be_highlighted;
EXEC
SQL
EXECUTE
BEGIN
select * from should_be_highlighted;
select * from should_be_highlighted;
END-EXEC;
select * from should_NOT_be_highlighted;
EXEC
SQL
select * from should_be_highlighted
;
select * from should_NOT_be_highlighted;
EXEC SQL EXECUTE BEGIN select * from should_be_highlighted;select * from should_be_highlighted;select * from should_be_highlighted;END-EXEC;
select * from should_NOT_be_highlighted;
EXEC SQL EXECUTE
BEGIN select * from should_be_highlighted;select * from should_be_highlighted;select * from should_be_highlighted;END-EXEC;
select * from should_NOT_be_highlighted;
 
Hi, indeed Your problem is
by Robert Schwenn on Tue, 25/11/2008 - 21:15
Hi,

indeed Your problem is that the BEGIN qualifiers can be distributed over more than one line. I think it's not possible to declare this, because the regular expression doesn't support this an a line break can't be placed as a literal in the BEGIN attribute for the SPAN tag.

Maybe You could create coding rules for Yourself in the way that You write the beginning qualifiers all together at one line or have a special comment at the end?

Robert
User login
Browse archives
« November 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300