Menu

[dc0a3d]: / syntax / yaml.jsf  Maximize  Restore  History

Download this file

153 lines (119 with data), 2.7 kB

# JOE syntax highlight file for YAML
# by Christian Nicolai (http://mycrobase.de)

# TODO: Could use numbers vs strings for Constant, but it's a bit of work
#       Array elements with colons get misidentified as keys

=Idle
=Comment
=Constant
=String		+Constant
=Number		+Constant
=Escape
=StringEscape	+Escape +String
=Type
=Bad
=Brace

=Key		+Attr +Type +String
=Directive	+Keyword
=Reference	+Label +DefinedIdent
=LocalType	+DefinedType +Type
=BlockDelim	+Operator

=BadTab		+Bad

:line_start Idle
	*		maybe_key	noeat
	"\t"		bad_tab		recolor=-1
	" "		line_start

:idle Constant
	*		idle
	"\n"		line_start
	"%"		directive	recolor=-1
	"#"		line_comment	recolor=-1
	"'"		string_sq_1	recolor=-1
	"\""		string_dq_1	recolor=-1
	"{[]}"		brace		recolor=-1
	"."		maybe_block_end1
	"*&"		maybe_reference
	"!"		maybe_typecast

:maybe_key Idle
	*		maybe_key1	recolor=-1 mark
	"\n%#'\"{[]}*&!"	idle		noeat
	"-"		maybe_block1	mark

:maybe_key1 Constant
	*		idle		noeat
	":"		key
	" a-zA-Z0-9_-"	maybe_key1

# necessary to include the :
:key Key
	*		key_end		noeat recolormark

:key_end Key
	*		idle		noeat

# mark bad tabs until the first non-whitespace
:bad_tab BadTab
	*		line_start	noeat

:line_comment Comment comment
	*		line_comment
	"\n"		line_start
	"BFHNTX"	line_comment	noeat call=comment_todo.comment_todo()

:brace Brace
	*		idle		noeat

:directive Directive
	*		directive
	"\n"		line_start

:string_sq_1 String string
	*		string_sq	noeat

:string_sq String string
	*		string_sq
	"\'"		idle
	"\\"		string_sq_esc	recolor=-1

:string_sq_esc StringEscape string
	*		string_sq
	"\n"		string_sq	recolor=-2

:string_dq_1 String string
	*		string_dq	noeat

:string_dq String string
	*		string_dq
	"\""		idle
	"\\"		string_dq_esc	recolor=-1

:string_dq_esc StringEscape string
	*		string_dq
	"\n"		string_dq	recolor=-2

:maybe_block1 Constant
	*		maybe_key1	noeat
	"-"		maybe_block2

:maybe_block2 Constant
	*		maybe_key1	noeat
	"-"		block		recolor=-3

:block BlockDelim
	*		idle		noeat

:maybe_block_end1 String string
	*		idle		noeat
	"."		maybe_block_end2

:maybe_block_end2 String string
	*		idle		noeat
	"."		block_end	recolor=-3

:block_end BlockDelim
	*		idle		noeat

:maybe_reference Constant
	*		idle
	"a-zA-Z_"	reference	recolor=-2

:reference Reference
	*		idle		noeat
	"a-zA-Z0-9_"	reference

:maybe_typecast Constant
	*		idle		noeat
	"a-zA-Z_"	local_type	recolor=-1
	"!"		builtin_type

:builtin_type Idle
	*		idle		noeat
	"a-zA-Z"	builtin_type2	buffer

:builtin_type2 Idle
	*		idle		noeat strings
	"str"		type
	"float"		type
	"binary"	type
done
	"a-zA-Z_"	builtin_type2

:type Type
	*		idle		noeat

:local_type LocalType
	*		idle		noeat
	"a-zA-Z_"	local_type
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.