<?xml version="1.0" encoding="UTF-8"?>
<!--
 This file is part of GtkSourceView

 Authors: Ryuinferno, Paul Lammertsma, Kelly Craft
 Copyright (C) 2013 Ryuinferno <ryuinferno.xda@gmail.com>
 Copyright (C) 2014 Paul Lammertsma <paul@pixplicity.com>
 Copyright (C) 2017 Kelly Craft <mushroomhead52e@gmail.com>

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

 GtkSourceView 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
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with this library; if not, see <http://www.gnu.org/licenses/>.
-->
<language id="logcat" name="logcat" version="2.0" _section="Other">
  <metadata>
    <property name="mimetypes">text/x-logcat</property>
    <property name="globs">*.logcat</property>
  </metadata>

  <styles>
    <style id="comment" name="Comment" map-to="def:comment"/>
    <style id="verbose" name="Verbose" map-to="def:identifier"/>
    <style id="debug"   name="Debug"   map-to="def:shebang"/>
    <style id="info"    name="Info"    map-to="def:string"/>
    <style id="warning" name="Warning" map-to="def:statement"/>
    <style id="error"   name="Error"   map-to="def:number"/>
    <style id="fatal"   name="Fatal"   map-to="def:error"/>
    <style id="others"  name="Others"  map-to="def:comment"/>
  </styles>

  <definitions>
    <context id="comment1" style-ref="comment">
      <start>^---------</start>
      <end>$</end>
    </context>

    <context id="comment2" style-ref="comment">
      <start>^#</start>
      <end>$</end>
    </context>

    <context id="datetime" style-ref="comment">
      <start>^([0-9]{4}-[0-9]{2}|[0-9]{2})-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}</start>
      <end> </end>
    </context>

    <context id="thread" style-ref="comment">
      <start>([ ]+[0-9]+[ ]+|[0-9]{5} )</start>
      <end>([0-9]{5}|[0-9]{4}|[0-9]{3}|[0-9]{2}|[0-9]{1})</end>
    </context>

    <context id="verbose" style-ref="verbose">
      <start>( V |V\/|V\()</start>
      <end>$</end>
    </context>

    <context id="debug" style-ref="debug">
      <start>( D |D\/|D\()</start>
      <end>$</end>
    </context>

    <context id="info" style-ref="info">
      <start>( I |I\/|I\()</start>
      <end>$</end>
    </context>

    <context id="warning" style-ref="warning">
      <start>( W |W\/|W\()</start>
      <end>$</end>
    </context>

    <context id="error" style-ref="error">
      <start>( E |E\/|E\()</start>
      <end>$</end>
    </context>

    <context id="fatal" style-ref="fatal">
      <start>( F |F\/|F\()</start>
      <end>$</end>
    </context>

    <!-- Main context -->
    <context id="logcat" class="no-spell-check">
      <include>
        <context ref="comment1"/>
        <context ref="comment2"/>
        <context ref="datetime"/>
        <context ref="thread"/>
        <context ref="verbose"/>
        <context ref="debug"/>
        <context ref="info"/>
        <context ref="warning"/>
        <context ref="error"/>
        <context ref="fatal"/>
      </include>
    </context>
  </definitions>
</language>
