1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- Kate syntax highlighting for the Objective Caml 'Ocamlllex' -->
<!DOCTYPE language
[
<!-- Regular expresion constants: -->
<!ENTITY LOWER "a-z\300-\326\330-\337"> <!-- Lowercase Latin-1 letters. -->
<!ENTITY UPPER "A-Z\340-\366\370-\377"> <!-- Uppercase Latin-1 letters. -->
<!ENTITY LETTER "&LOWER;&UPPER;"> <!-- All Latin-1 letters. -->
<!ENTITY LIDENT "[&LOWER;_][&LETTER;0-9_']*"> <!-- Lowercase OCaml identifiers. -->
<!ENTITY UIDENT "`?[&UPPER;][&LETTER;0-9_']*"> <!-- Uppercase OCaml identifiers. -->
<!ENTITY IDENT "`?[&LETTER;][&LETTER;0-9_']*"> <!-- All OCaml identifiers. -->
]>
<language name="Objective Caml Ocamlyacc"
section="Sources"
extensions="*.mly"
mimetype=""
version="6"
kateversion="5.79"
priority="10"
author="Glyn Webster (glynwebster@orcon.net.nz) and Vincent Hugot (vincent.hugot@gmail.com)"
license="LGPL" >
<highlighting>
<list name="typed symbol list keywords">
<item>%token</item>
<item>%type</item>
</list>
<list name="symbol list keywords">
<item>%left</item>
<item>%right</item>
<item>%nonassoc</item>
<item>%start</item>
</list>
<list name="rule keywords">
<item>%prec</item>
<item>error</item>
</list>
<contexts>
<!-- Note: Because the Yacc grammar is so simple I've written this so that any symbol
that has not been specifically dealt with by a highlighting rule is an error. -->
<!-- Declaration section: Header sections and Yacc symbol declararations. -->
<!-- A %% marks the end of the Declaration section and the start of the rules section. -->
<context name="Declarations" lineEndContext="#stay" attribute="Error">
<Detect2Chars char="%" char1="{" context="Header" attribute="Normal" beginRegion="header" />
<keyword String="typed symbol list keywords" context="Typed Symbol List" attribute="Keyword" />
<keyword String="symbol list keywords" context="Symbol List" attribute="Keyword" />
<Detect2Chars char="%" char1="%" context="Rules" attribute="Normal" />
<IncludeRules context="General" />
</context>
<!-- Header section: Ocaml code in the declarations between %{ %} brackets -->
<context name="Header" lineEndContext="#stay" attribute="Normal">
<Detect2Chars char="%" char1="}" context="#pop" attribute="Normal" endRegion="header" />
<IncludeRules context="##Objective Caml" includeAttrib="true" />
</context>
<!-- A typed symbol list: an optional Ocaml type declaration between < > brackets, followed by a symbol list. -->
<context name="Typed Symbol List" lineEndContext="#pop" attribute="Error">
<DetectChar char="<" context="Type" attribute="Normal" />
<RegExpr String="&UIDENT;" context="Symbol List" attribute="Uppercase Name (Token)" />
<RegExpr String="&LIDENT;" context="Symbol List" attribute="Lowercase Name (Rule)" />
<IncludeRules context="General" />
</context>
<context name="Type" lineEndContext="#stay" attribute="Normal">
<DetectChar char=">" context="#pop" attribute="Normal" />
<IncludeRules context="##Objective Caml" includeAttrib="true" />
</context>
<!-- A symbol list: one line of sybmol names and option comments. -->
<context name="Symbol List" lineEndContext="#pop" attribute="Error">
<RegExpr String="&UIDENT;" context="#stay" attribute="Uppercase Name (Token)" />
<RegExpr String="&LIDENT;" context="#stay" attribute="Lowercase Name (Rule)" />
<IncludeRules context="General" />
</context>
<!-- Rules section:. -->
<!-- A %% marks the end of the rules section and the start of the trailer section: -->
<context name="Rules" lineEndContext="#stay" attribute="Error">
<Detect2Chars char="%" char1="%" context="Trailer" attribute="Normal" />
<RegExpr String="&IDENT;" context="Rule, Expecting Colon" attribute="Rule Definition Name" beginRegion="rule" />
<IncludeRules context="General" />
</context>
<context name="Rule, Expecting Colon" lineEndContext="#stay" attribute="Error">
<DetectChar char=":" context="Rule" attribute="Normal" />
<!-- Incomplete rule before the start of the trailer: -->
<Detect2Chars char="%" char1="%" context="Trailer" attribute="Error" />
<IncludeRules context="General" />
</context>
<context name="Rule" lineEndContext="#stay" attribute="Error">
<DetectChar char=";" context="#pop#pop" attribute="Normal" endRegion="rule" />
<DetectChar char="|" context="#stay" attribute="Normal" />
<keyword String="rule keywords" context="#stay" attribute="Keyword" />
<RegExpr String="&UIDENT;" context="#stay" attribute="Uppercase Name (Token)" />
<RegExpr String="&LIDENT;" context="#stay" attribute="Lowercase Name (Rule)" />
<DetectChar char="{" context="Action" attribute="Normal" beginRegion="action" />
<IncludeRules context="General" />
</context>
<!-- A rule action: Ocaml code between { } brackets containing $1,$2,$3.. symbols. -->
<!-- (The "Nested Action" contexts override the rules for [ ] and { } brackets in the Objective
Caml highlighting file. They make make the $1,$2,$3.. symbols show up inside those brackets.) -->
<context name="Action" lineEndContext="#stay" attribute="Normal">
<DetectChar char="}" context="#pop" attribute="Normal" endRegion="action" />
<RegExpr String="[$][0-9]+" context="#stay" attribute="Semantic Attribute" />
<DetectChar char="{" context="Nested Action 1" />
<DetectChar char="[" context="Nested Action 2" />
<IncludeRules context="##Objective Caml" includeAttrib="true" />
</context>
<context name="Nested Action 1" lineEndContext="#stay" attribute="Normal">
<DetectChar char="}" context="#pop" />
<IncludeRules context="Action" includeAttrib="true" />
</context>
<context name="Nested Action 2" lineEndContext="#stay" attribute="Normal">
<DetectChar char="]" context="#pop" />
<IncludeRules context="Action" includeAttrib="true" />
</context>
<!-- Trailer section: Ocaml code until the end of the file. -->
<context name="Trailer" lineEndContext="#stay" attribute="Normal">
<IncludeRules context="##Objective Caml" includeAttrib="true" />
</context>
<!-- General rules for all contexts: -->
<!-- 1) Whitespace is expected. -->
<!-- 2) Ocamlyacc's comments are in /* */ brackets and are nestable. -->
<context name="General" lineEndContext="#stay" attribute="Normal">
<DetectSpaces context="#stay" attribute="Normal" />
<Detect2Chars char="/" char1="*" context="Comment" attribute="Comment" beginRegion="comment" />
</context>
<context name="Comment" lineEndContext="#stay" attribute="Comment">
<Detect2Chars char="*" char1="/" context="#pop" attribute="Comment" endRegion="comment" />
<Detect2Chars char="/" char1="*" context="Comment" attribute="Comment" beginRegion="comment" />
<DetectSpaces />
<IncludeRules context="##Comments" />
</context>
</contexts>
<itemDatas>
<itemData name="Keyword" defStyleNum="dsOthers" bold="true" />
<itemData name="Normal" defStyleNum="dsOthers" />
<itemData name="Uppercase Name (Token)" defStyleNum="dsOthers" />
<itemData name="Lowercase Name (Rule)" defStyleNum="dsOthers" italic="true" />
<itemData name="Rule Definition Name" defStyleNum="dsOthers" italic="true" bold="true" />
<itemData name="Semantic Attribute" defStyleNum="dsOthers" />
<itemData name="Comment" defStyleNum="dsComment" />
<itemData name="Error" defStyleNum="dsError" />
</itemDatas>
</highlighting>
<general>
<keywords casesensitive="true" weakDeliminator="%" />
<comments>
<comment name="multiLine" start="/*" end="*/" region="comment" />
</comments>
</general>
</language>
<!-- kate: space-indent on; indent-width 2; replace-tabs on; -->
|