" Vim syntax file
" Language:   nML
" Maintainers:   Hyunjun Eo <poisson@ropas.kaist.ac.kr>
" Last change:   2001 January 26 adding n keywords
"

" Remove any old syntax stuff hanging around.
syn clear

" n is case sensitive.
syn case match

" It respects n strings and constructors

syn keyword  nKeyword	and andalso as do else end and
syn keyword  nKeyword	exception for fn fun
syn keyword  nKeyword	functor handle if in include
syn keyword  nKeyword	land let local lor lsl lsr case
syn keyword  nKeyword	mod of
syn keyword  nKeyword	open orelse raise rec ref sig
syn keyword  nKeyword	struct structure signature then type
syn keyword  nKeyword	unit val where while

syn keyword  nType	int char string real bool exn unit
syn keyword  nType	list array option

syn keyword  nBoolean	true false

syn keyword  nKeyword	not

syn match    nUnit	+()+
syn match    nConstructor /\<[A-Z][0-9A-Za-z_]*\>/
syn region   nString	start=+"+ skip=+\\"+ end=+"+

syn match    nTuple	"(\|)"
syn match    nArray	"\[|\||\]"
syn match    nList	"\[\|\]"
syn match    nRecord	"{\|}"
syn match    nRefAssign	":="
syn match    nTopStop	";;"
syn match    nOperator	"\^"
syn match    nOperator	"::"
syn match    nOperator	"<-"
syn match    nAnyVar	+\<_\>+
syn match    nKeyChar	"!"
syn match    nKeyChar	"|"
syn match    nKeyChar	";"
syn match    nKeyChar	","
syn match    nKeyChar	":"
syn match    nKeyChar	"\.\.\."
syn match    nKeyChar	"\*"
syn match    nKeyChar	"->"
syn match    nKeyChar	"="
syn match    nFunDef	"=>"

syn match    nModQualifier /\<[A-Z][0-9A-Za-z_]*\>[\b]*\./

syn match    nCharacter	+'.'\|'\\[0-9][0-9][0-9]'\|'\\[\'ntbr]'+
syn match    nCharErr	+'\\[0-9][0-9]'\|'\\[0-9]'+
syn match    nCharErr	+'\\[^\'ntbr]'+

syn region   nComment start=+(\*+ end=+\*)+ contains=nComment
syn match    nComment2 "//.*"
syn match    nCommentError +\*)+

"if !exists("n_highlighting_clean")

  " some keywords
  " some common functions are also highlighted as keywords
  " is there a better solution?
  syn keyword nKeyword	trace

  syn match   nNumber	"\<[0123456789]*\>"

"endif

syn sync ccomment maxlines=50

if !exists("did_n_syntax_inits")

  let did_n_syntax_inits = 1

  " The default methods for highlighting.  Can be overridden later

  hi link nComment	Comment
  hi link nComment2	Comment

  hi link nModQualifier	Identifier

  hi link nEnvKeyword	Keyword
  hi link nKeyword	Keyword
  hi link nFunDef	Keyword
  hi link nRefAssign	Keyword
  hi link nKeyChar	Keyword
  hi link nAnyVar	Keyword
  hi link nTuple	Keyword
  hi link nArray	Keyword
  hi link nRecord	Keyword
  hi link nList	Keyword
  hi link nTopStop	Keyword
  hi link nOperator	Keyword

  hi link nUnit		Constant
  hi link nConstructor	Constant

  hi link nBoolean	Boolean
  hi link nCharacter	Character
  hi link nNumber	Number
  hi link nString	String

  hi link nType	Type

  hi link nCommentError	Error
  hi link nCharErr	Error

endif

let b:current_syntax = "n"

" vim: ts=28
