l0bsterssg

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

openscad.js (1880B)


      1 /*
      2 Language: OpenSCAD
      3 Author: Dan Panzarella <alsoelp@gmail.com>
      4 Description: OpenSCAD is a language for the 3D CAD modeling software of the same name.
      5 Website: https://www.openscad.org
      6 Category: scientific
      7 */
      8 
      9 function openscad(hljs) {
     10 	var SPECIAL_VARS = {
     11 		className: 'keyword',
     12 		begin: '\\$(f[asn]|t|vp[rtd]|children)'
     13 	},
     14 	LITERALS = {
     15 		className: 'literal',
     16 		begin: 'false|true|PI|undef'
     17 	},
     18 	NUMBERS = {
     19 		className: 'number',
     20 		begin: '\\b\\d+(\\.\\d+)?(e-?\\d+)?', //adds 1e5, 1e-10
     21 		relevance: 0
     22 	},
     23 	STRING = hljs.inherit(hljs.QUOTE_STRING_MODE,{illegal: null}),
     24 	PREPRO = {
     25 		className: 'meta',
     26 		keywords: {'meta-keyword': 'include use'},
     27 		begin: 'include|use <',
     28 		end: '>'
     29 	},
     30 	PARAMS = {
     31 		className: 'params',
     32 		begin: '\\(', end: '\\)',
     33 		contains: ['self', NUMBERS, STRING, SPECIAL_VARS, LITERALS]
     34 	},
     35 	MODIFIERS = {
     36 		begin: '[*!#%]',
     37 		relevance: 0
     38 	},
     39 	FUNCTIONS = {
     40 		className: 'function',
     41 		beginKeywords: 'module function',
     42 		end: '\\=|\\{',
     43 		contains: [PARAMS, hljs.UNDERSCORE_TITLE_MODE]
     44 	};
     45 
     46 	return {
     47 		name: 'OpenSCAD',
     48 		aliases: ['scad'],
     49 		keywords: {
     50 			keyword: 'function module include use for intersection_for if else \\%',
     51 			literal: 'false true PI undef',
     52 			built_in: 'circle square polygon text sphere cube cylinder polyhedron translate rotate scale resize mirror multmatrix color offset hull minkowski union difference intersection abs sign sin cos tan acos asin atan atan2 floor round ceil ln log pow sqrt exp rands min max concat lookup str chr search version version_num norm cross parent_module echo import import_dxf dxf_linear_extrude linear_extrude rotate_extrude surface projection render children dxf_cross dxf_dim let assign'
     53 		},
     54 		contains: [
     55 			hljs.C_LINE_COMMENT_MODE,
     56 			hljs.C_BLOCK_COMMENT_MODE,
     57 			NUMBERS,
     58 			PREPRO,
     59 			STRING,
     60 			SPECIAL_VARS,
     61 			MODIFIERS,
     62 			FUNCTIONS
     63 		]
     64 	}
     65 }
     66 
     67 module.exports = openscad;