|
| 1 | +/** |
| 2 | + * SyntaxHighlighter |
| 3 | + * http://alexgorbatchev.com/SyntaxHighlighter |
| 4 | + * |
| 5 | + * SyntaxHighlighter is donationware. If you are using it, please donate. |
| 6 | + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html |
| 7 | + * |
| 8 | + * @version |
| 9 | + * 3.0.83 (Wed, 16 Apr 2014 03:56:09 GMT) |
| 10 | + * |
| 11 | + * @copyright |
| 12 | + * Copyright (C) 2004-2013 Alex Gorbatchev. |
| 13 | + * |
| 14 | + * @license |
| 15 | + * Dual licensed under the MIT and GPL licenses. |
| 16 | + * |
| 17 | + * Original brush carlynorama/wp-syntaxhighlighter-arduino updated April 2020 by https://siytek.com |
| 18 | + */ |
| 19 | +;(function() |
| 20 | +{ |
| 21 | + // CommonJS |
| 22 | + SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); |
| 23 | + |
| 24 | + function Brush() |
| 25 | + { |
| 26 | + |
| 27 | + var datatypes = 'boolean char byte int long float double void unsigned volatile word string static const'; |
| 28 | + |
| 29 | + var keywords = 'setup loop if else for switch case default while do break continue return'; |
| 30 | + |
| 31 | + var functions = 'pinMode digitalWrite digitalRead analogRead analogWrite shiftOut pulseIn ' + |
| 32 | + 'millis micros delay delayMicroseconds min max abs constrain ' + |
| 33 | + 'map pow sq sqrt sin cos tan randomSeed random ' + |
| 34 | + 'sizeof lowByte highByte bitRead bitWrite bitSet bitClear bit tone noTone' + |
| 35 | + 'attachInterrupt detachInterrupt interrupts noInterrupts ' + |
| 36 | + 'Serial\\.begin Serial\\.available Serial\\.read Serial\\.flush ' + |
| 37 | + 'Serial\\.print Serial\\.println Serial\\.write '; |
| 38 | + |
| 39 | + var constants = 'HIGH LOW INPUT OUTPUT true false CHANGE RISING FALLING'; |
| 40 | + |
| 41 | + |
| 42 | + this.regexList = [ |
| 43 | + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' } // one line comments |
| 44 | + ,{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' } // multiline comments |
| 45 | + ,{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' } // strings |
| 46 | + ,{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' } // strings |
| 47 | + ,{ regex: /^ *#(.)+?\b/gm, css: 'preprocessor' } // preprocessor directives |
| 48 | + ,{ regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' } // datatypes |
| 49 | + ,{ regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions' } // functions |
| 50 | + ,{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' } // control flow |
| 51 | + ,{ regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants bold' } // predefined constants |
| 52 | + ,{ regex: /\b(\d*\.\d+([Ee]-?\d{1,3})?)|(\d+[Ee]-?\d{1,3})\b/gm, css: 'constants'} // numeric constants (floating point) |
| 53 | + ,{ regex: /\b\d+[uU]?[lL]?\b/gm, css: 'constants'} // numeric constants (decimal) |
| 54 | + ,{ regex: /\b0x[0-9A-Fa-f]+[uU]?[lL]?\b/gm, css: 'constants'} // numeric constants (hexidecimal) |
| 55 | + ,{ regex: /\bB[01]{1,8}\b/gm, css: 'constants'} // numeric constants (binary) |
| 56 | + ,{ regex: /\+|\-|\*|\/|\%|!|\||\&|=|\?|\^|~/gm, css: 'plain bold' } // operators |
| 57 | + ]; |
| 58 | + }; |
| 59 | + |
| 60 | + Brush.prototype = new SyntaxHighlighter.Highlighter(); |
| 61 | + Brush.aliases = ['arduino', 'arduinolite']; |
| 62 | + |
| 63 | + SyntaxHighlighter.brushes.Arduino = Brush; |
| 64 | + |
| 65 | + // CommonJS |
| 66 | + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; |
| 67 | +})(); |
0 commit comments