<?xml version="1.0" encoding="UTF-8"?>
<itemizer language-context="js">
	<!-- NOTE: The ~(balanced) construct can only be used once per start-zones element, and all other selectors must be adjacent using the "+" rule; additionally, zones surrounding the ~(balanced) zone must be simple selectors (although captures will work) -->
	<!-- function myFunction (...) { ... } -->
	<item name="js.function.named">
		<start-zones>function.definition:has-child(name:capture(name)) + brace.round.open ~(balanced) brace.round.close + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<!-- function myFunction (...) /*some comment*/ { ... } -->
	<item name="js.function.named.commented">
		<start-zones>function.definition:has-child(name:capture(name)) + brace.round.open ~(balanced) brace.round.close + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- variable = function(...) { ... } -->
	<item name="js.function.assignment">
		<start-zones>function.x-assignment:has-child(name:capture(name)) + brace.round.open ~(balanced) brace.round.close + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<!-- variable = function(...) /*comment*/ { ... } -->
	<item name="js.function.assignment.commented">
		<start-zones>function.x-assignment:has-child(name:capture(name)) + brace.round.open ~(balanced) brace.round.close + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- "property": function(...) { ... } -->
	<item name="js.function.property">
		<start-zones>function.x-assignment:has-child(string:has-child(name:capture(name))) + brace.round.open ~(balanced) brace.round.close + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<!-- "property": function(...) /*comment*/ { ... } -->
	<item name="js.function.property.commented">
		<start-zones>function.x-assignment:has-child(string:has-child(name:capture(name))) + brace.round.open ~(balanced) brace.round.close + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- function() { ... } -->
	<item name="js.function.anonymous">
		<class>ESJSAnonymousFunctionItem</class>
		<start-zones>function.definition.anonymous + brace.round.open ~(balanced) brace.round.close + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<!-- function() /*comment*/ { ... } -->
	<item name="js.function.anonymous.commented">
		<class>ESJSAnonymousFunctionItem</class>
		<start-zones>function.definition.anonymous + brace.round.open ~(balanced) brace.round.close + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- switch ( ... ) { ... } -->
	<item name="js.block.control.switch">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control.x-switch:capture(name) + brace.round.open:capture(open-parameters) ~(balanced) brace.round.close:capture(close-parameters) + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<!-- switch ( ... ) /* coment */ { ... } -->
	<item name="js.block.control.switch.commented">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control.x-switch:capture(name) + brace.round.open:capture(open-parameters) ~(balanced) brace.round.close:capture(close-parameters) + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- case 'stuff': ... -->
	<item name="js.block.control.case">
		<class>ESJSChunkBlockItem</class>
		<start-zone>js x-item-start.x-case:capture(name)</start-zone>
		<end-zone>js keyword.control.x-break + punctuation</end-zone>
		<end-before-zone>js brace.curly.close, js x-item-start.x-case</end-before-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- if/for/while (...) { ... } -->
	<item name="js.block.control">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control:not(x-return):capture(name) + brace.round.open:capture(open-parameters) ~(balanced) brace.round.close:capture(close-parameters) + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<!-- if/for/while (...) /* comment */ { ... } -->
	<item name="js.block.control.commented">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control:not(x-return):capture(name) + brace.round.open:capture(open-parameters) ~(balanced) brace.round.close:capture(close-parameters) + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- else { ... } -->
	<item name="js.block.control.else">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control.x-else:capture(name) + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<!-- else /* comment */ { ... } -->
	<item name="js.block.control.else.commented">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control.x-else:capture(name) + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- try { ... } -->
	<item name="js.block.control.try">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control.x-try:capture(name) + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<!-- try /* comment */ { ... } -->
	<item name="js.block.control.try.commented">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control.x-try:capture(name) + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- do { ... } while(...) -->
	<item name="js.block.control.do-while">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control.x-do:capture(name) + brace.curly.open</start-zones>
		<end-zone>brace.curly.close + keyword.control.x-while + brace.round.open:capture(open-parameters) ~ brace.round.close:capture(close-parameters)</end-zone>
	</item>
	<!-- do /* comment */ { ... } while(...) -->
	<item name="js.block.control.do-while.commented">
		<class>ESJSControlBlockItem</class>
		<start-zones>keyword.control.x-do:capture(name) + comment + brace.curly.open</start-zones>
		<end-zone>brace.curly.close + keyword.control.x-while + brace.round.open:capture(open-parameters) ~ brace.round.close:capture(close-parameters)</end-zone>
	</item>
	
	<!-- var something = { ... } -->
	<item name="js.literal.object">
		<class>ESJSLiteralObjectItem</class>
		<start-zones>x-assignment:has-child(name:capture(name)) + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<item name="js.literal.object.quoted">
		<class>ESJSLiteralObjectItem</class>
		<start-zones>x-assignment:has-child(string:has-child(name:capture(name))) + brace.curly.open</start-zones>
		<end-zone>brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- var something = [ ... ] -->
	<item name="js.literal.array">
		<class>ESJSLiteralArrayItem</class>
		<start-zones>x-assignment:has-child(name:capture(name)) + brace.square.open</start-zones>
		<end-zone>brace.square.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	<item name="js.literal.array.quoted">
		<class>ESJSLiteralArrayItem</class>
		<start-zones>x-assignment:has-child(string:has-child(name:capture(name))) + brace.square.open</start-zones>
		<end-zone>brace.square.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- { ... } -->
	<item name="js.block.anonymous">
		<class>ESCodeBlockItem</class>
		<start-zone>js > brace.curly.open, *:not(x-item-block) brace.curly.open</start-zone>
		<end-zone>js > brace.curly.close, *:not(x-item-block) brace.curly.close</end-zone>
		<subitems>
			<include-root-itemizers/>
		</subitems>
	</item>
	
	<!-- //! My Documentation Comment -->
	<item name="js.comment">
	    <class>ESCommentItem</class>
	    <zone>comment.documentation</zone>
	    <subitems>
	    	<item name="js.comment.link">
	    		<class>ESJSMarkupLink</class>
	    		<zone>comment markup.link</zone>
	    	</item>
	    </subitems>
	</item>
	
</itemizer>
