Improved the sync patterns.
[external/ragel.git] / ragel.vim
index 4fc9c5b..2f09b60 100644 (file)
--- a/ragel.vim
+++ b/ragel.vim
@@ -96,7 +96,9 @@ syntax match rlOtherOps ":>>" contained
 syntax match rlOtherOps "<:" contained
 
 " Keywords
-syntax keyword rlKeywords machine action context include range contained
+" FIXME: Enable the range keyword post 5.17.
+" syntax keyword rlKeywords machine action context include range contained
+syntax keyword rlKeywords machine action context include contained
 syntax keyword rlExprKeywords when err lerr eof from to contained
 
 " Case Labels
@@ -130,9 +132,11 @@ syntax keyword rlWriteOptions noerror nofinal noprefix noend contained
 "
 " Sync at the start of machine specs.
 "
-syntax sync match ragelSyncPat grouphere NONE "%%{&"
-syntax sync match ragelSyncPat grouphere NONE "%%[^{]&"
-syntax sync match ragelSyncPat grouphere NONE "}%%"
+" Match The ragel delimiters only if there quotes no ahead on the same line.
+" On the open marker, use & to consume the leader.
+syntax sync match ragelSyncPat grouphere NONE "^[^\'\"%]*%%{&^[^\'\"%]*"
+syntax sync match ragelSyncPat grouphere NONE "^[^\'\"%]*%%[^{]&^[^\'\"%]*"
+syntax sync match ragelSyncPat grouphere NONE "^[^\'\"]*}%%"
 
 "
 " Specifying Groups