# JOE syntax highlight file for wake

=Idle
=Comment
=Keyword
=Statement	+Keyword
=Conditional	+Statement +Keyword
=Structure	+Type +Keyword
=Bad
=Constant
=Number		+Constant
=FloatNumber	+Number
=DecNumber	+Number
=DblNumber	+Number
=HexNumber	+Number
=OctNumber	+Number
=BinNumber	+Number
=RegExp		+Constant
=String		+Constant
=StringEscape	+Escape +String

=Special	+Escape
=VarId		+Ident
=ConId		+Ident
=VarSym		+Operator

:reset Idle
	*		reset		
	"a-z_"		varid		buffer recolor=-1
	"A-Z"		conid		mark recolor=-1
	"!$%&*+.\-/<>^|~,;" varsym	buffer recolor=-1
	"=:"		equal		recolor=-1
	"()\\"		special		recolor=-1
	"#"		linecomment	recolor=-1
	"0-9"		integerstart	mark noeat
	"\'"		rawlit		recolor=-1
	"`"		reglit		recolor=-1
	"\""		strlit		recolor=-1
	"@{}[]?"	errorstate	noeat

:equal Special
	*		reset		noeat
	"!$%&*+.\-/<>^|~,=:;"	varsym	recolor=-2

:special Special
	*		reset		noeat
	
:errorstate Bad
	*		reset

:conid ConId
	*		reset		noeat
	"a-zA-Z0-9_"	conid
	
:varid VarId
	*		reset		noeat strings
	"data"		struct
	"tuple"		struct
	"def"		stmt
	"target"	stmt
	"match"		stmt
	"require"	stmt
	"if"		cond
	"then"		cond
	"else"		cond
	"here"		kw
	"global"	kw
	"export"	kw
	"import"	kw
	"package"	kw
	"from"		kw
	"type"		kw
	"topic"		kw
	"unary"		kw
	"binary"	kw
	"prim"		kw
	"publish"	kw
	"subscribe"	kw
	"_"		kw
done
	"a-zA-Z0-9_'"	varid

:kw Keyword
	*		reset		noeat

:cond Conditional
	*		reset		noeat

:struct Structure
	*		reset		noeat

:stmt Statement
	*		reset		noeat

:varsym VarSym
	*		reset		noeat
	"!$%&*+.\-/<>^|~,=:;" varsym

:linecomment Comment comment
	*		linecomment
	"\n"		reset

:integerstart DecNumber
	*		decnum
	"0"		intdispatch

:decnum DecNumber
	*		reset		noeat
	"0-9_"		decnum
	"."		fracnum
	"eE"		expsign

:fracnum DblNumber
	*		reset		noeat
	"0-9_"		fracnum
	"eE"		expsign

:expsign DblNumber
	*		reset		noeat recolor=-2
	"0-9_"		expnum		noeat
	"+-"		expnum

:expnum DblNumber
	*		reset		noeat
	"0-9_"		expnum
	
:intdispatch DecNumber
	*		reset		noeat
	"0-7_"		octint		recolor=-2
	"b"		binstart
	"x"		hexstart

:octint OctNumber
	*		reset		noeat
	"0-7_"		octint

:binstart BinNumber
	*		varid		noeat recolor=-2
	"0-1_"		binint		recolor=-3

:binint BinNumber
	*		reset		noeat
	"0-1_"		binint

:hexstart HexNumber
	*		varid		noeat recolor=-2
	"0-9a-fA-F_"	hexint		recolor=-3

:hexint HexNumber
	*		reset		noeat
	"0-9a-fA-F_"	hexint

:rawlit String string
	*		rawlit
	"\'"		reset

:reglit String string
	*		reglit
	"\\\`"		reglit
	"\`"		reset

:strlit String string
	*		strlit
	"\""		reset
	"\n"		errorstate	noeat recolor=-2
	"\\"		escape_strlit	mark recolor=-1
	"{"		subexp_strlit	mark recolor=-1

:subexp_strlit StringEscape string
	*		subexp_strlit
	"}"		strlit

:escape_strlit StringEscape string
	*		strliterror	recolor=-2
	"0-9"		escdecstr
	"xuU"		eschexstrstart
	"{}abfnrtv\\\"\'?"	strlit

:escoctstr StringEscape string
	*		strlit	noeat
	"0-7"		escoctstr

:escdecstr StringEscape string
	*		strlit	noeat
	"0-9"		escdecstr

:eschexstrstart StringEscape string
	*		strliterror	recolor=-3 noeat
	"0-9a-fA-F"	eschexstr

:eschexstr StringEscape string
	*		strlit		noeat
	"0-9a-fA-F"	eschexstr

:strliterror Bad
	*		strlit		noeat
