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

0001 <?xml version="1.0" encoding="UTF-8"?>
0002 <!DOCTYPE language>
0003 <!--
0004 ========================================================================
0005 YACC.XML supports syntax highlighting for Yacc/Bison source under Kate.
0006 
0007 Copyright (C) 2004, Jan Villat <jan.villat@net2000.ch>
0008 This code is released under the LGPL as part of kdelibs/kate.
0009 ========================================================================
0010 
0011 
0012 == UPDATE HISTORY ==
0013 2018-02-20 // Nibaldo González <nibgonz@gmail.com>
0014 
0015   Fix '$' symbol, highlighted as 'dsError' by C++ (isocpp.xml).
0016   Update syntax for Bison (3.0.4):
0017    - Add declarations, directives in rules and the '@' variable.
0018    - Allow a tag in '%union', declarations in multiple lines and
0019      grammar declarations in the grammar rules section.
0020    - The ';' char is not necessary to finish a rule. Allow '; |'
0021      within rules.
0022   Add mimetypes and extensions '*.ypp' & '*.y++'.
0023 
0024 2007-10-01 // Sebastian Pipping <webmaster@hartwork.org>
0025 
0026   Added: Extension "*.yy" for Bison
0027 
0028 2004-05-26 // Jan Villat <jan.villat@net2000.ch>
0029 
0030   YACC.XML 1.00 - First released.
0031 
0032 
0033 ========================================================================
0034 -->
0035 <language name="Yacc/Bison" version="9" kateversion="5.79" section="Sources" extensions="*.y;*.yy;*.ypp;*.y++" mimetype="text/x-yacc;text/x-bison" priority="5" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL">
0036 
0037 <highlighting>
0038 <contexts>
0039   <context name="Pre Start" attribute="Normal Text" lineEndContext="#stay">
0040     <IncludeRules context="Comment" />
0041     <DetectSpaces />
0042     <Detect2Chars attribute="Content-Type Delimiter" context="C Declarations" char="%" char1="{" beginRegion="cdeclarations" column="0" />
0043     <RegExpr attribute="Normal Text" context="Declarations" String="." beginRegion="declarations" lookAhead="true" />
0044   </context>
0045 
0046   <context name="C Declarations" attribute="Normal Text" lineEndContext="#stay">
0047     <IncludeRules context="Comment" />
0048     <Detect2Chars attribute="Content-Type Delimiter" context="#pop" char="%" char1="}" endRegion="cdeclarations" column="0" />
0049     <IncludeRules context="##C++" />
0050   </context>
0051 
0052   <context name="Declarations" attribute="Normal Text" lineEndContext="#stay">
0053     <IncludeRules context="Comment" />
0054     <Detect2Chars attribute="Content-Type Delimiter" context="Rules" char="%" char1="%" beginRegion="rules" endRegion="declarations" />
0055     <!-- Prologue Declarations -->
0056     <Detect2Chars attribute="Content-Type Delimiter" context="C Declarations" char="%" char1="{" beginRegion="cdeclarations" column="0" />
0057     <IncludeRules context="Grammar Declarations" />
0058     <WordDetect attribute="Directive" context="Code-Symbols Start" String="%initial-action" />
0059     <WordDetect attribute="Directive" context="Code-Symbols Start" String="%param" />
0060     <WordDetect attribute="Directive" context="Code-Symbols Start" String="%lex-param" />
0061     <WordDetect attribute="Directive" context="Code-Symbols Start" String="%parse-param" />
0062     <WordDetect attribute="Directive" context="Percent Command In" String="%&lt;flag&gt;" />
0063     <!-- Any word followed by '%' (End with ';' or '%') -->
0064     <DetectChar attribute="Directive" context="Percent Command" char="%" />
0065   </context>
0066   <context name="Grammar Declarations" attribute="Normal Text" lineEndContext="#stay">
0067     <WordDetect attribute="Directive" context="Union Start" String="%union" />
0068     <WordDetect attribute="Directive" context="Union Start" String="%code" />
0069     <WordDetect attribute="Directive" context="Code-Symbols Start" String="%destructor" />
0070     <WordDetect attribute="Directive" context="Code-Symbols Start" String="%printer" />
0071   </context>
0072 
0073   <context name="Union Start" attribute="Normal Text" lineEndContext="#stay">
0074     <IncludeRules context="Comment" />
0075     <DetectSpaces />
0076     <DetectChar attribute="Normal Text" context="Union In" char="{" beginRegion="union" />
0077     <RegExpr attribute="Normal Text" context="#pop!Union Tag" String="[^\s\{](?=\s|$|//)" />
0078   </context>
0079   <context name="Union Tag" attribute="Normal Text" lineEndContext="#stay">
0080     <IncludeRules context="Comment" />
0081     <DetectSpaces />
0082     <DetectChar attribute="Normal Text" context="Union In" char="{" beginRegion="union" />
0083     <RegExpr attribute="Alert" context="#pop" String="." />
0084   </context>
0085   <context name="Union In" attribute="Normal Text" lineEndContext="#stay">
0086     <DetectChar attribute="Normal Text" context="Union InIn" char="{" />
0087     <DetectChar attribute="Normal Text" context="#pop#pop" char="}" endRegion="union" />
0088     <IncludeRules context="##C++" />
0089   </context>
0090   <context name="Union InIn" attribute="Normal Text" lineEndContext="#stay">
0091     <DetectChar attribute="Normal Text" context="Union InIn" char="{" />
0092     <DetectChar attribute="Normal Text" context="#pop" char="}" />
0093     <IncludeRules context="##C++" />
0094   </context>
0095 
0096   <!-- '%'<decl> ('{' <Code-Symbols In> '}')+ <Percent Command In> [';'] -->
0097   <context name="Code-Symbols Start" attribute="Normal Text" lineEndContext="#stay">
0098     <IncludeRules context="Comment" />
0099     <DetectSpaces />
0100     <DetectChar attribute="Normal Text" context="Code-Symbols In" char="{" beginRegion="code-symbols" />
0101     <RegExpr attribute="Alert" context="#pop" String="." />
0102   </context>
0103   <context name="Code-Symbols In" attribute="Normal Text" lineEndContext="#stay">
0104     <DetectChar attribute="Normal Text" context="#pop#pop!Code-Symbols End" char="}" endRegion="code-symbols" />
0105     <DetectChar attribute="Normal Text" context="Code-Symbols InIn" char="{" />
0106     <IncludeRules context="Symbol-Variable" />
0107     <IncludeRules context="##C++" />
0108   </context>
0109   <context name="Code-Symbols InIn" attribute="Normal Text" lineEndContext="#stay">
0110     <DetectChar attribute="Normal Text" context="Code-Symbols InIn" char="{" />
0111     <DetectChar attribute="Normal Text" context="#pop" char="}" />
0112     <IncludeRules context="Symbol-Variable" />
0113     <IncludeRules context="##C++" />
0114   </context>
0115   <context name="Code-Symbols End" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop!Percent Command In">
0116     <IncludeRules context="Comment" />
0117     <DetectSpaces />
0118     <DetectChar attribute="Normal Text" context="#pop" char=";" lookAhead="true" />
0119     <DetectChar attribute="Normal Text" context="Code-Symbols In" char="{" beginRegion="code-symbols" />
0120   </context>
0121 
0122   <context name="Rules" attribute="Rule" lineEndContext="#stay">
0123     <IncludeRules context="Comment" />
0124     <Detect2Chars attribute="Content-Type Delimiter" context="User Code" char="%" char1="%" beginRegion="code" endRegion="rules" />
0125     <DetectChar attribute="Normal Text" context="Rule In" char=":" beginRegion="rule" />
0126     <DetectChar attribute="Rule" context="Grammar Declaration Start" char="%" lookAhead="true" />
0127   </context>
0128 
0129   <context name="Rule In" attribute="Definition" lineEndContext="#stay">
0130     <IncludeRules context="Comment" />
0131     <DetectChar attribute="Normal Text" context="Rule End" char=";" endRegion="rule" />
0132     <DetectChar attribute="Normal Text" context="Normal C Bloc" char="{" beginRegion="bloc" />
0133     <DetectChar attribute="Normal Text" context="#stay" char="|" />
0134     <IncludeRules context="StringOrChar" />
0135     <RegExpr attribute="Directive" context="#stay" String="%\?(?=\{)" />
0136     <WordDetect attribute="Directive" context="#stay" String="%empty" />
0137     <WordDetect attribute="Directive" context="#stay" String="%prec" />
0138     <WordDetect attribute="Directive" context="#stay" String="%dprec" />
0139     <WordDetect attribute="Directive" context="#stay" String="%merge" />
0140 
0141     <!-- Finish rule without the ';' character (see the 'rhses.1' rule in the 'src/parse-gram.y' file, from the Bison source) -->
0142     <RegExpr attribute="Open Rule" context="#pop" String="^[\w\-\.](?=[\w\-\.]*:)" column="0" endRegion="rule" />
0143     <Detect2Chars attribute="Content-Type Delimiter" context="#pop" char="%" char1="%" lookAhead="true" firstNonSpace="true" endRegion="rule" />
0144     <RegExpr attribute="Directive" context="#pop" String="^%(?:union|code|destructor|printer|start|(?:no\-)?default\-prec|nterm|token|type|left|right|nonassoc|precedence)\b" lookAhead="true" column="0" endRegion="rule" />
0145   </context>
0146   <!-- The Bison parser allows to have ';' followed by '|', without the rule ending.
0147        The problem here is that the ';' char has endRegion="rule" (although it is not very relevant). -->
0148   <context name="Rule End" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop#pop">
0149     <DetectSpaces />
0150     <DetectChar attribute="Normal Text" context="#stay" char=";" />
0151     <DetectChar attribute="Normal Text" context="#pop" char="|" />
0152     <IncludeRules context="Comment" />
0153   </context>
0154 
0155   <context name="Grammar Declaration Start" attribute="Normal Text" lineEndContext="#stay">
0156     <!-- In the rules section, only highlighting exact declarations -->
0157     <IncludeRules context="Grammar Declarations" />
0158     <WordDetect attribute="Directive" context="Percent Command In" String="%start" />
0159     <WordDetect attribute="Directive" context="Percent Command In" String="%default-prec" />
0160     <WordDetect attribute="Directive" context="Percent Command In" String="%no-default-prec" />
0161     <WordDetect attribute="Directive" context="Percent Command In" String="%nterm" />
0162     <WordDetect attribute="Directive" context="Percent Command In" String="%token" />
0163     <WordDetect attribute="Directive" context="Percent Command In" String="%type" />
0164     <WordDetect attribute="Directive" context="Percent Command In" String="%left" />
0165     <WordDetect attribute="Directive" context="Percent Command In" String="%right" />
0166     <WordDetect attribute="Directive" context="Percent Command In" String="%nonassoc" />
0167     <WordDetect attribute="Directive" context="Percent Command In" String="%precedence" />
0168 
0169     <DetectChar attribute="Rule" context="#pop" char="%" /> <!-- End when there is an invalid declaration -->
0170     <DetectChar attribute="Normal Text" context="#pop" char=";" />
0171     <IncludeRules context="Comment" />
0172     <DetectSpaces />
0173     <RegExpr attribute="Alert" context="#pop" String=".+" />
0174   </context>
0175 
0176   <context name="User Code" attribute="Normal Text" lineEndContext="#stay">
0177     <IncludeRules context="##C++" />
0178   </context>
0179 
0180   <context name="Percent Command" attribute="Directive" lineEndContext="#pop!Percent Command In">
0181     <IncludeRules context="Comment" />
0182     <RegExpr attribute="Normal Text" context="#pop!Percent Command In" String="[^\w\-]" lookAhead="true" />
0183   </context>
0184   <context name="Percent Command In" attribute="Normal Text" lineEndContext="#stay">
0185     <!-- This can be applied to multiple lines -->
0186     <DetectChar attribute="Normal Text" context="#pop" char=";" lookAhead="true" />
0187     <DetectChar attribute="Normal Text" context="#pop" char="%" lookAhead="true" firstNonSpace="true" />
0188     <Detect2Chars attribute="Normal Text" context="#pop" char="%" char1="%" lookAhead="true" />
0189     <IncludeRules context="StringOrChar" />
0190     <DetectChar attribute="Data Type" context="PC type" char="&lt;" />
0191     <IncludeRules context="Comment" />
0192   </context>
0193   <context name="PC type" attribute="Data Type" lineEndContext="#pop#pop">
0194     <DetectChar attribute="Data Type" context="#pop" char="&gt;" />
0195   </context>
0196 
0197   <context name="Comment" attribute="Comment" lineEndContext="#stay">
0198     <Detect2Chars attribute="Comment" context="CommentStar" char="/" char1="*" beginRegion="comment" />
0199     <Detect2Chars attribute="Comment" context="CommentSlash" char="/" char1="/" />
0200   </context>
0201   <context name="CommentStar" attribute="Comment" lineEndContext="#stay">
0202     <DetectSpaces />
0203     <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="comment" />
0204     <IncludeRules context="##Comments" />
0205   </context>
0206   <context name="CommentSlash" attribute="Comment" lineEndContext="#pop">
0207     <DetectSpaces />
0208     <IncludeRules context="##Comments" />
0209   </context>
0210 
0211   <context name="StringOrChar" attribute="Normal Text" lineEndContext="#stay">
0212     <DetectChar attribute="String Char" context="Char" char="'" />
0213     <DetectChar attribute="String" context="String" char="&quot;" />
0214   </context>
0215   <context name="String" attribute="String" lineEndContext="#pop">
0216     <RegExpr attribute="Backslash Code" context="#stay" String="\\." />
0217     <DetectChar attribute="String" context="#pop" char="&quot;" />
0218   </context>
0219   <context name="Char" attribute="String Char" lineEndContext="#pop">
0220     <RegExpr attribute="Backslash Code" context="#stay" String="\\." />
0221     <DetectChar attribute="String Char" context="#pop" char="'" />
0222   </context>
0223 
0224   <context name="Normal C Bloc" attribute="Normal Text" lineEndContext="#stay">
0225     <DetectChar attribute="Normal Text" context="Normal C Bloc" char="{" beginRegion="bloc" />
0226     <DetectChar attribute="Normal Text" context="#pop" char="}" endRegion="bloc" />
0227     <IncludeRules context="Symbol-Variable" />
0228     <IncludeRules context="##C++" />
0229   </context>
0230   <context name="Symbol-Variable" attribute="Normal Text" lineEndContext="#stay">
0231     <DetectChar attribute="Directive" context="Dol" char="$" />
0232     <RegExpr attribute="Directive" context="#stay" String="@\$?(?:\d+|[A-Za-z_]\w*)?" />
0233   </context>
0234   <context name="Dol" attribute="Normal Text" fallthroughContext="DolEnd" lineEndContext="#stay">
0235     <RegExpr attribute="Data Type" context="DolEnd" String="&lt;[^&gt;]+&gt;" />
0236   </context>
0237   <context name="DolEnd" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop#pop">
0238     <RegExpr attribute="Directive" context="#pop#pop" String="@?\d+" />
0239     <DetectChar attribute="Directive" context="#pop#pop" char="$" />
0240     <DetectIdentifier attribute="Directive" context="#pop#pop" />
0241   </context>
0242 </contexts>
0243 
0244 <itemDatas>
0245   <itemData name="Normal Text" defStyleNum="dsNormal" />
0246   <itemData name="Definition" defStyleNum="dsNormal" />
0247   <itemData name="Comment" defStyleNum="dsComment" />
0248   <itemData name="Content-Type Delimiter" defStyleNum="dsBaseN" bold="1" />
0249   <itemData name="Directive" defStyleNum="dsKeyword"/>
0250   <itemData name="Rule" defStyleNum="dsString" />
0251   <itemData name="Open Rule" defStyleNum="dsString" bold="1" />
0252   <itemData name="Backslash Code" defStyleNum="dsString" bold="1" />
0253   <itemData name="Alert" defStyleNum="dsAlert" />
0254   <itemData name="String" defStyleNum="dsString"/>
0255   <itemData name="String Char" defStyleNum="dsChar"/>
0256   <itemData name="Data Type" defStyleNum="dsDataType"/>
0257 </itemDatas>
0258 
0259 </highlighting>
0260 <general>
0261   <comments>
0262     <comment name="multiLine" start="/*" end="*/" region="comment" />
0263     <comment name="singleLine" start="//" />
0264   </comments>
0265 </general>
0266 </language>
0267 <!-- kate: space-indent on; indent-width 2; replace-tabs on; -->