BaCon Vim syntax file

Descripción del contenido de la página

Fichero de Vim para colorear código en Bacon.

Etiquetas:

Escribí este fichero de sintaxis para Vim con el objeto de poder probar el lenguaje BaCon más cómodamente con mi editor favorito.

Código fuente

" bacon.vim
" Vim syntax file
" Language: BaCon (BASIC Converter, http://www.basic-converter.org)
" Author:   Marcos Cruz (programandala.net)
" License:  Vim license (GPL compatible)
" URL:      http://programandala.net/en.program.bacon_vim_syntax_file.html
" Updated:  2015-02-26

" Note:

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

" History:

" 2012-09-03: First version.
"
" 2012-09-06: Added missing keywords: STRING, FLOATING, NUMBER, #define,
" #include, BG, FG, BLACK, RED, GREEN, YELLOW, MAGENTA, BLUE, CYAN, WHITE,
" NORMAL, INTENSE, INVERSE, RESET, COMPARE, SOCKET, MEMSTREAM, MEMTYPE,
" COLLAPSE, INTERNATIONAL, STARTPOINT, APPENDING, char*, double, float, int,
" long, short.
"
" 2012-09-29: Added missing keywords: ENDSUB, ENDFUNCTION, ENDIF, DEFAULT,
" ENDSELECT, CURSOR, OFF, GETX, GETY.

" 2012-10-01: Added missing keyword: ELIF.

" 2012-09-30: Some format changes.
"
" 2012-10-01: REM regexp improved; DO added.
"
" 2012-10-03: Added missing keywords: WHENCE, START, CURRENT,
" OFFSET.
"
" 2012-11-03: Added missing keywords: ASSOC, BASE, BROADCAST, DEF, DOWN,
" ENDWITH, FN, MEMTELL, MULTICAST, SETENVIRON, UDP, USEC, WITH.
"
" 2014-10-19: Added missing keyword: FORMAT.
"
" 2015-02-26: Vim license.

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

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

" BaCon is case sensitive, but
" it can be made case insensitive
" using the C preprocessor, so:
syn case ignore

syn sync minlines=10 maxlines=500

" Keywords:

