<?xml version="1.0" encoding="UTF-8"?>
<!--

 Author: Yevgen Muntyan <muntyan@tamu.edu>
 Copyright (C) 2006-2007 Yevgen Muntyan <muntyan@tamu.edu>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.

 You should have received a copy of the GNU Library General Public
 License along with this library; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.

-->
<language id="yacc" _name="Yacc" _section="Others" version="2.0">
  <metadata>
    <property name="mimetypes">text/x-yacc;text/x-bison</property>
    <property name="globs">*.y;*.yacc</property>
    <property name="line-comment-start">//</property>
    <property name="block-comment-start">/*</property>
    <property name="block-comment-end">*/</property>
  </metadata>

  <styles>
    <style id="inline-c" _name="Inline C Code" map-to="def:keyword"/>
    <style id="grammar" _name="grammar" map-to="def:keyword"/>
    <style id="keyword" _name="keyword" map-to="def:keyword"/>
  </styles>

  <definitions>
    <context id="inline-c">
      <start>^%{</start>
      <end>^%}</end>
      <include>
        <context sub-pattern="0" where="start" style-ref="inline-c" />
        <context sub-pattern="0" where="end" style-ref="inline-c" />
        <context ref="c:c"/>
      </include>
    </context>

    <context id="keywords" style-ref="keyword">
      <prefix>^%</prefix>
      <keyword>name-prefix</keyword>
      <keyword>error-verbose</keyword>
      <keyword>lex-param</keyword>
      <keyword>parse-param</keyword>
      <keyword>expect</keyword>
      <keyword>union</keyword>
      <keyword>token</keyword>
      <keyword>type</keyword>
      <keyword>left</keyword>
      <keyword>right</keyword>
    </context>

    <context id="grammar">
      <start>^%%</start>
      <end>^%%</end>
      <include>
        <context sub-pattern="0" where="start" style-ref="grammar" />
        <context sub-pattern="0" where="end" style-ref="grammar" />
      </include>
    </context>

    <context id="yacc">
      <include>
        <context ref="inline-c"/>
        <context ref="grammar"/>
        <context ref="keywords"/>
        <context ref="c:comment"/>
        <context ref="c:comment-multiline"/>
      </include>
    </context>
  </definitions>
</language>
