[gtksourceview] Split cpphdr.lang



commit a2e4274d7b7707e2f7f89ada15b949e9a88799d8
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon May 11 21:43:26 2015 +0200

    Split cpphdr.lang
    
    It is basically the same as chdr and chdr still needs to support
    C++ contexts since .h is still used for C++ and ObjC, however
    when using .hh etc we can apply a dedicated lang file and allow
    gnome-builder to use C++ specific settings

 data/language-specs/Makefile.am |    1 +
 data/language-specs/chdr.lang   |   12 +++++++++-
 data/language-specs/cpphdr.lang |   42 +++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in                  |    1 +
 4 files changed, 54 insertions(+), 2 deletions(-)
---
diff --git a/data/language-specs/Makefile.am b/data/language-specs/Makefile.am
index c04ec22..3be09d6 100644
--- a/data/language-specs/Makefile.am
+++ b/data/language-specs/Makefile.am
@@ -18,6 +18,7 @@ LANGUAGES =                   \
        cmake.lang              \
        cobol.lang              \
        cpp.lang                \
+       cpphdr.lang             \
        csharp.lang             \
        css.lang                \
        csv.lang                \
diff --git a/data/language-specs/chdr.lang b/data/language-specs/chdr.lang
index f30d68e..ba3b004 100644
--- a/data/language-specs/chdr.lang
+++ b/data/language-specs/chdr.lang
@@ -24,13 +24,21 @@
 -->
 <language id="chdr" _name="C/C++/ObjC Header" version="2.0" _section="Source">
   <metadata>
-    <property name="mimetypes">text/x-chdr;text/x-c++hdr</property>
-    <property name="globs">*.hh;*.hp;*.hpp;*.h++;*.h</property>
+    <property name="mimetypes">text/x-chdr</property>
+    <property name="globs">*.h</property>
     <property name="line-comment-start">//</property>
     <property name="block-comment-start">/*</property>
     <property name="block-comment-end">*/</property>
   </metadata>
 
+  <!--
+    We include C++ and ObjC contexts since the .h extension
+    is also used for those languages. If you use .hh
+    or similar, we will use cpphdr.lang which is
+    basically the same thing, but having a separate lang file
+    allows a program to apply a language specific behavior,
+    for instance a different style for C++ headers.
+  -->
   <definitions>
     <context id="chdr">
       <include>
diff --git a/data/language-specs/cpphdr.lang b/data/language-specs/cpphdr.lang
new file mode 100644
index 0000000..a041f99
--- /dev/null
+++ b/data/language-specs/cpphdr.lang
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ This file is part of GtkSourceView
+
+ Authors: Marco Barisione, Emanuele Aina
+ Copyright (C) 2005-2007 Marco Barisione <barisione gmail com>
+ Copyright (C) 2005-2007 Emanuele Aina
+
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+-->
+<language id="cpphdr" _name="C++ Header" version="2.0" _section="Source">
+  <metadata>
+    <property name="mimetypes">text/x-chdr</property>
+    <property name="globs">*.hh;*.hp;*.hpp;*.h++</property>
+    <property name="line-comment-start">//</property>
+    <property name="block-comment-start">/*</property>
+    <property name="block-comment-end">*/</property>
+  </metadata>
+
+  <definitions>
+    <context id="chdr">
+      <include>
+        <context ref="cpp:cpp-proper"/>
+        <context ref="c:c"/>
+      </include>
+    </context>
+  </definitions>
+</language>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index bf41620..ca19c92 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -16,6 +16,7 @@ data/language-specs/c.lang
 data/language-specs/cmake.lang
 data/language-specs/cobol.lang
 data/language-specs/cpp.lang
+data/language-specs/cpphdr.lang
 data/language-specs/csharp.lang
 data/language-specs/css.lang
 data/language-specs/csv.lang


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]