cortav  cortav.xml at [435c29db6b]

File desk/cortav.xml artifact 1dfb38b2b4 part of check-in 435c29db6b


<?xml version='1.0' encoding='UTF-8'?>
<!--
 [สž] cortav.xml
  ~ lexi hale <lexi@hale.su>
  ยฉ EUPL v1.2
  ? Kate/kwrite-compatible syntax definition for the cortav markup format
  > ln cortav.xml $HOME/.local/share/org.kde.syntax-highlighting/syntax/
  ! NOTE: the Kate syntax engine cannot capture all the syntactic properties
          of Cortav. we do the best we can, but note the following important
          discrepancies:

            1) the inline resource syntax allows a wide range of complex
               brackets pairs such as <!-:[ ]:-!>; the Kate syntax only
               accounts for the pair { }
-->
<language name='Cortav'
			 section='Markup'
			 extensions='*.ct'
			 version='1'
			 kateversion='2.4'>
	<highlighting>
		<list name='extension-directives'>
			<item>uses</item>
			<item>needs</item>
			<item>inhibits</item>
		</list>
		<list name='meta-directives'>
			<item>author</item>
			<item>lang</item>
			<item>pragma</item>
		</list>
		<list name='ctl-directives'>
			<item>when</item>
			<item>unless</item>
			<item>cols</item>
			<item>quote</item>
			<item>include</item>
			<item>embed</item>
		</list>
		<list name='renderer-directives'>
			<item>html</item>
			<item>groff</item>
			<item>ps</item>
			<item>tex</item>
			<item>plaintext</item>
			<item>rtf</item>
			<item>svg</item>
		</list>
		<contexts>
			<context name='init' attribute='Normal Text' lineEndContext='#pop' fallthroughContext='text'>
				<RegExpr String='\\.' attribute='Escaped Char'/>
				<RegExpr attribute='Section Cue' context='sec-ident' String='(#|ยง)+' firstNonSpace='true' />
				<StringDetect String='~~~' attribute='Literal Block Cue' firstNonSpace='true' context='literal-block-cue'/>
				<RegExpr attribute='List' String='[\*:]+' firstNonSpace='true' context='text' />
				<Detect2Chars char='%' char1='%' attribute='Comment' context='comment'/>
				<Detect2Chars char='%' char1='!' attribute='Important Directive Cue' context='directive'/>
				<StringDetect String='%!!' attribute='Critical Directive Cue' firstNonSpace='true' context='directive'/>
				<DetectChar char='%' attribute='Directive Cue' context='directive'/>
				<DetectChar char='@' attribute='Resource Cue' context='resource-ident'/>
				<DetectChar char='$' attribute='Deref Cue' context='block-macro-ident'/>
				<DetectChar char='&amp;' attribute='Deref Cue' context='block-deref-ident'/>
				<Detect2Chars char='&#9;' char1='&#9;' context='refdef'/>
				<DetectChar char='&#9;' context='refdef-id'/>

				<Detect2Chars char='|' char1=':' attribute="Section Cue" context='#pop!table' />
				<Detect2Chars char='+' char1=':' attribute="Section Cue" context='#pop!table' />
				<AnyChar String='|+' attribute="Section Cue" context='#pop!table' />
				<DetectSpaces context="#pop!init"/>
			</context>

			<context name='comment' attribute='Comment' lineEndContext='#pop'>
			</context>
			<context name='error' attribute='Error' lineEndContext='#pop'>
			</context>

			<context name='resource-ident' attribute='Resource Identifier' lineEndContext='#pop'>
				<DetectSpaces context='#pop!resource-line'/>
			</context>
			<context name='resource-line' attribute='Identifier' lineEndContext='#pop'>
				<RegExpr String='\{$' attribute="Span Cue" context='#pop!resource-inline'/>
			</context>
			<context name='resource-inline' attribute='Literal Block' lineEndContext='#pop!resource-inline'>
				<RegExpr String='^}$' attribute="Span Cue" context='#pop'/>
			</context>

			<context name='sec-ident' attribute='Identifier' lineEndContext='#pop'>
				<DetectSpaces context='#pop!sec' attribute='Normal Text'/>
			</context>

			<context name='sec' attribute='Header' lineEndContext='#pop'>
				<IncludeRules context='text'/>
			</context>

			<context name='refdef-id' attribute='Identifier' lineEndContext='#pop'>
				<DetectChar char=':' attribute='Normal Text' context='#pop!refdef'/>
			</context>
			<context name='refdef' attribute='Styled Text' lineEndContext='#pop'>
			</context>

			<context name='directive' attribute='Directive' lineEndContext='#pop'>
				<keyword attribute='Extension Directive' String='extension-directives'/>
				<keyword attribute='Renderer Directive' String='renderer-directives'/>
			</context>

			<context name='text' attribute='Normal Text' lineEndContext='#pop'>
				<RegExpr String='\\.' attribute='Escaped Char'/>
				<DetectChar attribute='Span Delimiter' context='span-cue' char='['/>
				<DetectChar attribute='Macro Delimiter' context='macro' char='{'/>
			</context>

			<context name='span' attribute='Styled Text' lineEndContext='#pop'>
				<IncludeRules context='text'/>
				<DetectChar attribute='Span Delimiter' context='#pop' char=']'/>
			</context>

			<context name='table' attribute='Normal Text' lineEndContext='#pop'>
				<IncludeRules context='text'/>
				<StringDetect attribute='Section Cue' String=':|:'/>
				<StringDetect attribute='Section Cue' String=':+:'/>
				<Detect2Chars attribute='Section Cue' char=':' char1='|'/>
				<Detect2Chars attribute='Section Cue' char=':' char1='+'/>
				<Detect2Chars attribute='Section Cue' char='|' char1=':'/>
				<Detect2Chars attribute='Section Cue' char='+' char1=':'/>
				<AnyChar attribute='Section Cue' String='|+'/>
			</context>

			<context name='macro' attribute='Macro' lineEndContext='#pop'>
				<DetectSpaces context='#pop!macro-body'/>
				<DetectChar attribute='Macro Delimiter' char='}' context='#pop'/>
			</context>

			<context name='macro-body' attribute='Styled Text' lineEndContext='#pop'>
				<IncludeRules context='text'/>
				<DetectChar attribute='Field Delimiter' char='|'/>
				<DetectChar attribute='Macro Delimiter' char='}' context='#pop'/>
			</context>

			<context name='block-macro-ident' attribute='Macro' lineEndContext='#pop'>
				<DetectSpaces context='#pop!block-macro'/>
				<IncludeRules context='text'/>
			</context>

			<context name='block-macro' attribute='Styled Text' lineEndContext='#pop'>
				<RegExpr String='\\.' attribute='Escaped Char'/>
				<DetectChar attribute='Field Delimiter' char='|'/>
				<IncludeRules context='text'/>
			</context>

			<context name='block-deref-ident' attribute='Identifier' lineEndContext='#pop'>
				<DetectSpaces context='#pop!block-deref'/>
			</context>

			<context name='block-deref' attribute='Styled Text' lineEndContext='#pop'>
				<IncludeRules context='text'/>
			</context>

			<context name='span-emph' attribute='Emphatic Text' lineEndContext='#pop'>
				<IncludeRules context='span'/>
			</context>

			<context name='span-strong' attribute='Strong Text' lineEndContext='#pop'>
				<IncludeRules context='span'/>
			</context>

			<context name='span-del' attribute='Deleted Text' lineEndContext='#pop'>
				<IncludeRules context='span'/>
			</context>

			<context name='span-cue' attribute='Span Cue' lineEndContext='#pop' fallthroughContext="error">
				<StringDetect attribute='Span Cue' String='"' context='#pop!flat-span' />

				<DetectChar   attribute='Span Cue' char='!' context='#pop!span-emph' />
				<DetectChar   attribute='Span Cue' char='*' context='#pop!span-strong' />
				<DetectChar   attribute='Span Cue' char='~' context='#pop!span-del' />

				<AnyChar      attribute='Span Cue' String='`$+๐Ÿ”’' context='#pop!span' />
				<StringDetect attribute='Span Cue' String='โ†’' context='#pop!ref' />
				<StringDetect attribute='Span Cue' String='๐Ÿ”—' context='#pop!ref' />
				<DetectChar   attribute='Span Cue' char='>' context='#pop!ref' />
				<DetectChar   attribute='Span Cue' char='^' context='#pop!ref' />
				<DetectChar   attribute='Span Cue' char='&amp;' context='#pop!ref' />
				<DetectChar   attribute='Span Cue' char='#' context='#pop!var-ref' />
				<DetectChar   attribute='Span Cue' char='\' context='#pop!flat-span' />
				<DetectChar   attribute='Span Cue' char='=' context='#pop!inline-math' />
				<Detect2Chars attribute='Comment' char='%' char1='%' context='#pop!inline-comment' />
				<StringDetect String='%!!' attribute='Critical Directive Cue' firstNonSpace='true' context='#pop!inline-directive'/>
				<Detect2Chars attribute='Important Directive Cue' char='%' char1='!' context='#pop!inline-directive' />
				<DetectChar   attribute='Directive Cue' char='%' context='#pop!inline-directive' />
			</context>

			<context name='flat-span' attribute='Unstyled Text' lineEndContext='#pop'>
				<DetectChar attribute='Unstyled Text' context='flat-span' char='['/>
				<Detect2Chars attribute='Escaped Char' context='#stay' char='\' char1=']'/>
				<DetectChar attribute='Span Delimiter' context='#pop' char=']'/>
			</context>

			<context name='inline-comment' attribute='Comment' lineEndContext='#pop'>
				<IncludeRules context='flat-span'/>
			</context>

			<context name='inline-directive' attribute='Directive' lineEndContext='#pop'>
				<IncludeRules context='flat-span'/>
				<AnyChar String=".:!#$%@~'&quot;" attribute='Directive Cue'/>
				<DetectSpaces context='#pop!span'/>
			</context>

			<context name='inline-math' attribute='Emphatic Text' lineEndContext='#pop'>
				<RegExpr String="\b[\d.,]+" attribute="Literal Block"/>
				<RegExpr String="\b0x[a-fA-F\d.,]+" attribute="Literal Block"/>
				<RegExpr String="\b0o[0-7]+" attribute="Literal Block"/>
				<RegExpr String="\b\w+\(" attribute="Resource Identifier"/>
				<DetectChar char=')' attribute="Resource Identifier"/>
				<AnyChar String="+-/รท*ร—=!%^&amp;|&#172;?" attribute="Strong Text"/>
				<IncludeRules context='span'/>
			</context>

			<context name='ref' attribute='Reference' lineEndContext='#pop'>
				<IncludeRules context='flat-span'/>
				<DetectSpaces context='#pop!span'/>
			</context>

			<context name='var-ref' attribute='Reference' lineEndContext='#pop'>
				<WordDetect String="cortav" attribute='Standard Namespace'/>
				<WordDetect String="env" attribute='Standard Namespace'/>
				<DetectChar attribute='Span Delimiter' context='#pop' char=']'/>
			</context>

			<context name='literal-block-cue' attribute='Literal Block Cue' lineEndContext='#pop!literal-block'>
				<RegExpr String='\[[^\]]+\]' attribute='External Reference'/>
				<RegExpr String='#[^\s]+' attribute='Identifier'/>
				<RegExpr String='~~~$' attribute='Literal Block Cue'/>
				<RegExpr String='[^\s]+' attribute='Header'/>
			</context>
			<context name='literal-block' attribute='Literal Block' lineEndContext='#stay'>
				<RegExpr String='~~~$' attribute='Literal Block Cue' firstNonSpace='true' context='#pop'/>
			</context>
		</contexts>
		<itemDatas>
			<itemData name='Normal Text' defStyleNum='dsNormal'/>
			<itemData name='Styled Text' defStyleNum='dsNormal'/>
			<itemData name='Emphatic Text' defStyleNum='dsNormal' italic='true'/>
			<itemData name='Strong Text' defStyleNum='dsNormal' bold='true'/>
			<itemData name='Deleted Text' defStyleNum='dsNormal' strikeOut='true'/>

			<itemData name='Section Cue' defStyleNum='dsKeyword' bold='true'/>
			<itemData name='Deref Cue' defStyleNum='dsKeyword' bold='true'/>
			<itemData name='Header' defStyleNum='dsControlFlow' underline='true'/>
			<itemData name='Identifier' defStyleNum='dsVariable'/>

			<itemData name='Unstyled Text' defStyleNum='dsVerbatimString'/>
			<itemData name='Escaped Char' defStyleNum='dsSpecialChar'/>
			<itemData name='Reference' defStyleNum='dsControlFlow' underline='true'/>
			<itemData name='Span Cue' defStyleNum='dsKeyword' bold='true'/>
			<itemData name='Resource Cue' defStyleNum='dsKeyword' bold='true'/>
			<itemData name='Resource Identifier' defStyleNum='dsVariable' bold='true'/>
			<itemData name='Span Delimiter' defStyleNum='dsKeyword'/>
			<itemData name='Directive' defStyleNum='dsAttribute' bold='true'/>
			<itemData name='Directive Cue' defStyleNum='dsAttribute'/>
			<itemData name='Critical Directive Cue' defStyleNum='dsImport' bold='true'/>
			<itemData name='Important Directive Cue' defStyleNum='dsImport' bold='true'/>
			<itemData name='Extension Directive' defStyleNum='dsImport' bold='true'/>
			<itemData name='Renderer Directive' defStyleNum='dsExtension' bold='true'/>
			<itemData name='Standard Namespace' defStyleNum='dsBuiltIn' bold='true'/>
			<itemData name='Comment' defStyleNum='dsComment'/>
			<itemData name='Error' defStyleNum='dsError'/>
			<itemData name='Macro' defStyleNum='dsPreprocessor' bold='true'/>
			<itemData name='Macro Delimiter' defStyleNum='dsPreprocessor'/>
			<itemData name='Field Delimiter' defStyleNum='dsPreprocessor' bold='true'/>
			<itemData name='List' defStyleNum='dsOperator'/>

			<itemData name='Literal Block' defStyleNum='dsSpecialString'/>
			<itemData name='Literal Block Cue' defStyleNum='dsPreprocessor' bold='true'/>

			<itemData name='External Reference' defStyleNum='dsImport'/>
		</itemDatas>
	</highlighting>
	<general>
		<comments>
			<comment name='singleLine' start='%%' />
		</comments>
		<keywords weakDeliminator='-+:/' />
	</general>
</language>