Skip to content

Commit fb9244e

Browse files
author
Krishna Bhushan Koneru
committed
Added Support for Apache PIG Scripts
1 parent 6162203 commit fb9244e

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

js/background.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
ocaml: ['ml'],
5151
perl: ['pl', 'pm', 'perl'],
5252
php: ['php', 'phtml', 'phps'],
53+
pig: ['pig'],
5354
powershell: ['ps1', 'psm1'],
5455
python: ['py', 'pyc'],
5556
r: ['r'],

js/languages/pig.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
Language: pig
3+
Author: Krishna Koneru <[email protected]>
4+
Category: common
5+
*/
6+
7+
hljs.registerLanguage('pig', function(hljs) {
8+
var APOS_STRING = {
9+
className: 'string',
10+
begin: /'/, end: /'/
11+
};
12+
var PIG_KEYWORDS = {
13+
keyword: 'SPLIT BY LOAD STORE DUMP UNION PARALLEL FILTER FOREACH FLATTEN ' +
14+
'GENERATE ILLUSTRATE DESCRIBE GROUP COGROUP JOIN LIMIT SAMPLE STREAM DEFINE DISTINCT ' +
15+
'AND OR NOT COUNT BY AS SUM ALL BY USING INNER LEFT RIGHT FULL OUTER ASC DESC INTO IF ' +
16+
'THROUGH ORDER INPUT OUTPUT CACHE AVG CONCAT COUNT_STAR DIFF TOKENIZE REPLACE TRIM OTHERWISE ' +
17+
'MAX MIN SIZE is IS not matches group TOBAG using as %declare %default DIFF describe define double dump',
18+
constant: 'null NULL',
19+
typename: 'int float double chararray bytearray tuple bag map',
20+
built_in: 'BinStorage PigStorage PigDump TextLoader IsEmpty ls cd cat pwd help ' +
21+
'copyFromLocal copyToLocal cp mkdir mv rm rmf exec run kill quit Register declare ' +
22+
'default REGISTER SET set ToDate AddDuration du'
23+
};
24+
return {
25+
aliases: ['pig'],
26+
keywords: PIG_KEYWORDS,
27+
contains: [
28+
hljs.C_LINE_COMMENT_MODE,
29+
hljs.C_BLOCK_COMMENT_MODE,
30+
hljs.COMMENT('--', '$'),
31+
hljs.NUMBER_MODE,
32+
{
33+
className: 'decorator',
34+
begin: /%/
35+
},
36+
APOS_STRING
37+
]
38+
};
39+
})

0 commit comments

Comments
 (0)