summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/aflex.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:44:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:44:24 +0000
commit8baab3c8d7a6f22888bd581cd5c6098fd2e4b5a8 (patch)
tree3537e168b860f2742f6029d70501b5ed7d15d345 /runtime/syntax/aflex.vim
parentInitial commit. (diff)
downloadvim-8baab3c8d7a6f22888bd581cd5c6098fd2e4b5a8.tar.xz
vim-8baab3c8d7a6f22888bd581cd5c6098fd2e4b5a8.zip
Adding upstream version 2:8.1.0875.upstream/2%8.1.0875upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/syntax/aflex.vim')
-rw-r--r--runtime/syntax/aflex.vim82
1 files changed, 82 insertions, 0 deletions
diff --git a/runtime/syntax/aflex.vim b/runtime/syntax/aflex.vim
new file mode 100644
index 0000000..aa8b5f8
--- /dev/null
+++ b/runtime/syntax/aflex.vim
@@ -0,0 +1,82 @@
+
+" Vim syntax file
+" Language: AfLex (from Lex syntax file)
+" Maintainer: Mathieu Clabaut <mathieu.clabaut@free.fr>
+" LastChange: 02 May 2001
+" Original: Lex, maintained by Dr. Charles E. Campbell, Jr.
+" Comment: Replaced sourcing c.vim file by ada.vim and rename lex*
+" in aflex*
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+" Read the Ada syntax to start with
+runtime! syntax/ada.vim
+unlet b:current_syntax
+
+
+" --- AfLex stuff ---
+
+"I'd prefer to use aflex.* , but it doesn't handle forward definitions yet
+syn cluster aflexListGroup contains=aflexAbbrvBlock,aflexAbbrv,aflexAbbrv,aflexAbbrvRegExp,aflexInclude,aflexPatBlock,aflexPat,aflexBrace,aflexPatString,aflexPatTag,aflexPatTag,aflexPatComment,aflexPatCodeLine,aflexMorePat,aflexPatSep,aflexSlashQuote,aflexPatCode,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2
+syn cluster aflexListPatCodeGroup contains=aflexAbbrvBlock,aflexAbbrv,aflexAbbrv,aflexAbbrvRegExp,aflexInclude,aflexPatBlock,aflexPat,aflexBrace,aflexPatTag,aflexPatTag,aflexPatComment,aflexPatCodeLine,aflexMorePat,aflexPatSep,aflexSlashQuote,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2
+
+" Abbreviations Section
+syn region aflexAbbrvBlock start="^\([a-zA-Z_]\+\t\|%{\)" end="^%%$"me=e-2 skipnl nextgroup=aflexPatBlock contains=aflexAbbrv,aflexInclude,aflexAbbrvComment
+syn match aflexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=aflexAbbrvRegExp
+syn match aflexAbbrv "^%[sx]" contained
+syn match aflexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=aflexAbbrv,aflexInclude
+syn region aflexInclude matchgroup=aflexSep start="^%{" end="%}" contained contains=ALLBUT,@aflexListGroup
+syn region aflexAbbrvComment start="^\s\+/\*" end="\*/"
+
+"%% : Patterns {Actions}
+syn region aflexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=aflexPat,aflexPatTag,aflexPatComment
+syn region aflexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=aflexMorePat,aflexPatSep contains=aflexPatString,aflexSlashQuote,aflexBrace
+syn region aflexBrace start="\[" skip=+\\\\\|\\+ end="]" contained
+syn region aflexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
+syn match aflexPatTag "^<\I\i*\(,\I\i*\)*>*" contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
+syn match aflexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
+syn region aflexPatComment start="^\s*/\*" end="\*/" skipnl contained contains=cTodo nextgroup=aflexPatComment,aflexPat,aflexPatString,aflexPatTag
+syn match aflexPatCodeLine ".*$" contained contains=ALLBUT,@aflexListGroup
+syn match aflexMorePat "\s*|\s*$" skipnl contained nextgroup=aflexPat,aflexPatTag,aflexPatComment
+syn match aflexPatSep "\s\+" contained nextgroup=aflexMorePat,aflexPatCode,aflexPatCodeLine
+syn match aflexSlashQuote +\(\\\\\)*\\"+ contained
+syn region aflexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" skipnl contained contains=ALLBUT,@aflexListPatCodeGroup
+
+syn keyword aflexCFunctions BEGIN input unput woutput yyleng yylook yytext
+syn keyword aflexCFunctions ECHO output winput wunput yyless yymore yywrap
+
+" <c.vim> includes several ALLBUTs; these have to be treated so as to exclude aflex* groups
+syn cluster cParenGroup add=aflex.*
+syn cluster cDefineGroup add=aflex.*
+syn cluster cPreProcGroup add=aflex.*
+syn cluster cMultiGroup add=aflex.*
+
+" Synchronization
+syn sync clear
+syn sync minlines=300
+syn sync match aflexSyncPat grouphere aflexPatBlock "^%[a-zA-Z]"
+syn sync match aflexSyncPat groupthere aflexPatBlock "^<$"
+syn sync match aflexSyncPat groupthere aflexPatBlock "^%%$"
+
+" Define the default highlighting.
+" Only when an item doesn't have highlighting yet
+hi def link aflexSlashQuote aflexPat
+hi def link aflexBrace aflexPat
+hi def link aflexAbbrvComment aflexPatComment
+
+hi def link aflexAbbrv SpecialChar
+hi def link aflexAbbrvRegExp Macro
+hi def link aflexCFunctions Function
+hi def link aflexMorePat SpecialChar
+hi def link aflexPat Function
+hi def link aflexPatComment Comment
+hi def link aflexPatString Function
+hi def link aflexPatTag Special
+hi def link aflexSep Delimiter
+
+let b:current_syntax = "aflex"
+
+" vim:ts=10