MBim Vim syntax file

Descripción del contenido de la página

Fichero de Vim para colorear código en MBim.

Etiquetas:

Este fichero de Vim para coloreado de código en MBim es una extensión al fichero de coloreado de código para MasterBASIC, para resaltar las características propias del formato MBim. Está basado en SBim Vim syntax file.

Código fuente

" mbim.vim
" Vim syntax file
" Language:    MBim (MasterBASIC improved) for the SAM Coupé computer
" Author:      Marcos Cruz (programandala.net)
" License:     Vim license (GPL compatible)
" URL:         http://programandala.net/es.programa.mbim_vim_syntax_file.html
" Updated:     2015-02-26

" This syntax file is not a complete implementation yet.

" ----------------------------------------------

" History:

" 2011-09-01: First version, based on SBim by the same author.
" 2012-09-03: Moved the editing preferences to a filetype plugin.
" 2012-11-19: Modified: Line comments (with //) need a trailing space; if they
" are not at the start of a line, also a leading space is needed.
" 2012-12-06: New: xxx, todo, fixme.
" 2014-06-19: New: PreProc commands:
"   '#first_line_number', '#compression', '#vim', '#include', '#keep_mb_file'.
" 2014-08-02: New: 'mbimLineEmptyComment'.
" 2015-02-26: Vim license.

" ----------------------------------------------

" MBim is an improved format for SAM Coupé's MasterBASIC source code.

" Features:

" Tabs can be used for indentation. All indentation is removed.
" Line comments with # (it must be the first non-empty char in the line).
" Line comments with // (anywhere in the line, even at the end of splitted lines; any spaces or tabs before the mark are removed too).
" Block comments with /* */ (the opening mark must be the first non-empty char in the line).
" Empty lines.
" Lines splitted with \.

" ----------------------------------------------

" This syntax file simply loads the standard
" MasterBASIC syntax file, adds the highlights for the new
" comments and sets the tabs and text folding preferences.

" The Vim2BAS tool provides programs to conver 
" the MBim source code into an actual MasterBASIC
" program for the SAM Coupé.

" ----------------------------------------------

:runtime! syntax/masterbasic.vim " Include the standard MasterBASIC syntax file

" XXX TODO just add '#' to iskeyword:
if version > 600
  setlocal iskeyword=48-57,65-90,97-122,_,$,%,#
else
  set iskeyword=48-57,65-90,97-122,_,$,%,#
endif

syn keyword mbimPreProc #first_line_number
syn keyword mbimPreProc #compression
syn keyword mbimPreProc #vim
syn keyword mbimPreProc #include
syn keyword mbimPreProc #keep_mb_file

" Line numbers are not used:
syntax clear masterbasicLineNumber

syn keyword mbimTodo contained todo fixme xxx

syn region mbimMetaComment start="^\s*#[# ]*" end="$" contains=mbimTodo
syn region mbimCommentedOut start="^\s*#[^# ]" end="$" contains=mbimTodo
syn region mbimLineStartComment start="^\s*//\s" end="$" contains=mbimTodo
syn region mbimLineEndComment start="\s\+//\s" end="$" contains=mbimTodo
syn match mbimLineEmptyComment "^\s*//\s*$"
syn region mbimBlockComment start="^\s*/\*" end="\*/" contains=mbimTodo

" XXX OLD ?
syn match mbimSplittedLine "|\s*\(//.*\)*$" contains=mbimLineComment

hi def link mbimMetaComment Comment
"hi def link mbimCommentedOut Ignore
hi def link mbimCommentedOut Comment
hi def link mbimLineStartComment Comment
hi def link mbimLineEndComment Comment
hi def link mbimBlockComment Comment
hi def link mbimLineEmptyComment Comment
hi def link mbimSplittedLine Ignore
hi def link mbimPreProc PreProc
hi def link mbimTodo Todo

let b:current_syntax = "mbim"


Descargas

Todos los componentes de MBim pueden descargarse en la sección de descargas de MBim.

Páginas relacionadas

SBim Vim syntax file
Fichero de Vim para colorear código en SBim.
BBim Vim syntax file
Fichero de Vim para colorear código en BBim.