l0bsterssg

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

arduino.js (5368B)


      1 /*
      2 Language: Arduino
      3 Author: Stefania Mellai <s.mellai@arduino.cc>
      4 Description: The Arduino® Language is a superset of C++. This rules are designed to highlight the Arduino® source code. For info about language see http://www.arduino.cc.
      5 Requires: cpp.js
      6 Website: https://www.arduino.cc
      7 */
      8 
      9 /** @type LanguageFn */
     10 function arduino(hljs) {
     11 
     12 	var ARDUINO_KW = {
     13       keyword:
     14         'boolean byte word String',
     15       built_in:
     16         'setup loop ' +
     17         'KeyboardController MouseController SoftwareSerial ' +
     18         'EthernetServer EthernetClient LiquidCrystal ' +
     19         'RobotControl GSMVoiceCall EthernetUDP EsploraTFT ' +
     20         'HttpClient RobotMotor WiFiClient GSMScanner ' +
     21         'FileSystem Scheduler GSMServer YunClient YunServer ' +
     22         'IPAddress GSMClient GSMModem Keyboard Ethernet ' +
     23         'Console GSMBand Esplora Stepper Process ' +
     24         'WiFiUDP GSM_SMS Mailbox USBHost Firmata PImage ' +
     25         'Client Server GSMPIN FileIO Bridge Serial ' +
     26         'EEPROM Stream Mouse Audio Servo File Task ' +
     27         'GPRS WiFi Wire TFT GSM SPI SD ' +
     28         'runShellCommandAsynchronously analogWriteResolution ' +
     29         'retrieveCallingNumber printFirmwareVersion ' +
     30         'analogReadResolution sendDigitalPortPair ' +
     31         'noListenOnLocalhost readJoystickButton setFirmwareVersion ' +
     32         'readJoystickSwitch scrollDisplayRight getVoiceCallStatus ' +
     33         'scrollDisplayLeft writeMicroseconds delayMicroseconds ' +
     34         'beginTransmission getSignalStrength runAsynchronously ' +
     35         'getAsynchronously listenOnLocalhost getCurrentCarrier ' +
     36         'readAccelerometer messageAvailable sendDigitalPorts ' +
     37         'lineFollowConfig countryNameWrite runShellCommand ' +
     38         'readStringUntil rewindDirectory readTemperature ' +
     39         'setClockDivider readLightSensor endTransmission ' +
     40         'analogReference detachInterrupt countryNameRead ' +
     41         'attachInterrupt encryptionType readBytesUntil ' +
     42         'robotNameWrite readMicrophone robotNameRead cityNameWrite ' +
     43         'userNameWrite readJoystickY readJoystickX mouseReleased ' +
     44         'openNextFile scanNetworks noInterrupts digitalWrite ' +
     45         'beginSpeaker mousePressed isActionDone mouseDragged ' +
     46         'displayLogos noAutoscroll addParameter remoteNumber ' +
     47         'getModifiers keyboardRead userNameRead waitContinue ' +
     48         'processInput parseCommand printVersion readNetworks ' +
     49         'writeMessage blinkVersion cityNameRead readMessage ' +
     50         'setDataMode parsePacket isListening setBitOrder ' +
     51         'beginPacket isDirectory motorsWrite drawCompass ' +
     52         'digitalRead clearScreen serialEvent rightToLeft ' +
     53         'setTextSize leftToRight requestFrom keyReleased ' +
     54         'compassRead analogWrite interrupts WiFiServer ' +
     55         'disconnect playMelody parseFloat autoscroll ' +
     56         'getPINUsed setPINUsed setTimeout sendAnalog ' +
     57         'readSlider analogRead beginWrite createChar ' +
     58         'motorsStop keyPressed tempoWrite readButton ' +
     59         'subnetMask debugPrint macAddress writeGreen ' +
     60         'randomSeed attachGPRS readString sendString ' +
     61         'remotePort releaseAll mouseMoved background ' +
     62         'getXChange getYChange answerCall getResult ' +
     63         'voiceCall endPacket constrain getSocket writeJSON ' +
     64         'getButton available connected findUntil readBytes ' +
     65         'exitValue readGreen writeBlue startLoop IPAddress ' +
     66         'isPressed sendSysex pauseMode gatewayIP setCursor ' +
     67         'getOemKey tuneWrite noDisplay loadImage switchPIN ' +
     68         'onRequest onReceive changePIN playFile noBuffer ' +
     69         'parseInt overflow checkPIN knobRead beginTFT ' +
     70         'bitClear updateIR bitWrite position writeRGB ' +
     71         'highByte writeRed setSpeed readBlue noStroke ' +
     72         'remoteIP transfer shutdown hangCall beginSMS ' +
     73         'endWrite attached maintain noCursor checkReg ' +
     74         'checkPUK shiftOut isValid shiftIn pulseIn ' +
     75         'connect println localIP pinMode getIMEI ' +
     76         'display noBlink process getBand running beginSD ' +
     77         'drawBMP lowByte setBand release bitRead prepare ' +
     78         'pointTo readRed setMode noFill remove listen ' +
     79         'stroke detach attach noTone exists buffer ' +
     80         'height bitSet circle config cursor random ' +
     81         'IRread setDNS endSMS getKey micros ' +
     82         'millis begin print write ready flush width ' +
     83         'isPIN blink clear press mkdir rmdir close ' +
     84         'point yield image BSSID click delay ' +
     85         'read text move peek beep rect line open ' +
     86         'seek fill size turn stop home find ' +
     87         'step tone sqrt RSSI SSID ' +
     88         'end bit tan cos sin pow map abs max ' +
     89         'min get run put',
     90       literal:
     91         'DIGITAL_MESSAGE FIRMATA_STRING ANALOG_MESSAGE ' +
     92         'REPORT_DIGITAL REPORT_ANALOG INPUT_PULLUP ' +
     93         'SET_PIN_MODE INTERNAL2V56 SYSTEM_RESET LED_BUILTIN ' +
     94         'INTERNAL1V1 SYSEX_START INTERNAL EXTERNAL ' +
     95         'DEFAULT OUTPUT INPUT HIGH LOW'
     96   };
     97 
     98   var ARDUINO = hljs.requireLanguage('cpp').rawDefinition();
     99 
    100   var kws = ARDUINO.keywords;
    101 
    102   kws.keyword += ' ' + ARDUINO_KW.keyword;
    103   kws.literal += ' ' + ARDUINO_KW.literal;
    104   kws.built_in += ' ' + ARDUINO_KW.built_in;
    105 
    106   ARDUINO.name = 'Arduino';
    107   ARDUINO.aliases = ['ino'];
    108 
    109   return ARDUINO;
    110 }
    111 
    112 module.exports = arduino;