arduino.js 4.9 KB

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