syn keyword baconFunction ABS
syn keyword baconFunction ADDRESS
syn keyword baconFunction ARGUMENT$
syn keyword baconFunction ASC
syn keyword baconFunction ATN
syn keyword baconFunction CHOP$
syn keyword baconFunction CHR$
syn keyword baconFunction COLUMNS
syn keyword baconFunction CONCAT$
syn keyword baconFunction COS
syn keyword baconFunction CURDIR$
syn keyword baconFunction DAY
syn keyword baconFunction DEC
syn keyword baconFunction ENDFILE
syn keyword baconFunction EQUAL
syn keyword baconFunction ERR$
syn keyword baconFunction ERROR
syn keyword baconFunction EVEN
syn keyword baconFunction EXEC$
syn keyword baconFunction EXP
syn keyword baconFunction FALSE
syn keyword baconFunction FILEEXISTS
syn keyword baconFunction FILELEN
syn keyword baconFunction FILETIME
syn keyword baconFunction FILETYPE
syn keyword baconFunction FILL$
syn keyword baconFunction FLOOR
syn keyword baconFunction FP
syn keyword baconFunction GETENVIRON$
syn keyword baconFunction GETKEY
syn keyword baconFunction GETX
syn keyword baconFunction GETY
syn keyword baconFunction HEX$
syn keyword baconFunction HOST$
syn keyword baconFunction HOUR
syn keyword baconFunction INSTR
syn keyword baconFunction INSTRREV
syn keyword baconFunction INTL$
syn keyword baconFunction ISFALSE
syn keyword baconFunction ISTRUE
syn keyword baconFunction LCASE$
syn keyword baconFunction LEFT$
syn keyword baconFunction LEN
syn keyword baconFunction LOG
syn keyword baconFunction MAXRANDOM
syn keyword baconFunction MEMORY
syn keyword baconFunction MEMTELL
syn keyword baconFunction MID$
syn keyword baconFunction MINUTE
syn keyword baconFunction MOD
syn keyword baconFunction MONTH
syn keyword baconFunction MONTH$
syn keyword baconFunction NL$
syn keyword baconFunction NNTL$
syn keyword baconFunction NOT
syn keyword baconFunction NOW
syn keyword baconFunction OS$
syn keyword baconFunction PEEK
syn keyword baconFunction PI
syn keyword baconFunction POW
syn keyword baconFunction RANDOM
syn keyword baconFunction REGEX
syn keyword baconFunction REPLACE$
syn keyword baconFunction RESUME
syn keyword baconFunction RETVAL
syn keyword baconFunction REVERSE$
syn keyword baconFunction RIGHT$
syn keyword baconFunction RND
syn keyword baconFunction ROUND
syn keyword baconFunction ROWS
syn keyword baconFunction SEARCH
syn keyword baconFunction SECOND
syn keyword baconFunction SGN
syn keyword baconFunction SIN
syn keyword baconFunction SIZEOF
syn keyword baconFunction SPC$
syn keyword baconFunction SQR
syn keyword baconFunction STR$
syn keyword baconFunction TAB$
syn keyword baconFunction TAN
syn keyword baconFunction TELL
syn keyword baconFunction TIMEVALUE
syn keyword baconFunction TRUE
syn keyword baconFunction UCASE$
syn keyword baconFunction VAL
syn keyword baconFunction VERSION$
syn keyword baconFunction WAIT
syn keyword baconFunction WEEK
syn keyword baconFunction WEEKDAY$
syn keyword baconFunction YEAR
syn keyword baconOperator AND
syn keyword baconOperator EQ
syn keyword baconOperator IS
syn keyword baconOperator ISNOT
syn keyword baconOperator NE
syn keyword baconOperator OR
syn keyword baconProgramFlow CASE
syn keyword baconProgramFlow CONTINUE
syn keyword baconProgramFlow DEF
syn keyword baconProgramFlow DEFAULT
syn keyword baconProgramFlow DO
syn keyword baconProgramFlow ELIF
syn keyword baconProgramFlow ELSE
syn keyword baconProgramFlow END
syn keyword baconProgramFlow ENDFUNCTION
syn keyword baconProgramFlow ENDIF
syn keyword baconProgramFlow ENDSELECT
syn keyword baconProgramFlow ENDSUB
syn keyword baconProgramFlow FN
syn keyword baconProgramFlow FOR
syn keyword baconProgramFlow FUNCTION
syn keyword baconProgramFlow GOSUB
syn keyword baconProgramFlow GOTO
syn keyword baconProgramFlow IF
syn keyword baconProgramFlow LABEL
syn keyword baconProgramFlow NEXT
syn keyword baconProgramFlow ON
syn keyword baconProgramFlow RETURN
syn keyword baconProgramFlow SELECT
syn keyword baconProgramFlow STOP
syn keyword baconProgramFlow SUB
syn keyword baconProgramFlow THEN
syn keyword baconProgramFlow UNTIL
syn keyword baconProgramFlow WEND
syn keyword baconProgramFlow WHILE
syn keyword baconSpecial #define
syn keyword baconSpecial #include
syn keyword baconSpecial char*
syn keyword baconSpecial double
syn keyword baconSpecial float
syn keyword baconSpecial int
syn keyword baconSpecial long
syn keyword baconSpecial short
syn keyword baconStatement ALARM
syn keyword baconStatement ALIAS
syn keyword baconStatement APPENDING
syn keyword baconStatement ARRAY
syn keyword baconStatement AS
syn keyword baconStatement ASSOC
syn keyword baconStatement BASE
syn keyword baconStatement BG
syn keyword baconStatement BLACK
syn keyword baconStatement BLUE
syn keyword baconStatement BREAK
syn keyword baconStatement BROADCAST
syn keyword baconStatement BY
syn keyword baconStatement CALL
syn keyword baconStatement CATCH
syn keyword baconStatement CHANGEDIR
syn keyword baconStatement CHUNK
syn keyword baconStatement CLEAR
syn keyword baconStatement CLOSE
syn keyword baconStatement COLLAPSE
syn keyword baconStatement COLOR
syn keyword baconStatement COMPARE
syn keyword baconStatement CONST
syn keyword baconStatement COPY
syn keyword baconStatement CURSOR
syn keyword baconStatement CURRENT
syn keyword baconStatement CYAN
syn keyword baconStatement DATA
syn keyword baconStatement DECLARE
syn keyword baconStatement DECR
syn keyword baconStatement DELETE
syn keyword baconStatement DIRECTORY
syn keyword baconStatement DOWN
syn keyword baconStatement ENDWITH
syn keyword baconStatement ENDUSEC
syn keyword baconStatement FG
syn keyword baconStatement FILE
syn keyword baconStatement FLOATING
syn keyword baconStatement FREE
syn keyword baconStatement FROM
syn keyword baconStatement GETBYTE
syn keyword baconStatement GETFILE
syn keyword baconStatement GETLINE
syn keyword baconStatement GLOBAL
syn keyword baconStatement GOTOXY
syn keyword baconStatement GREEN
syn keyword baconStatement IMPORT
syn keyword baconStatement INCLUDE
syn keyword baconStatement INCR
syn keyword baconStatement INPUT
syn keyword baconStatement INTENSE
syn keyword baconStatement INTERNATIONAL
syn keyword baconStatement INVERSE
syn keyword baconStatement LET
syn keyword baconStatement LOCAL
syn keyword baconStatement LOOKUP
syn keyword baconStatement MAGENTA
syn keyword baconStatement MAKEDIR
syn keyword baconStatement MEMORY
syn keyword baconStatement MEMREWIND
syn keyword baconStatement MEMSTREAM
syn keyword baconStatement MEMTYPE
syn keyword baconStatement MULTICAST
syn keyword baconStatement NETWORK
syn keyword baconStatement NORMAL
syn keyword baconStatement NUMBER
syn keyword baconStatement ODD
syn keyword baconStatement OFF
syn keyword baconStatement OFFSET
syn keyword baconStatement OPEN
syn keyword baconStatement OPTION
syn keyword baconStatement POKE
syn keyword baconStatement PRINT
syn keyword baconStatement PROTO
syn keyword baconStatement PULL
syn keyword baconStatement PUSH
syn keyword baconStatement PUTBYTE
syn keyword baconStatement PUTLINE
syn keyword baconStatement READ
syn keyword baconStatement READING
syn keyword baconStatement READLN
syn keyword baconStatement READWRITE
syn keyword baconStatement RECEIVE
syn keyword baconStatement RECORD
syn keyword baconStatement RED
syn keyword baconStatement REDIM
syn keyword baconStatement RELATE
syn keyword baconStatement RENAME
syn keyword baconStatement REPEAT
syn keyword baconStatement RESET
syn keyword baconStatement RESIZE
syn keyword baconStatement RESTORE
syn keyword baconStatement REWIND
syn keyword baconStatement SEED
syn keyword baconStatement SEEK
syn keyword baconStatement SEND
syn keyword baconStatement SERVER
syn keyword baconStatement SETENVIRON
syn keyword baconStatement SIZE
syn keyword baconStatement SLEEP
syn keyword baconStatement SOCKET
syn keyword baconStatement SORT
syn keyword baconStatement SPLIT
syn keyword baconStatement START
syn keyword baconStatement STARTPOINT
syn keyword baconStatement STEP
syn keyword baconStatement STRING
syn keyword baconStatement SYSTEM
syn keyword baconStatement TCP
syn keyword baconStatement TEXTDOMAIN
syn keyword baconStatement TO
syn keyword baconStatement TRACE
syn keyword baconStatement TRAP
syn keyword baconStatement TYPE
syn keyword baconStatement UDP
syn keyword baconStatement USEC
syn keyword baconStatement VAR
syn keyword baconStatement WHENCE
syn keyword baconStatement WHITE
syn keyword baconStatement WITH
syn keyword baconStatement WRITELN
syn keyword baconStatement WRITING
syn keyword baconStatement YELLOW

