Warning, /frameworks/syntax-highlighting/data/syntax/ocamlyacc.xml is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" encoding="UTF-8"?>
0002 <!-- Kate syntax highlighting for the Objective Caml 'Ocamlllex' -->
0003 <!DOCTYPE language
0004 [
0005 <!-- Regular expresion constants: -->
0006 <!ENTITY LOWER  "a-z\300-\326\330-\337">         <!-- Lowercase Latin-1 letters. -->
0007 <!ENTITY UPPER  "A-Z\340-\366\370-\377">         <!-- Uppercase Latin-1 letters. -->
0008 <!ENTITY LETTER "&LOWER;&UPPER;">                <!-- All Latin-1 letters. -->
0009 <!ENTITY LIDENT "[&LOWER;_][&LETTER;0-9_']*">    <!-- Lowercase OCaml identifiers. -->
0010 <!ENTITY UIDENT "`?[&UPPER;][&LETTER;0-9_']*">   <!-- Uppercase OCaml identifiers. -->
0011 <!ENTITY IDENT  "`?[&LETTER;][&LETTER;0-9_']*">  <!-- All OCaml identifiers. -->
0012 ]>
0013 <language name="Objective Caml Ocamlyacc"
0014           section="Sources"
0015           extensions="*.mly"
0016           mimetype=""
0017           version="6"
0018           kateversion="5.79"
0019           priority="10"
0020           author="Glyn Webster (glynwebster@orcon.net.nz) and Vincent Hugot (vincent.hugot@gmail.com)"
0021           license="LGPL" >
0022 
0023   <highlighting>
0024     <list name="typed symbol list keywords">
0025       <item>%token</item>
0026       <item>%type</item>
0027     </list>
0028 
0029     <list name="symbol list keywords">
0030       <item>%left</item>
0031       <item>%right</item>
0032       <item>%nonassoc</item>
0033       <item>%start</item>
0034     </list>
0035 
0036     <list name="rule keywords">
0037       <item>%prec</item>
0038       <item>error</item>
0039     </list>
0040 
0041     <contexts>
0042       <!-- Note: Because the Yacc grammar is so simple I've written this so that any symbol
0043            that has not been specifically dealt with by a highlighting rule is an error. -->
0044 
0045       <!-- Declaration section: Header sections and Yacc symbol declararations. -->
0046       <!-- A %% marks the end of the Declaration section and the start of the rules section. -->
0047       <context name="Declarations" lineEndContext="#stay" attribute="Error">
0048         <Detect2Chars char="%" char1="{"                  context="Header"            attribute="Normal" beginRegion="header" />
0049         <keyword      String="typed symbol list keywords" context="Typed Symbol List" attribute="Keyword" />
0050         <keyword      String="symbol list keywords"       context="Symbol List"       attribute="Keyword" />
0051         <Detect2Chars char="%" char1="%"                  context="Rules"             attribute="Normal" />
0052         <IncludeRules context="General" />
0053       </context>
0054 
0055       <!-- Header section: Ocaml code in the declarations between %{ %} brackets -->
0056       <context name="Header" lineEndContext="#stay" attribute="Normal">
0057         <Detect2Chars char="%" char1="}" context="#pop" attribute="Normal" endRegion="header" />
0058         <IncludeRules context="##Objective Caml" includeAttrib="true" />
0059       </context>
0060 
0061       <!-- A typed symbol list: an optional Ocaml type declaration between < > brackets, followed by a symbol list. -->
0062         <context name="Typed Symbol List" lineEndContext="#pop" attribute="Error">
0063         <DetectChar char="&lt;" context="Type" attribute="Normal" />
0064         <RegExpr String="&UIDENT;" context="Symbol List" attribute="Uppercase Name (Token)" />
0065         <RegExpr String="&LIDENT;" context="Symbol List" attribute="Lowercase Name (Rule)" />
0066         <IncludeRules context="General" />
0067       </context>
0068       <context name="Type" lineEndContext="#stay" attribute="Normal">
0069         <DetectChar char="&gt;" context="#pop" attribute="Normal" />
0070         <IncludeRules context="##Objective Caml" includeAttrib="true" />
0071       </context>
0072 
0073       <!-- A symbol list: one line of sybmol names and option comments. -->
0074       <context name="Symbol List" lineEndContext="#pop" attribute="Error">
0075         <RegExpr String="&UIDENT;" context="#stay" attribute="Uppercase Name (Token)" />
0076         <RegExpr String="&LIDENT;" context="#stay" attribute="Lowercase Name (Rule)" />
0077         <IncludeRules context="General" />
0078       </context>
0079 
0080       <!-- Rules section:. -->
0081       <!-- A %% marks the end of the rules section and the start of the trailer section: -->
0082       <context name="Rules" lineEndContext="#stay" attribute="Error">
0083         <Detect2Chars char="%" char1="%" context="Trailer" attribute="Normal" />
0084         <RegExpr String="&IDENT;" context="Rule, Expecting Colon" attribute="Rule Definition Name" beginRegion="rule" />
0085         <IncludeRules context="General" />
0086       </context>
0087       <context name="Rule, Expecting Colon" lineEndContext="#stay" attribute="Error">
0088         <DetectChar char=":" context="Rule" attribute="Normal" />
0089         <!-- Incomplete rule before the start of the trailer: -->
0090         <Detect2Chars char="%" char1="%" context="Trailer" attribute="Error" />
0091         <IncludeRules context="General" />
0092       </context>
0093       <context name="Rule" lineEndContext="#stay" attribute="Error">
0094         <DetectChar char=";"               context="#pop#pop" attribute="Normal" endRegion="rule" />
0095         <DetectChar char="|"               context="#stay"    attribute="Normal" />
0096         <keyword    String="rule keywords" context="#stay"    attribute="Keyword" />
0097         <RegExpr    String="&UIDENT;"      context="#stay"    attribute="Uppercase Name (Token)" />
0098         <RegExpr    String="&LIDENT;"      context="#stay"    attribute="Lowercase Name (Rule)" />
0099         <DetectChar char="{"               context="Action"   attribute="Normal" beginRegion="action" />
0100         <IncludeRules context="General" />
0101       </context>
0102 
0103       <!-- A rule action: Ocaml code between { } brackets containing $1,$2,$3.. symbols. -->
0104       <!-- (The "Nested Action" contexts override the rules for [ ] and { } brackets in the Objective
0105            Caml highlighting file. They make make the $1,$2,$3.. symbols show up inside those brackets.) -->
0106       <context name="Action" lineEndContext="#stay" attribute="Normal">
0107         <DetectChar char="}" context="#pop" attribute="Normal" endRegion="action" />
0108         <RegExpr String="[$][0-9]+" context="#stay" attribute="Semantic Attribute" />
0109         <DetectChar char="{" context="Nested Action 1" />
0110         <DetectChar char="[" context="Nested Action 2" />
0111         <IncludeRules context="##Objective Caml" includeAttrib="true" />
0112       </context>
0113       <context name="Nested Action 1" lineEndContext="#stay" attribute="Normal">
0114         <DetectChar char="}" context="#pop" />
0115         <IncludeRules context="Action" includeAttrib="true" />
0116       </context>
0117       <context name="Nested Action 2" lineEndContext="#stay" attribute="Normal">
0118         <DetectChar char="]" context="#pop" />
0119         <IncludeRules context="Action" includeAttrib="true" />
0120       </context>
0121 
0122       <!-- Trailer section: Ocaml code until the end of the file. -->
0123       <context name="Trailer" lineEndContext="#stay" attribute="Normal">
0124         <IncludeRules context="##Objective Caml" includeAttrib="true" />
0125       </context>
0126 
0127       <!-- General rules for all contexts: -->
0128       <!-- 1) Whitespace is expected. -->
0129       <!-- 2) Ocamlyacc's comments are in /* */ brackets and are nestable. -->
0130       <context name="General" lineEndContext="#stay" attribute="Normal">
0131         <DetectSpaces context="#stay" attribute="Normal" />
0132         <Detect2Chars char="/" char1="*" context="Comment" attribute="Comment" beginRegion="comment" />
0133       </context>
0134       <context name="Comment" lineEndContext="#stay" attribute="Comment">
0135         <Detect2Chars char="*" char1="/" context="#pop"    attribute="Comment" endRegion="comment" />
0136         <Detect2Chars char="/" char1="*" context="Comment" attribute="Comment" beginRegion="comment" />
0137         <DetectSpaces />
0138         <IncludeRules context="##Comments" />
0139       </context>
0140 
0141     </contexts>
0142 
0143     <itemDatas>
0144       <itemData name="Keyword"                defStyleNum="dsOthers" bold="true" />
0145       <itemData name="Normal"                 defStyleNum="dsOthers" />
0146       <itemData name="Uppercase Name (Token)" defStyleNum="dsOthers" />
0147       <itemData name="Lowercase Name (Rule)"  defStyleNum="dsOthers" italic="true" />
0148       <itemData name="Rule Definition Name"   defStyleNum="dsOthers" italic="true" bold="true" />
0149       <itemData name="Semantic Attribute"     defStyleNum="dsOthers" />
0150       <itemData name="Comment"                defStyleNum="dsComment" />
0151       <itemData name="Error"                  defStyleNum="dsError"  />
0152     </itemDatas>
0153   </highlighting>
0154 
0155   <general>
0156     <keywords casesensitive="true" weakDeliminator="%" />
0157     <comments>
0158       <comment name="multiLine" start="/*" end="*/" region="comment" />
0159     </comments>
0160   </general>
0161 </language>
0162 <!-- kate: space-indent on; indent-width 2; replace-tabs on; -->