BBim Vim syntax file

Descripción del contenido de la página

Fichero de Vim para colorear código en BBim.


Fichero de Vim para coloreado de código en BBim; es un añadido al fichero Beta BASIC Vim syntax file.

Código fuente

" bbim.vim
" Vim syntax file
" Language:    BBim (Beta BASIC improved) for the ZX Spectrum computer
" Author:      Marcos Cruz (
" License:     Vim license (GPL compatible)
" URL:
" Updated:     2015-02-26

" This syntax file is not a complete implementation yet.

" History:

" 2011-08-30: First version, based on sb.vim by the same author.
" 2011-09-01: Renamed to BBim (formerly BB).
" 2011-09-26: Digits added to label names.
" 2012-01-25: bbimLabel fixed with mandatory start of line and optional spaces.
" 2012-01-27: Fixed. The backslash was not highlighted when a line comment followed it. The hash was not properly highlighted when it was the only character in the line.
" 2012-01-28: Modifed. "bbimMetaComment" is not highlighted apart anymore; "bbimCommentedOut" is used in all cases.
" 2012-03-06: Two typos fixed: "betabasic" and "sbim" changed to "bbim".
" 2012-03-06: Metacommands.
" 2012-09-03: Moved the editing preferences to a filetype plugin.
" 2014-08-08: Fix: label 'region' is changed to 'match'.
" 2015-02-26: Vim license.

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

" To-do

" Make metacommands highligthed in block comments.
" Why metacommands are highlighted like todo?

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

" BBim is an improved format for ZX Spectrum's Beta BASIC 4.0 source code,
" created to write Beta BASIC programs with the Vim editor.

" BBim Features:

" Indentation (tabs or spaces).
" Line metacomments 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 a backslash.
" Metacommands #firstline, #vim and #include.

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

" In order to convert the source code into an actual Beta BASIC program,
" the BBim tool in under development. It provides two programs:

" - a converter written in Vim.
" - an importer written in Beta BASIC.

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

:runtime! syntax/beta_basic.vim " Include the standard Beta BASIC syntax file

" Add # to the allowed keyword characters:
if version > 600
  setlocal iskeyword+=#
  set iskeyword+=#

" Line numbers are not used:
syntax clear betabasicLineNumber

syn keyword bbimTodo contained

syn region bbimBlockComment start="^\s*/\*" end="\*/" contains=bbimTodo
"syn region bbimBlockComment start="/\*" end="\*/" contains=bbimTodo
syn region bbimMetaComment start="^\s*#[# ]*" end="$" contains=bbimTodo
"syn region bbimCommentedOut start="^\s*#[^# ]" end="$" contains=bbimTodo 
"syn match bbimCommentedOut "^\s*#$"
syn match bbimCommentedOut "^\s*#.*$"
syn region bbimLineComment start="//" end="$" contains=bbimTodo

" syn match bbimSplittedLine "\\\s*\(//.*\)*$" contains=bbimLineComment
" 2012-01-27: Fixed:
syn match bbimSplittedLine "\\\s*\(//.*\)\?$" contains=bbimLineComment

syn match bbimLabel "^\s*\(label\s\+\)\?@[a-zA-Z0-9_]\+\>"

syn match bbimMetaCommand "^\s*#vim\s\+.\+"
syn match bbimMetaCommand "^\s*#include\s\+.\+"
syn match bbimMetaCommand "^\s*#firstline\s\+\d\+"

hi def link bbimMetaComment Comment
"hi def link bbimCommentedOut Ignore
hi def link bbimCommentedOut Comment
hi def link bbimLineComment Comment
hi def link bbimBlockComment Comment
hi def link bbimSplittedLine Ignore
hi def link bbimTodo Todo
hi def link bbimLabel Comment
hi def link bbimMetaCommand Statement

let b:current_syntax = "bbim"


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

Páginas relacionadas

Beta BASIC Vim syntax file
Fichero de Vim para colorear código en Beta BASIC.
MBim Vim syntax file
Fichero de Vim para colorear código en MBim.