" 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 baconIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\$\?\>"
syn match baconIdentifier "\<[a-zA-Z][a-zA-Z0-9_]*\$\?\>"

" Catch errors caused by wrong parenthesis

syn region baconParen transparent start='(' end=')' contains=ALLBUT,@baconParenGroup
syn match baconParenError ")"
syn match baconInParen contained "[{}]"
syn cluster baconParenGroup contains=baconParenError,baconSpecial,baconUserCont,baconUserLabel,baconBitField


syn region baconString start='"' skip='""' end='"'

" Comments

syn match baconTodo /\<TODO\>\|\<todo\>/ contained
syn match baconTodo /\<FIXME\>\|\<fixme\>/ contained
syn match baconTodo /XXX\|xxx/ contained

syn region baconComment start="\<rem\>" end="$" contains=baconTodo
syn region baconComment start="\<REM\>" end="$" contains=baconTodo
syn region baconComment start="\s*'" end="$" contains=baconTodo
" xxx unfinished : '#' is a comment, but only in the first line. the current solution is temporary:
syn region baconComment start="^#!.*" end="$" contains=baconTodo

" Math operators

" xxx unfinished:
syn match baconOperator "[\+\-\=\|\*\/\>\<\%\()[\]]" contains=baconParen

" The default methods for highlighting. Can be overridden later

hi def link baconFunction Function
hi def link baconStatement Statement
hi def link baconProgramFlow Statement
hi def link baconComment Comment
hi def link baconTodo Todo
hi def link baconString String
hi def link baconOperator Special
hi def link baconSpecial Special
"hi def link baconIdentifier Statement

let b:current_syntax = "bacon"


Descargas

Páginas relacionadas

Lowercase BaCon
Programa en BaCon para poder escribir código en BaCon en minúsculas.