main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
2.1 KB
|
Rev | Line | |
---|
[d24f17c] | 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 | const SPECIAL_VARS = {
|
---|
| 11 | className: 'keyword',
|
---|
| 12 | begin: '\\$(f[asn]|t|vp[rtd]|children)'
|
---|
| 13 | };
|
---|
| 14 | const LITERALS = {
|
---|
| 15 | className: 'literal',
|
---|
| 16 | begin: 'false|true|PI|undef'
|
---|
| 17 | };
|
---|
| 18 | const NUMBERS = {
|
---|
| 19 | className: 'number',
|
---|
| 20 | begin: '\\b\\d+(\\.\\d+)?(e-?\\d+)?', // adds 1e5, 1e-10
|
---|
| 21 | relevance: 0
|
---|
| 22 | };
|
---|
| 23 | const STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {
|
---|
| 24 | illegal: null
|
---|
| 25 | });
|
---|
| 26 | const PREPRO = {
|
---|
| 27 | className: 'meta',
|
---|
| 28 | keywords: {
|
---|
| 29 | 'meta-keyword': 'include use'
|
---|
| 30 | },
|
---|
| 31 | begin: 'include|use <',
|
---|
| 32 | end: '>'
|
---|
| 33 | };
|
---|
| 34 | const PARAMS = {
|
---|
| 35 | className: 'params',
|
---|
| 36 | begin: '\\(',
|
---|
| 37 | end: '\\)',
|
---|
| 38 | contains: [
|
---|
| 39 | 'self',
|
---|
| 40 | NUMBERS,
|
---|
| 41 | STRING,
|
---|
| 42 | SPECIAL_VARS,
|
---|
| 43 | LITERALS
|
---|
| 44 | ]
|
---|
| 45 | };
|
---|
| 46 | const MODIFIERS = {
|
---|
| 47 | begin: '[*!#%]',
|
---|
| 48 | relevance: 0
|
---|
| 49 | };
|
---|
| 50 | const FUNCTIONS = {
|
---|
| 51 | className: 'function',
|
---|
| 52 | beginKeywords: 'module function',
|
---|
| 53 | end: /=|\{/,
|
---|
| 54 | contains: [
|
---|
| 55 | PARAMS,
|
---|
| 56 | hljs.UNDERSCORE_TITLE_MODE
|
---|
| 57 | ]
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | return {
|
---|
| 61 | name: 'OpenSCAD',
|
---|
| 62 | aliases: [ 'scad' ],
|
---|
| 63 | keywords: {
|
---|
| 64 | keyword: 'function module include use for intersection_for if else \\%',
|
---|
| 65 | literal: 'false true PI undef',
|
---|
| 66 | 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'
|
---|
| 67 | },
|
---|
| 68 | contains: [
|
---|
| 69 | hljs.C_LINE_COMMENT_MODE,
|
---|
| 70 | hljs.C_BLOCK_COMMENT_MODE,
|
---|
| 71 | NUMBERS,
|
---|
| 72 | PREPRO,
|
---|
| 73 | STRING,
|
---|
| 74 | SPECIAL_VARS,
|
---|
| 75 | MODIFIERS,
|
---|
| 76 | FUNCTIONS
|
---|
| 77 | ]
|
---|
| 78 | };
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | module.exports = openscad;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.