l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

step21.js (1383B)


      1 /*
      2 Language: STEP Part 21
      3 Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com>
      4 Description: Syntax highlighter for STEP Part 21 files (ISO 10303-21).
      5 Website: https://en.wikipedia.org/wiki/ISO_10303-21
      6 */
      7 
      8 function step21(hljs) {
      9   var STEP21_IDENT_RE = '[A-Z_][A-Z0-9_.]*';
     10   var STEP21_KEYWORDS = {
     11     $pattern: STEP21_IDENT_RE,
     12     keyword: 'HEADER ENDSEC DATA'
     13   };
     14   var STEP21_START = {
     15     className: 'meta',
     16     begin: 'ISO-10303-21;',
     17     relevance: 10
     18   };
     19   var STEP21_CLOSE = {
     20     className: 'meta',
     21     begin: 'END-ISO-10303-21;',
     22     relevance: 10
     23   };
     24 
     25   return {
     26     name: 'STEP Part 21',
     27     aliases: ['p21', 'step', 'stp'],
     28     case_insensitive: true, // STEP 21 is case insensitive in theory, in practice all non-comments are capitalized.
     29     keywords: STEP21_KEYWORDS,
     30     contains: [
     31       STEP21_START,
     32       STEP21_CLOSE,
     33       hljs.C_LINE_COMMENT_MODE,
     34       hljs.C_BLOCK_COMMENT_MODE,
     35       hljs.COMMENT('/\\*\\*!', '\\*/'),
     36       hljs.C_NUMBER_MODE,
     37       hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}),
     38       hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
     39       {
     40         className: 'string',
     41         begin: "'", end: "'"
     42       },
     43       {
     44         className: 'symbol',
     45         variants: [
     46           {
     47             begin: '#', end: '\\d+',
     48             illegal: '\\W'
     49           }
     50         ]
     51       }
     52     ]
     53   };
     54 }
     55 
     56 module.exports = step21;