[gtksourceview] Syntax highlighting and test file for Apache Pig 0.12



commit 564c0402ccb7592609a8b19fb024e54d0e711ba4
Author: Eyal <eallweil paypal com>
Date:   Wed Sep 24 00:44:49 2014 +0300

    Syntax highlighting and test file for Apache Pig 0.12
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735319

 data/language-specs/Makefile.am    |    1 +
 data/language-specs/pig.lang       |  283 ++++++++++++++++++++++++++++++++++++
 po/POTFILES.in                     |    1 +
 tests/syntax-highlighting/file.pig |   11 ++
 4 files changed, 296 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/Makefile.am b/data/language-specs/Makefile.am
index c0485b0..1567dee 100644
--- a/data/language-specs/Makefile.am
+++ b/data/language-specs/Makefile.am
@@ -82,6 +82,7 @@ LANGUAGES =                   \
        pascal.lang             \
        perl.lang               \
        php.lang                \
+       pig.lang                \
        pkgconfig.lang          \
        po.lang                 \
        python.lang             \
diff --git a/data/language-specs/pig.lang b/data/language-specs/pig.lang
new file mode 100644
index 0000000..aa9e840
--- /dev/null
+++ b/data/language-specs/pig.lang
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  This file is part of GtkSourceView
+
+  Syntax highlighting for Pig Latin 0.12
+
+  Author: Eyal Allweil <eallweil paypal com>
+  Copyright (C) 2014 Eyal Allweil <eallweil paypal 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, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+-->
+
+<language id="pig" _name="Pig" version="2.0" _section="Source">
+  <metadata>
+    <property name="globs">*.pig</property>
+    <property name="line-comment-start">--</property>
+    <property name="block-comment-start">/*</property>
+    <property name="block-comment-end">*/</property>
+  </metadata>
+
+  <styles>
+    <style id="datatype" _name="Data Type" map-to="def:type" />
+    <style id="reserved-words" _name="Reserved Words" map-to="def:keyword" />
+    <style id="builtin-functions" _name="Built In Functions" map-to="def:function" />
+    <style id="boolean" _name="Boolean values" map-to="def:boolean" />
+    <style id="null" _name="Null" map-to="def:special-constant" />
+    <style id="comment" _name="Comment" map-to="def:comment" />
+  </styles>
+
+  <default-regex-options case-sensitive="true" />
+
+  <definitions>
+
+    <context id="datatype" style-ref="datatype">
+      <prefix>(?i)</prefix>
+      <keyword>int</keyword>
+      <keyword>long</keyword>
+      <keyword>float</keyword>
+      <keyword>double</keyword>
+      <keyword>boolean</keyword>
+      <keyword>datetime</keyword>
+      <keyword>chararray</keyword>
+      <keyword>bytearray</keyword>
+      <keyword>biginteger</keyword>
+      <keyword>bigdecimal</keyword>
+    </context>
+
+    <context id="boolean-literal" style-ref="boolean">
+      <keyword>false</keyword>
+      <keyword>true</keyword>
+    </context>
+
+    <!-- Treat as literal despite it being a reserved word -->
+    <context id="null" style-ref="null">
+      <keyword>null</keyword>
+    </context>
+
+    <context id="line-comment" style-ref="comment"
+      end-at-line-end="true" class="comment" class-disabled="no-spell-check">
+      <start>--</start>
+      <include>
+        <context ref="def:in-line-comment" />
+      </include>
+    </context>
+
+    <!-- These are case-insensitive -->
+    <context id="reserved-words" style-ref="reserved-words">
+      <prefix>(?i)</prefix>
+      <keyword>and</keyword>
+      <keyword>any</keyword>
+      <keyword>all</keyword>
+      <keyword>arrange</keyword>
+      <keyword>assert</keyword>
+      <keyword>asc</keyword>
+      <keyword>as</keyword>
+      <keyword>bag</keyword>
+      <keyword>by</keyword>
+      <keyword>cache</keyword>
+      <keyword>case</keyword>
+      <keyword>cat</keyword>
+      <keyword>cd</keyword>
+      <keyword>cogroup</keyword>
+      <keyword>copyfromlocal</keyword>
+      <keyword>copytolocal</keyword>
+      <keyword>cp</keyword>
+      <keyword>cross</keyword>
+      <keyword>cube</keyword>
+      <keyword>%declare</keyword>
+      <keyword>%default</keyword>
+      <keyword>define</keyword>
+      <keyword>describe</keyword>
+      <keyword>desc</keyword>
+      <keyword>dense</keyword>
+      <keyword>diff</keyword>
+      <keyword>distinct</keyword>
+      <keyword>dump</keyword>
+      <keyword>du</keyword>
+      <keyword>eval</keyword>
+      <keyword>exec</keyword>
+      <keyword>explain</keyword>
+      <keyword>filter</keyword>
+      <keyword>flatten</keyword>
+      <keyword>foreach</keyword>
+      <keyword>full</keyword>
+      <keyword>generate</keyword>
+      <keyword>group</keyword>
+      <keyword>help</keyword>
+      <keyword>if</keyword>
+      <keyword>illustrate</keyword>
+      <keyword>import</keyword>
+      <keyword>inner</keyword>
+      <keyword>input</keyword>
+      <keyword>into</keyword>
+      <keyword>is</keyword>
+      <keyword>join</keyword>
+      <keyword>kill</keyword>
+      <keyword>left</keyword>
+      <keyword>limit</keyword>
+      <keyword>load</keyword>
+      <keyword>ls</keyword>
+      <keyword>map</keyword>
+      <keyword>matches</keyword>
+      <keyword>mkdir</keyword>
+      <keyword>mv</keyword>
+      <keyword>not</keyword>
+      <keyword>onschema</keyword>
+      <keyword>order</keyword>
+      <keyword>or</keyword>
+      <keyword>outer</keyword>
+      <keyword>output</keyword>
+      <keyword>parallel</keyword>
+      <keyword>pig</keyword>
+      <keyword>pwd</keyword>
+      <keyword>quit</keyword>
+      <keyword>rank</keyword>
+      <keyword>register</keyword>
+      <keyword>returns</keyword>
+      <keyword>right</keyword>
+      <keyword>rmf</keyword>
+      <keyword>rm</keyword>
+      <keyword>rollup</keyword>
+      <keyword>run</keyword>
+      <keyword>sample</keyword>
+      <keyword>set</keyword>
+      <keyword>ship</keyword>
+      <keyword>split</keyword>
+      <keyword>stderr</keyword>
+      <keyword>stdin</keyword>
+      <keyword>stdout</keyword>
+      <keyword>store</keyword>
+      <keyword>stream</keyword>
+      <keyword>through</keyword>
+      <keyword>tuple</keyword>
+      <keyword>union</keyword>
+      <keyword>using</keyword>
+      <keyword>void</keyword>
+    </context>
+
+    <context id="builtin-functions" style-ref="builtin-functions">
+      <keyword>ABS</keyword>
+      <keyword>ACOS</keyword>
+      <keyword>AddDuration</keyword>
+      <keyword>ASIN</keyword>
+      <keyword>ATAN</keyword>
+      <keyword>AVG</keyword>
+      <keyword>AvroStorage</keyword>
+      <keyword>BinStorage</keyword>
+      <keyword>CBRT</keyword>
+      <keyword>CEIL</keyword>
+      <keyword>CONCAT</keyword>
+      <keyword>COSH</keyword>
+      <keyword>COS</keyword>
+      <keyword>COUNT_STAR</keyword>
+      <keyword>COUNT</keyword>
+      <keyword>CurrentTime</keyword>
+      <keyword>DaysBetween</keyword>
+      <keyword>DIFF</keyword>
+      <keyword>ENDSWITH</keyword>
+      <keyword>EqualsIgnoreCase</keyword>
+      <keyword>EXP</keyword>
+      <keyword>FLOOR</keyword>
+      <keyword>GetDay</keyword>
+      <keyword>GetHour</keyword>
+      <keyword>GetMilliSecond</keyword>
+      <keyword>GetMinute</keyword>
+      <keyword>GetMonth</keyword>
+      <keyword>GetSecond</keyword>
+      <keyword>GetWeek</keyword>
+      <keyword>GetWeekYear</keyword>
+      <keyword>GetYear</keyword>
+      <keyword>HBaseStorage</keyword>
+      <keyword>HoursBetween</keyword>
+      <keyword>INDEXOF</keyword>
+      <keyword>IsEmpty</keyword>
+      <keyword>JsonLoader</keyword>
+      <keyword>JsonStorage</keyword>
+      <keyword>LAST_INDEX_OF</keyword>
+      <keyword>LCFIRST</keyword>
+      <keyword>LOG10</keyword>
+      <keyword>LOG</keyword>
+      <keyword>LOWER</keyword>
+      <keyword>LTRIM</keyword>
+      <keyword>MAX</keyword>
+      <keyword>MilliSecondsBetween</keyword>
+      <keyword>MIN</keyword>
+      <keyword>MinutesBetween</keyword>
+      <keyword>MonthsBetween</keyword>
+      <keyword>PigDump</keyword>
+      <keyword>PigStorage</keyword>
+      <keyword>PluckTuple</keyword>
+      <keyword>RANDOM</keyword>
+      <keyword>REGEX_EXTRACT_ALL</keyword>
+      <keyword>REGEX_EXTRACT</keyword>
+      <keyword>REPLACE</keyword>
+      <keyword>ROUND</keyword>
+      <keyword>RTRIM</keyword>
+      <keyword>SecondsBetween</keyword>
+      <keyword>SINH</keyword>
+      <keyword>SIN</keyword>
+      <keyword>SIZE</keyword>
+      <keyword>SQRT</keyword>
+      <keyword>STARTSWITH</keyword>
+      <keyword>STRSPLIT</keyword>
+      <keyword>SUBSTRING</keyword>
+      <keyword>SubtractDuration</keyword>
+      <keyword>SUBTRACT</keyword>
+      <keyword>SUM</keyword>
+      <keyword>TANH</keyword>
+      <keyword>TAN</keyword>
+      <keyword>Terms</keyword>
+      <keyword>TextLoader</keyword>
+      <keyword>TOBAG</keyword>
+      <keyword>ToDate</keyword>
+      <keyword>TOKENIZE</keyword>
+      <keyword>TOMAP</keyword>
+      <keyword>ToMilliSeconds</keyword>
+      <keyword>TOP</keyword>
+      <keyword>ToString</keyword>
+      <keyword>TOTUPLE</keyword>
+      <keyword>ToUnixTime</keyword>
+      <keyword>TRIM</keyword>
+      <keyword>TrevniStrorage</keyword>
+      <keyword>UCFIRST</keyword>
+      <keyword>UPPER</keyword>
+      <keyword>Usage</keyword>
+      <keyword>WeeksBetween</keyword>
+      <keyword>YearsBetween</keyword>
+    </context>
+
+    <context id="pig" class="no-spell-check">
+      <include>
+        <context ref="def:decimal" />
+        <context ref="def:float" />
+        <context ref="def:string" />
+        <context ref="def:single-quoted-string" />
+        <context ref="def:c-like-close-comment-outside-comment" />
+        <context ref="def:c-like-comment-multiline" />
+
+        <context ref="datatype" />
+        <context ref="line-comment" />
+        <context ref="reserved-words" />
+        <context ref="builtin-functions" />
+        <context ref="boolean-literal" />
+        <context ref="null" />
+      </include>
+    </context>
+
+  </definitions>
+</language>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3658a75..ecd97de 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -80,6 +80,7 @@ data/language-specs/opencl.lang
 data/language-specs/pascal.lang
 data/language-specs/perl.lang
 data/language-specs/php.lang
+data/language-specs/pig.lang
 data/language-specs/pkgconfig.lang
 data/language-specs/po.lang
 data/language-specs/prolog.lang
diff --git a/tests/syntax-highlighting/file.pig b/tests/syntax-highlighting/file.pig
new file mode 100644
index 0000000..d76eef6
--- /dev/null
+++ b/tests/syntax-highlighting/file.pig
@@ -0,0 +1,11 @@
+/*
+ * This file tests Apache Pig 0.12 Syntax Highlighting
+ */
+
+fake = LOAD 'fakeData' USING PigStorage() AS (name:chararray, age:int);
+
+fake = limit fake 5; -- operations can be case insensitive
+
+fake = FOREACH fake GENERATE TRIM(name) AS name, null as nullField, false AS booleanConst;
+
+DUMP fake;


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