Shop OBEX P1 Docs P2 Docs Learn Events
Prop code in sniptastic — Parallax Forums

Prop code in sniptastic

Bob ReynoldsBob Reynolds Posts: 5
edited 2011-08-26 19:40 in Propeller 1
I am a dedicated user of Evernote. They recently announced integration with a application called sniptastic http://www.sniptastic.com/ It looks like a good way to organize and share code. I already do so in Evernote, but sniptastic offers to preserve formatting. Of course, I immediately sent this message to the sniptastic forum:

“I learned about you project from Evernote. I would appreciate it if you could support the spin language, used on Propeller microcontrollers http://www.parallax.com/tabid/407/Default.aspx It is becoming very popular in the embedded controller community. The integrated development environment makes very good use of text formatting and color.”

And, perhaps not surprisingly, received this reply:

“Hi, Bob. Welcome to the Sniptastic! community!

I took a look at Propeller and it's very neat. However, Spin appears to be a somewhat niche programming language.

I currently use SyntaxHighlighter for text coloring, and as far as I know, nobody has created a brush for Spin. If you need this done quickly, the best thing to do would be to create a custom brush and send it to me. I would be happy to incorporate it into Sniptastic! Otherwise, unless a big demand develops for it, this may have to wait a while.

Thanks for the request.”

Niche, indeed! Is anyone out there familiar with SyntaxHighlighter and willing to take on the brush creation task?

Comments

  • rosco_pcrosco_pc Posts: 468
    edited 2011-08-22 23:42
    If my google-fu is working it seems that SyntaxHighLighter is a Javascript based highlighter.

    So not exactly what you're asking for, but a good starting point: Phil Pilgrim created a Spin Editor in Javascript, with syntax highlighting: http://forums.parallax.com/showthread.php?132690-HTML-based-Propeller-IDE-now-with-auto-completion.
  • Andrey DemenevAndrey Demenev Posts: 377
    edited 2011-08-23 01:32
    Here you go. I made this over a year ago. Just send this code to Sniptastic people, and they should be able to add Spin easily. It is very basic, but should be a good start
    <script type='text/javascript'>
    SyntaxHighlighter.brushes.Spin = function()
    
    {
    
        var keywords =  'ABS ABSNEG ADD ADDABS ADDS ADDSX ADDX AND ANDN BYTEFILL BYTEMOVE CALL CHIPVER CLKFREQ _CLKFREQ CLKMODE _CLKMODE CLKSET CMP CMPS CMPSUB CMPSX CMPX CNT COGID COGINIT COGNEW COGSTOP CON CONSTANT CTRA CTRB DAT DIRA DIRB DJNZ ENC FALSE FILE FIT _FREE FRQA FRQB HUBOP  INA INB CONST JMP JMPRET LOCKCLR LOCKNEW LOCKRET LOCKSET LONGFILL LONGMOVE LOOKDOWN LOOKDOWNZ LOOKUP LOOKUPZ MAX MAXS MIN MINS MOV MOVD MOVI MOVS MUL MULS MUXC MUXNC MUXNZ MUXZ NEG NEGC NEGNC NEGNZ NEGX NEGZ NOP NOT OBJ ONES OR ORG  OUTA OUTB PAR PHSA PHSB PI PLL16X PLL1X PLL2X PLL4X PLL8X POSX PRI PUB RCFAST RCL RCR RCSLOW RDBYTE RDLONG RDWORD REBOOT RES RESULT RET REV ROL ROR SAR SHL SHR SPR _STACK STRCOMP STRING STRSIZE SUB SUBABS SUBS SUBSX SUBX SUMC SUMNC SUMNZ SUMZ TEST TESTN TJNZ TJZ TRUE VAR VCFG VSCL WAITCNT WAITPEQ WAITPNE WAITVID WORDFILL WORDMOVE WRBYTE WRLONG WRWORD _XINFREQ XINPUT XOR XTAL1 XTAL2 XTAL3  RETURN ABORT';
        var special =  'IF_ALWAYS IF_NEVER IF_E IF_Z IF_NE IF_NZ IF_NC_AND_NZ IF_NZ_AND_NC IF_A IF_B IF_C IF_AE IF_NC IF_C_OR_Z IF_Z_OR_C IF_BE IF_C_EQ_Z IF_Z_EQ_C IF_C_NE_Z IF_Z_NE_C IF_C_AND_Z IF_Z_AND_C IF_C_AND_NZ IF_NZ_AND_C IF_NC_AND_Z IF_Z_AND_NC  IF_C_OR_NZ IF_NZ_OR_C IF_NC_OR_Z IF_Z_OR_NC IF_NC_OR_NZ IF_NZ_OR_NC WC WZ WR NR IF ELSE ELSEIF ELSEIFNOT IFNOT CASE OTHER REPEAT FROM TO STEP UNTIL WHILE NEXT QUIT';
    
        this.regexList = [
    
            {regex: /'.*/g,css:'comments'},
            {regex: /{.*}/gm,css:'comments'},
            { regex: /"(?!")(?:\.|\\\"|[^\"\n])*"/gm, 					css: 'string' },
            { regex: new RegExp(this.getKeywords(keywords), 'gm'), 		css: 'keyword' },
            { regex: new RegExp(this.getKeywords(special), 'gm'), 		css: 'color3' }
            ];
    
    
    
    	this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
    
    };
    
    
    
    SyntaxHighlighter.brushes.Spin.prototype  = new SyntaxHighlighter.Highlighter();
    
    SyntaxHighlighter.brushes.Spin.aliases    = ['spin'];
    
    
    
    
    
    SyntaxHighlighter.config.bloggerMode = true;
    SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
    SyntaxHighlighter.all();
    </script>
    
  • Sniptastic!Sniptastic! Posts: 2
    edited 2011-08-23 14:06
    Message received! I'm the creator of Sniptastic!, and I found this forum by Googling.

    Thanks for the code, Andrey. I will incorporate this into Sniptastic! and include it in an upcoming release. Changes are announced on the Sniptastic! forum (http://forum.sniptastic.com/) and Twitter account (@sniptasticnews).
  • Sniptastic!Sniptastic! Posts: 2
    edited 2011-08-26 19:40
    Spin language support is now supported in Sniptastic! You can add Spin snippets from the Web UI and editor plugins, as well as filter and sort by Spin where relevant.

    Thank you, Andrey, for your contribution.
Sign In or Register to comment.