diff --git a/code_examples/Reporting2.pm b/code_examples/Reporting2.pm index f521e8c..9e7aa43 100644 --- a/code_examples/Reporting2.pm +++ b/code_examples/Reporting2.pm @@ -9,7 +9,8 @@ sub foo { #@@:heredoc:sql my $s = <bar bar'; +--@@:string:xml +select 'blah blah blah'; drop table foog; insert into mytable (col1, col2, "col3") values (99, 33, 1234); select cast(plunk as timestamp) from blarg join plarg using(id_what) where x = 3; diff --git a/mode/sql.py b/mode/sql.py index af2e046..062f4e3 100644 --- a/mode/sql.py +++ b/mode/sql.py @@ -1,5 +1,5 @@ import mode, tab -from lex import Grammar, PatternRule, NocasePatternRule, RegionRule, NocaseRegionRule +from lex import Grammar, PatternRule, NocasePatternRule, RegionRule, NocaseRegionRule, OverridePatternRule from mode.python import StringGrammar1, StringGrammar2 class BitStringGrammar(Grammar): @@ -10,6 +10,7 @@ class HexStringGrammar(Grammar): base_rules = [ PatternRule(r'spaces', r' +'), + OverridePatternRule(r'comment', r'--@@:(?P[.a-zA-Z0-9_]+):(?P[.a-zA-Z0-9_]+) *$'), PatternRule(r'comment', r'--.*\n$'), RegionRule(r'comment', '/\*', Grammar, '\*/'), PatternRule(r'delimiter', r':=|[():;,\.\$\[\]~]'),