Beta BASIC Vim syntax file

Descripción del contenido de la página

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

Etiquetas:

Fichero de Vim para coloreado de código en Beta BASIC.

Código fuente

" betabasic.vim
" Vim syntax file
" Language:   Beta BASIC 4.0
" Maintainer: Marcos Cruz (programandala.net)
" URL:        http://programandala.net
" Updated:    2014-10-17

" Note:

" This is a work in progress. The unfinished issues are marked with "!!!".

" History:

" 2011-03-07: First draft, based on the ZX BASIC version mantained by the same author.
" 2011-08-30: Many keywords added; many groups fixed.
" 2011-09-08: Added the special variables: "error", "lino", "stat", "xos", "xrg", "yos" and "yrg".
" 2012-03-07: Added "MEMORY$".
" 2012-03-16: Added "USING$", "USING", "CLOCK", "EDIT", "FILL", "POP", "ROLL", "SCROLL", "BIN$", "COSE", "DEC", "EOF", "FILLED", "HEX$", "LENGTH", "MEM", "SCRN$", "SHIFT$", "SINE", "STRING$", "TIME$", "XOR".
" 2012-09-03: Moved the editing preferences to a filetype plugin.
" 2014-10-17: Added "BIN".

" To-do:

" In Sinclair BASIC, AND and OR are logical operators, but in Beta BASIC the same keywords are used also as bitwise functions: AND() and OR(). How to highlight both uses differently?

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

" For Vim version 5.x: Clear all syntax items
" For Vim version 6.x: Quit when a syntax file was already loaded
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

if version > 600
  setlocal iskeyword=48-57,65-90,97-122,_,$,%
else
  set iskeyword=48-57,65-90,97-122,_,$,%
endif

if exists("b:current_syntax")
 finish
endif

syn case ignore

syn keyword betabasicFunction ABS
syn keyword betabasicFunction ACS
syn keyword betabasicProcedure ALTER
syn keyword betabasicStatement AND
syn keyword betabasicFunction ASN
syn keyword betabasicStatement AT
syn keyword betabasicFunction ATN
syn keyword betabasicProcedure BEEP
syn keyword betabasicFunction BIN
syn keyword betabasicFunction BIN$
syn keyword betabasicProcedure BORDER
syn keyword betabasicProcedure BRIGHT
syn keyword betabasicProcedure CAT
syn keyword betabasicFunction CHAR$
syn keyword betabasicFunction CHR$
syn keyword betabasicProcedure CIRCLE
syn keyword betabasicProcedure CLEAR
syn keyword betabasicProcedure CLS
syn keyword betabasicProcedure CLOCK
syn keyword betabasicProcedure CLOSE
syn keyword betabasicFunction CODE
syn keyword betabasicProcedure CONTINUE
syn keyword betabasicProcedure COPY
syn keyword betabasicFunction COS
syn keyword betabasicFunction COSE
syn keyword betabasicProcedure CSIZE
syn keyword betabasicProcedure DATA
syn keyword betabasicFunction DEC
syn match betabasicProgramFlow "DEF \?FN"
syn match betabasicProcedure "DEF \?KEY"
syn match betabasicProgramFlow "DEF \?PROC"
syn keyword betabasicStatement DEFAULT
syn keyword betabasicProcedure DELETE
syn keyword betabasicProcedure DIM
syn keyword betabasicProgramFlow DO
syn keyword betabasicFunction DPEEK
syn keyword betabasicFunction DPOKE
syn keyword betabasicProcedure DRAW
syn keyword betabasicProcedure EDIT
syn keyword betabasicProgramFlow ELSE
syn match betabasicProgramFlow "END \?PROC"
syn keyword betabasicFunction EOF
syn keyword betabasicProcedure ERASE
"syn keyword betabasicProgramFlow ERROR
syn keyword betabasicVariable error
syn match betabasicProgramFlow "EXIT IF"
syn keyword betabasicFunction EXP
syn keyword betabasicProcedure FILL
syn keyword betabasicFunction FILLED
syn keyword betabasicProcedure FLASH
syn keyword betabasicFunction FN
syn keyword betabasicProgramFlow FOR
syn keyword betabasicProcedure FORMAT
syn keyword betabasicProcedure GET
syn match betabasicProgramFlow "GO \?SUB"
syn match betabasicProgramFlow "GO \?TO"
syn keyword betabasicFunction HEX$
syn keyword betabasicProgramFlow IF
syn keyword betabasicProcedure IN
syn keyword betabasicFunction INARRAY
syn keyword betabasicFunction INSTRING
syn keyword betabasicProcedure INK
syn keyword betabasicFunction INKEY$
syn keyword betabasicProcedure INPUT
syn keyword betabasicFunction INT
syn keyword betabasicProcedure INVERSE
syn keyword betabasicStatement ITEM
syn keyword betabasicProcedure JOIN
syn keyword betabasicProcedure KEYIN
syn keyword betabasicProcedure KEYWORDS
syn keyword betabasicFunction LEN
syn keyword betabasicFunction LENGTH
syn keyword betabasicProcedure LET
syn keyword betabasicStatement LINE
syn keyword betabasicVariable lino
syn keyword betabasicProcedure LIST
syn keyword betabasicProcedure LLIST
syn keyword betabasicFunction LN
syn keyword betabasicProcedure LOAD
syn keyword betabasicProcedure LOCAL
syn keyword betabasicProgramFlow LOOP
syn keyword betabasicProcedure MERGE
syn keyword betabasicFunction MEM
syn keyword betabasicFunction MEMORY$
syn keyword betabasicFunction MOD
syn keyword betabasicProgramFlow NEXT
syn keyword betabasicFunction NOT
syn keyword betabasicFunction NUMBER
syn match betabasicProgramFlow "ON \?ERROR"
syn keyword betabasicProgramFlow ON
syn keyword betabasicStatement OPEN
syn keyword betabasicStatement OR
syn keyword betabasicProcedure OUT
syn keyword betabasicProcedure OVER
syn keyword betabasicProcedure PAPER
syn keyword betabasicProcedure PAUSE
syn keyword betabasicFunction PEEK
syn keyword betabasicFunction PI
syn keyword betabasicProcedure PLOT
syn keyword betabasicFunction POINT
syn keyword betabasicProcedure POKE
syn keyword betabasicProcedure POP
syn keyword betabasicProcedure PRINT
syn keyword betabasicProgramFlow PROC
syn keyword betabasicProcedure RANDOMIZE
syn keyword betabasicProcedure READ
syn keyword betabasicProcedure REF
syn keyword betabasicProcedure RENUM
syn keyword betabasicProcedure RESTORE
syn keyword betabasicProgramFlow RETURN
syn keyword betabasicFunction RND
syn keyword betabasicFunction RNDM
syn keyword betabasicProcedure ROLL
syn keyword betabasicProcedure SAVE
syn keyword betabasicFunction SCREEN
syn keyword betabasicFunction SCREEN$
syn keyword betabasicFunction SCRN$
syn keyword betabasicProcedure SCROLL
syn keyword betabasicFunction SGN
syn keyword betabasicFunction SHIFT$
syn keyword betabasicFunction SIN
syn keyword betabasicFunction SINE
syn keyword betabasicProcedure SORT
syn keyword betabasicFunction SQR
syn keyword betabasicVariable stat
syn keyword betabasicStatement STEP
syn keyword betabasicProcedure STOP
syn keyword betabasicFunction STR$
syn keyword betabasicFunction STRING$
syn keyword betabasicFunction TAB
syn keyword betabasicFunction TAN
syn keyword betabasicProgramFlow THEN
syn keyword betabasicFunction TIME$
syn keyword betabasicStatement TO
syn keyword betabasicProcedure TRACE
syn keyword betabasicProgramFlow UNTIL
syn keyword betabasicStatement USING
syn keyword betabasicFunction USING$
syn keyword betabasicFunction USR
syn keyword betabasicFunction VAL
syn keyword betabasicFunction VAL$
syn keyword betabasicProcedure VERIFY
syn keyword betabasicProgramFlow WHILE
syn keyword betabasicProcedure WINDOW
syn keyword betabasicFunction XOR
syn keyword betabasicVariable xos
syn keyword betabasicVariable xrg
syn keyword betabasicVariable yos
syn keyword betabasicVariable yrg

