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