" Vim syntax file for SnowC
" Language: SnowC (Semantic Non-Optional Whitespace C)
" Maintainer: Chris X Edwards
" Last Change: 2026-06-13

nnoremap <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>


" runtime = load file on startup, ! = all matching files, [^!] = only first found
runtime! syntax/c.vim
" Remove internal variable, b: = a variable local to this buffer
unlet b:current_syntax

" Don't need spell check. See `:help syn-spell`
syntax spell notoplevel

" match or ignore - can be changed by calling this again later. See `:help syn-case`
syntax case match

syntax sync fromstart

" Keywords
syntax keyword snowcKeyword if else switch case default for while do break continue return goto
syntax keyword snowcType int float double char void short long signed unsigned struct union enum typedef
syntax keyword snowcStorageClass auto register static extern const volatile

" Operators
"syntax match snowcOperator "[\+\-*/%&|^~!=<>]=?\|\&\&\|\|\|\+\+\|\-\-"
"syntax match snowcOperator "[\+\-*/%&|^~!=<>]=?\|\&\&\|\-\-\|+\+"
syntax match snowcOperator "[+\-*/%&|^~!=<>]"
syntax match snowcOperator "=?\|&&\|\-\-"

"syntax match snowcOperator "=?\|\&\&\|\-\-\|\+\+"

" Ternary operator
syntax match snowcTernary "?\|\:"

" Line continuation
syntax match snowcLineContinuation "\\$"

" Preprocessor directives
syntax region snowcPreProc start="^\s*#" end="$" contains=snowcString,snowcChar

" Comments
syntax region snowcComment start="/\*" end="\*/" contains=snowcTodo
syntax match snowcComment "//.*$"

" Strings and Characters
syntax region snowcString start="\"" end="\"" skip="\\\\|\\\""
syntax match snowcChar "'\\?\\.'"

" Indentation-based blocks (detect based on indent)
"syntax region snowcBlock start=/\v^(\s*)::/ end=/\v^\s*$/ contains=snowcKeyword,snowcType,snowcStorageClass,snowcOperator,snowcString,snowcChar,snowcComment,snowcLineContinuation,snowcBlock,snowcTernary

" Highlighting
highlight def link snowcPreProc PreProc
highlight def link snowcChar Character
highlight def link snowcString String
highlight def link snowcKeyword Keyword
highlight def link snowcType Type
highlight def link snowcStorageClass StorageClass
highlight def link snowcOperator Operator
highlight def link snowcTernary Special
highlight def link snowcForClause Statement
highlight def link snowcLineContinuation Special
highlight def link snowcBlock Normal
highlight def link snowcComment Comment

" Set the current syntax to hopefully avoid others clobbering it.
let b:current_syntax = "snowc"