" Do the Basic variables names first. This is because it
" is the most inclusive of the tests. Later on we change
" this so the identifiers are split up into the various
" types of identifiers like functions, basic commands and
" such. MEM 9/9/2006

"syn match betabasicIdentifier "\<[a-zA-Z][a-zA-Z0-9]*\>"
"syn match betabasicGenericFunction "\<[a-zA-Z][a-zA-Z0-9]*\>\s*("me=e-1,he=e-1

" Floating point number, with dot, optional exponent
" Unfinished!!!:
syn match betabasicFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
" Floating point number, starting with a dot, optional exponent
" Unfinished!!!:
syn match betabasicFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
" Floating point number, without dot, with exponent
" Unfinished!!!:
syn match betabasicFloat "\<\d\+e[-+]\=\d\+[fl]\=\>"

" String 
syn region betabasicString start='"' skip='""' end='"'

" Comments

" Unfinished!!!:
syn region betabasicComment start="REM" end="$"

" line numbers

syn region betabasicLineNumber start="^\s*\d" end="\s"

" Create the clusters

syn cluster betabasicNumber contains=betabasicInteger,betabasicFloat

" Math operators

" Unfinished!!!:
syn match betabasicMathOperator "[\+\-\=\|\*\/\>\<\%\()[\]]"

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_betabasic_syntax_inits")

  if version < 508
    let did_betabasic_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink betabasicLineNumber Comment
  HiLink betabasicNumber Constant
  HiLink betabasicStatement Statement
  HiLink betabasicProcedure Statement
  HiLink betabasicProgramFlow Statement
  HiLink betabasicString Constant
  HiLink betabasicComment Comment
  HiLink betabasicTodo Todo
  HiLink betabasicFunction Identifier
  HiLink betabasicVariable Identifier
  hi betabasicMathsOperator term=bold cterm=bold gui=bold
  "HiLink betabasicMathsOperator Statement "debug check!!!

  delcommand HiLink

endif

let b:current_syntax = "betabasic"

" vim: ts=2
" vim: set ignorecase
" vim: set smartcase

Descargas

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

Páginas relacionadas

BBim Vim syntax file
Fichero de Vim para colorear código en BBim.
MBim Vim syntax file
Fichero de Vim para colorear código en MBim.
MasterBASIC Vim syntax file
Fichero de Vim para colorear código en MasterBASIC.
SuperBASIC Vim syntax file
Fichero de Vim para colorear código en SuperBASIC o SBASIC.