[TxMt] SQL grammar help

John DeSoi desoi at pgedit.com
Mon Nov 29 02:08:40 UTC 2010


I want to be able to execute a multi-line SQL statement by placing the cursor anywhere in the statement OR immediately following the ending statement semi-colon. With the grammar fragment below everything seems to work fine except for the case where two statements are on consecutive lines:

select 1;
select 2;

In this case, both statements are executed because it looks like a single consecutive scope. I have tried various things, but I can't seem to find the right regular expression magic to only execute the statement to the left of the semi-colon.


{   name =  'meta.statement.pgsql';
		    begin = '(?i)^(abort|alter|analyze|begin....)';
		    end = ';\s*';
		    beginCaptures = { 0 = { name = 'keyword.other.pgsql'; }; };
		    patterns = (
		        {	include = '#dollar_quotes'; },
		        {	include = '#comments'; },
		        {	include = '#strings'; },
		        {	include = '#keywords'; },
		        {	include = '#misc'; },
		    );
		},



Thanks for any help or suggestions.


John DeSoi, Ph.D.






More information about the textmate mailing list