Skip to content

Instantly share code, notes, and snippets.

@wickchucked
Created September 22, 2015 19:02
Show Gist options
  • Save wickchucked/1609b9366a51ab0646f4 to your computer and use it in GitHub Desktop.
Save wickchucked/1609b9366a51ab0646f4 to your computer and use it in GitHub Desktop.
hightlight.js BIS/Mapper syntax file
/*
Language: BIS
Author: Ed Winn <wickchucked@gmail.com>
*/
hljs.LANGUAGES.bis = function(a) {
var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+';
var TAG_INTERNALS = {
endsWithParent: true,
relevance: 10,
contains: [
{
className: 'attribute',
begin: XML_IDENT_RE,
relevance: 0
},
{
begin: '="', returnBegin: true, end: '"',
contains: [{
className: 'value',
begin: '"', endsWithParent: true
}]
},
{
begin: '=\'', returnBegin: true, end: '\'',
contains: [{
className: 'value',
begin: '\'', endsWithParent: true
}]
},
{
begin: '=',
contains: [{
className: 'value',
begin: '[^\\s/>]+'
}]
}
]
};
return {
keywords: {
keyword:
'add adr art aux bbo bco bfn blt bpo brg brk btn cah cal cal call car cau cbx ccc ccg ' +
'cci ccp ccr cer chd chg clk clt cls clv cmu cmp cnt csr dat dc dcr dcu dde ddi dec def ' +
'del dev dfa dfc dfu dir dlr drw dsf dsg dsm dsp dsx dul dup dvs ecr edt esr ext fc fch ' +
'fdr fil fky fmt fnd fon gen goc gs gto help hid hsh idu if inc ind inp juv key kll lch ' +
'lcv lda ldv lfc lfn lgl lgn lgf lgs lln lmg ln ln+ ln- lna lnd lng lni lnk lnm lnp lnx ' +
'lny log loc lok lsm lst lzr mau mbx mch mnu mql msg namlst namdmp net nof nrd nrm nrn ' +
'nrt nwr ok os out oum pc pcf pcr pcw pic pnt prt qcls qget qinq qopn qput ram rar rdc ' +
'rdl rel relrnm rep rer ret return rfm rgn rln rnm rpw rrn rsl rsr rtn run sc sch scn ' +
'sen sfc sgput sgget shw siz snu sor spi sql srh srr sru stn str sub sys tip tot tpc tps ' +
'trc txt ulk unx upd use wat wdc wdl win wpr wrl xit xqt xun' +
'ADD ADR ART AUX BBO BCO BFN BLT BPO BRG BRK BTN CAH CAL CAL CALL CAR CAU CBX CCC CCG ' +
'CCI CCP CCR CER CHD CHG CLK CLT CLS CLV CMU CMP CNT CSR DAT DC DCR DCU DDE DDI DEC DEF ' +
'DEL DEV DFA DFC DFU DIR DLR DRW DSF DSG DSM DSP DSX DUL DUP DVS ECR EDT ESR EXT FC FCH ' +
'FDR FIL FKY FMT FND FON GEN GOC GS GTO HELP HID HSH IDU IF INC IND INP JUV KEY KLL LCH ' +
'LCV LDA LDV LFC LFN LGL LGN LGF LGS LLN LMG LN LN+ LN- LNA LND LNG LNI LNK LNM LNP LNX ' +
'LNY LOG LOC LOK LSM LST LZR MAU MBX MCH MNU MQL MSG NAMLST NAMDMP NET NOF NRD NRM NRN ' +
'NRT NWR OK OS OUT OUM PC PCF PCR PCW PIC PNT PRT QCLS QGET QINQ QOPN QPUT RAM RAR RDC ' +
'RDL REL RELRNM REP RER RET RETURN RFM RGN RLN RNM RPW RRN RSL RSR RTN RUN SC SCH SCN ' +
'SEN SFC SGPUT SGGET SHW SIZ SNU SOR SPI SQL SRH SRR SRU STN STR SUB SYS TIP TOT TPC TPS ' +
'TRC TXT ULK UNX UPD USE WAT WDC WDL WIN WPR WRL XIT XQT XUN',
symbol:
'acdrw$ actinp$ actwin$ adrw$ adrw1$ adrw2$ adrw3$ adrw4$ adrw5$ adrw6$ adrw7$ adrw8$ aedrw$ akey$ ' +
'apilvl$ area$ aspect$ axdrw$ bport$ cab$ cab1$ call$ cdrw$ cerr$ char$ chkpsw$ chr$ color$ cpriv$ crpt$ ' +
'curh$ cursec$ curv$ data$ date0$ date1$ date2$ date3$ date4$ date5$ date6$ date7$ date8$ date9$ ' +
'date10$ date11$ date12$ date13$ date14$ date15$ date16$ date17$ date18$ date19$ date20$ day$ dbase$ ' +
'dbthrs$ dbusg$ depn$ dept$ dfumax$ dline$ dlp$ drw$ drw1$ drw2$ drw3$ drw4$ drw5$ drw6$ drw7$ drw8$ ' +
'drw9$ drw10$ drw11$ drw12$ drw13$ drw14$ drw15$ drw16$ dtm$ dtnam$ dwcap$ ecab$ edrw$ eline$ envstr$ ' +
'erpt$ erid$ esc$ etype$ fcab$ fcc$ fdrw$ fftype$ field$ fkey$ fmt$ fpage$ frestr$ frpt$ glbstr$ graph$ ' +
'hlines$ icvar$ inmsv$ input$ instr$ invar$ invr1$ io$ ip$ lang$ lcab$ level$ libdrw$ line$ link$ litem$ ' +
'llp$ lnkdrw$ lnkrpt$ look$ lrrsd$ mapnam$ maxcab$ maxchr$ maxdrw$ maxevr$ maxgvr$ maxgvr$ maxlab$ ' +
'maxlin$ maxlns$ maxrnm$ maxrpt$ maxrw$ maxvar$ mode$ mode1$ msec$ msgq$ mxdepn$ net$ netdrw$ netout4$ ' +
'netrpt$ netsit$ odepn$ oline$ opriv$ orstan$ orun$ osite$ osfils$ osplen$ ostnum$ osuids$ osuser$ ' +
'osysnam$ ouser$ plng$ rpriv$ rpt$ rrsid$ rslant$ run$ scnh$ scnv$ screen$ secdrw$ secgrp$ secrpt$ ' +
'secure$ site$ soe$ soeh$ soev$ spriv$ stat1$ stat2$ stat3$ stat4$ stnum$ sysnam$ tab$ tccs$ tic$ time$ ' +
'ttype$ user$ wnd$ ws$ wsipa$ wsite$ xdrw$ xerr$ xfun$ xkey$ xline$ xrid$ xrpt$ xtype$ year$ ' +
'ACDRW$ ACTINP$ ACTWIN$ ADRW$ ADRW1$ ADRW2$ ADRW3$ ADRW4$ ADRW5$ ADRW6$ ADRW7$ ADRW8$ AEDRW$ AKEY$ ' +
'APILVL$ AREA$ ASPECT$ AXDRW$ BPORT$ CAB$ CAB1$ CALL$ CDRW$ CERR$ CHAR$ CHKPSW$ CHR$ COLOR$ CPRIV$ CRPT$ ' +
'CURH$ CURSEC$ CURV$ DATA$ DATE0$ DATE1$ DATE2$ DATE3$ DATE4$ DATE5$ DATE6$ DATE7$ DATE8$ DATE9$ ' +
'DATE10$ DATE11$ DATE12$ DATE13$ DATE14$ DATE15$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PE$ YEAR$ '
},
contains: [
{
begin: '<', end: '>',
className: 'variable'
},
{
begin: '<%', end: '%>',
className: 'variable'
},
{
className: 'comment',
begin: '(^@\\..*)|((^@[0-9]{4}:)(\\..*))',
relevance: 20
},
{
className: 'tag',
begin: '[A-Z]+_',
relevance: 10
},
{
className: 'constant',
begin: '[A-Za-z]+_'
},
{
className: 'control',
begin: '\b(if|gt|eq|lt|le|ge)\b'
},
{
className: 'number',
begin: '[0-9]'
},
{
className: 'constant',
begin: '(:INCLUDE.*$|:I.*$|:DEFINE.*$|:D.*$)'
},
{
className: 'title',
begin: '^\\.\\w.*$'
},
{
begin: '\"', end: '\"',
className: 'string'
},
{
begin: '(¬)',
className: 'raw',
},
{
className: 'comment',
begin: '<!--', end: '-->'
},
{
className: 'doctype',
begin: '<!DOCTYPE', end: '>'
},
{
className: 'pi',
begin: '<\\?', end: '\\?>'
},
{
className: 'doctype',
begin: '<!DOCTYPE', end: '>',
contains: [{begin: '\\[', end: '\\]'}]
},
{
className: 'comment',
begin: '<!--', end: '-->'
},
{
className: 'cdata',
begin: '<\\!\\[CDATA\\[', end: '\\]\\]>'
},
{
className: 'tag',
/*
The lookahead pattern (?=...) ensures that 'begin' only matches
'<style' as a single word, followed by a whitespace or an
ending braket. The '$' is needed for the lexem to be recognized
by hljs.subMode() that tests lexems outside the stream.
*/
begin: '<style(?=\\s|>|$)', end: '>',
keywords: {title: 'style'},
contains: [TAG_INTERNALS],
starts: {
end: '</style>', returnEnd: true,
subLanguage: 'css'
}
},
{
className: 'tag',
// See the comment in the <style tag about the lookahead pattern
begin: '<script(?=\\s|>|$)', end: '>',
keywords: {title: 'script'},
contains: [TAG_INTERNALS],
starts: {
end: '</script>', returnEnd: true,
subLanguage: 'javascript'
}
},
{
className: 'tag',
begin: '</?', end: '/?>',
relevance: 10,
contains: [
{
className: 'title', begin: '[^ /><]+'
},
TAG_INTERNALS
]
}
]
};
}(hljs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment