Pages: [1]   Go Down
Author Topic: Arduino Scheme for Programmer's Notepad  (Read 1475 times)
0 Members and 1 Guest are viewing this topic.
Ontario, Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Converted OOPic User
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just wondering if anyone has a scheme file specific to Arduino for Programmer's Notepad (http://www.pnotepad.org).  I've been using the default C/C++ scheme which works ok, but it doesn't highlight everything that the Arduino IDE does.  Figured I'd ask here if anyone has already made a scheme file before delving into the code myself.

Thanks
Logged

Ontario, Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Converted OOPic User
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, since no one seems to have this out there, I cobbled one together myself.  Just take the code below and past it into a new text file called "arduino.schemedef" and put it in the Schemes\ folder in the Programmer's Notepad install directory.  The next time you open Programmer's Notepad you should see Arduino as a style option from the drop-down and you can also change the options to associate .pde files with the Arduino style.

The basic highlighting is working fine as far as I can tell.  The colours don't match the Arduino IDE yet but that's easy enough to change if you want; just edit the fore="######" lines in the use-styles section to whatever colour you want.

You can also add your own keywords to the keyword lists if you like.  I just added the Servo and Wire library commands because those are the one I use.

Let me know if you see anything that needs changing and I'll try to make it work.

Cheers,
spl@rboi

Code:
<?xml version="1.0" ?>

<!--  Arduino SchemeDef to match the Arduino IDE (www.arduino.cc) with a few additions for added clarity.
        - added break, continue, #include, and #define to "datatype" keywords
        - added sizeof to "method" keywords
        - added Servo and Wire library keywords to "method"
      
      Written by: A. Weber - Ontario, Canada
      Last Modified: 2007-11-19
-->
            
<Scheme>
  <keyword-classes>
    <keyword-class name="datatype">
      <!-- data types and structures -->
      boolean break byte case char class continue default do double else false float for
      if int long new null private protected public return short signed static switch this throw true
      try unsigned void while
    </keyword-class>
    <keyword-class name="method">
      abs acos analogRead analogWrite asin atan atan2 attach attached attachInterrupt available begin
      beginSerial beginTransmission ceil constrain cos delay delayMicroseconds detach detachInterrupt
      digitalRead digitalWrite endTransmission exp floor flush max millis min onReceive onRequest pinMode
      print printBinary printByte printHex printInteger println printNewline printOctal printString
      pulseIn random randomSeed read receive refresh requestFrom send Serial serialAvailable serialRead
      serialWrite Servo setMaximumPulse setMinimumPulse shiftOut sin sizeof sq sqrt switch tan Wire write
    </keyword-class>
    <keyword-class name="literal">
      BIN BYTE CHANGE DEC DISPLAY FALLING HALF_PI HALF_PI HEX HIGH INPUT LOW LSBFIRST MSBFIRST null OCT
      OUTPUT PI RISING SERIALTWO_PI TWO_PI FALSE TRUE
    </keyword-class>
    <keyword-class name="special">
      setup loop
    </keyword-class>
  </keyword-classes>
        
  <schemedef name="arduino" title="Arduino" author="A. Weber" url="http://www.arduiono.cc" version="1"
    casesensitive="true" braces="{[()]}">
            
    <strings>
      <!-- Double quoted string with \ as an escape character -->
      <stringtype id="0" start="&quot;" end="&quot;" multiline="false" escape="\" />
    </strings>

    <identifiers start="[\_a-zA-Z]" />

    <comments>
      <line start="//" />    
      <block start="/*" end="*/" />
    </comments>

    <numbers start="[0-9]" content="[0-9.xA-F]" />

    <preprocessor start="#" end="[ \.]" /> <!-- continuation="\" -->

    <!-- From here on is the traditional scheme definition block... -->
    <lexer name="arduino" />
    <use-styles>
      <style name="Default" key="32" />
      <style name="Line Comment" key="1" class="comment" />
      <style name="Block Comment" key="2" class="comment" />
      <style name="Number" key="4" class="number" />
      <style name="Keywords" key="5" class="keyword" />
      <style name="Keywords 2" key="6" class="keyword" fore="b00040" />
      <style name="Keywords 3" key="7" class="keyword" fore="f80000" />
      <style name="Keywords 4" key="8" class="keyword" fore="ff7800" bold="true" />
      <style name="String" key="10" class="string" />
      <style name="Pre-Processor" key="12" class="preprocessor" />
      <!-- <style name="Special Identifier" key="13" fore="478698" /> -->
    </use-styles>

    <use-keywords>
      <keyword key="0" name="Keywords" class="datatype"/>
      <keyword key="1" name="Keywords 2" class="method"/>
      <keyword key="2" name="Keywords 3" class="literal"/>
      <keyword key="3" name="Keywords 4" class="special"/>
      </use-keywords>

  </schemedef>
</Scheme>
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks alot for this.. It does give me some ideas and hopefully can improve on it..

Logged

Pages: [1]   Go Up
Jump to: