From: Ben Beltran Date: Tue, 23 Jun 2015 14:59:54 +0000 (-0500) Subject: Adds the syntax def X-Git-Url: https://git.r.bdr.sh/rbdr/api-notation.vim/commitdiff_plain/ff11ecc1ac84459c448430ce843741d20b70057f Adds the syntax def --- diff --git a/example-syntax.api b/example-syntax.api new file mode 100644 index 0000000..670be57 --- /dev/null +++ b/example-syntax.api @@ -0,0 +1,17 @@ +HypotheticalModule + +staticProperty + +anotherStaticProperty + ::toggleAnotherStaticProperty() + ::setStaticProperty(newValue ) + -instanceProperty + -anotherInstanceProperty + #instanceMethodSync([optionalParameter]) => resultOfCall + #instanceMethodAsync(someValue , [callback] ) ->(error , result ) + +EventHypotheticalClass + +>AnotherClass<+staticEventToListen(eventData ) + <+staticEventDispatched(someData ) + ~>listenedSocketEvent(eventData ) + <~dispatchedSocketEvent(eventData ) + ->AnotherClass<-instanceEventToListen(eventData ) + <-instanceEventDispatched(specificDataType ) diff --git a/ftdetect/api-notation.vim b/ftdetect/api-notation.vim new file mode 100644 index 0000000..f1d3ffb --- /dev/null +++ b/ftdetect/api-notation.vim @@ -0,0 +1 @@ +autocmd BufNewFile,BufRead *.api setlocal filetype=api-notation shiftwidth=2 expandtab diff --git a/syntax/api-notation.vim b/syntax/api-notation.vim new file mode 100644 index 0000000..405fcd5 --- /dev/null +++ b/syntax/api-notation.vim @@ -0,0 +1,44 @@ +" Vim syntax file +" Language: API Notation +" Maintainer: Rubén Beltrán del Río +" Latest Revision: 22 June 2015 + +if exists("b:current_syntax") + finish +endif + +syn match moduleName '^\w\+' + +syn match classMembers '^\s\+\(\(<+\)\|\(<\~\)\|\(<-\)\|\(+>\)\|\(\~>\)\|\(->\)\|-\|+\|\(::\)\|#\)' nextgroup=memberName skipwhite +syn match internalOperators '\(\(<+\)\|\(<\~\)\|\(<-\)\|\(+>\)\|\(\~>\)\|\(->\)\|-\|+\|\(::\)\|#\)' contained nextgroup=memberName skipwhite +syn match returnIdentifiers '\(=>\)' nextgroup=returnValue +syn match returnIdentifiers '\(->\)' + +syn match memberName '\w\+' contained nextgroup=internalOperators,spacedDataType + +syn region parameterList start="(" end=")" transparent contains=parameters,separators,optionalParameter,dataType +syn region optionalParameter start="\[" end="]" contains=optionalParameters contained +syn region dataType start="<" end=">" contains=dataTypes,separators contained +syn region spacedDataType start='\s\+<' end=">" contains=dataTypes,separators contained + +syn match optionalParameters '\w\+' contained +syn match parameters '\w\+' contained +syn match dataTypes '\w\+' contained +syn match separators '|\|,' contained + +syn match returnValue '.*' contained contains=dataType,parameters + + +hi def link moduleName Identifier + +hi def link classMembers Operator +hi def link returnIdentifiers Operator +hi def link internalOperators Operator + +hi def link memberName Special + +hi def link parameters PreProc +hi def link optionalParameters Underlined +hi def link dataTypes Constant + +hi def link separators Comment