Brian, et al:

Thanks for the attribution here. It's probably worth noting that if this isn't something that makes headway with RunRev, there are definitely possibilities for a community authored plugin. Then, if that caught on, RunRev might be inclined to just bundle the plugin with the IDE (or at worst anyone could grab it from RevOnline). I'd be happy to contribute a few more hours to the cause if others want to help refine the idea.

I hope others (especially those who requested "x=5" syntax), will give the concept some consideration. Here's some additional thoughts from moi:

local mySynonyms

/*loaded from a field or property (put return&(field "Synonyms") into mySynonyms)
format: abbreviation&tab&fullText.  Example:

        wBR     windowBoundingRect
        wSR     working screenRect

If integrated into the compiler, one could declare synonyms in each script:

        synonym wBR=windowBoundingRect

and they could be referenced via an include file (see below).
*/

on returnInField --UNTESTED
get offset(("field "&quote&"script"&quote&" of card "&quote&"revscript"&quote), the long name of the target)
  if (it = 1) then
    put word 2 of the selectedLine into lineNum
    put line (lineNum) of fld "script" of card "revscript" into prevLine
    -- expand abbreviations
    repeat with x = the number of tokens of prevLine down to one
       get lineOffset(return&(token x of prevLine)&tab,mySynonyms)
       if it = 0 then next repeat
       put word 2 to -1 of line it of mySynonyms into token x of prevLine
       exit repeat
    end repeat
    switch
      -- check for custom syntax
case (token 2 of prevLine is among the items of "=,:=,is") -- x = y,x := y,x is y put ("put"&&(token 3 to -1 of prevLine)&&"into"&&(token 1 of prevLine)) into line (lineNum) of fld "script" of card "revscript"
       break
     case (token 1 of prevLine is "let")  -- let x = y
put ("put"&&(token 4 to -1 of prevLine)&&"into"&&(token 2 of prevLine)) into line (lineNum) of fld "script" of card "revscript"
       break
-- "include" file processing...1st time entered,simply type "/* Import from file:"
     case (offset("/* Import from file:",prevLine) = 1)
       put word 5 of prevLine into includeFilePath
       if includeFilePath is empty then
        put true into firstInsertion
        answer file 'Select the file to be inserted here..."
        if the result is "cancel" then break
        -- delete line prevLine?
        put it into includeFilePath
       else put false into firstInsertion
       put URL "file:"&includeFilePath into includeText
       if the result is not empty then
          beep
        answer error includeFilePath&&"not found."
        break
       end if
       if firstInsertion then
put prevLine&space&includeFilePath&&"*/"&return&includeText&return&"/* End import from file:"&&includeFilePath&&"*/"& return into line (lineNum) of fld "script" of card "revscript"
       else
get Lineoffset("/* End import from file:"&&includeFilePath",fld "script" of card "revscript")
        if it = 0 then
                beep
                answer error "End of insertion not found!"
                break
        end if
put includeText into line (lineNum+2) to (it - 2) of fld "script" of card "revscript"
       end if
       break
    end switch
      select empty
      send "revFormatField lineNum,lineNum" to card "revscript"
select after line (lineNum) of fld "script" of card "revscript" -- modify for include file insertion
    end if
  end if
  pass returnInField
end returnInField

Note: include file processing leaves something to be desired: To update the included text one must select the include comment line ("/* Import from file: [filePath] */") and press <return>. If implemented by RRLtd, the Script Editor could scan for included files when opening a script and update the text automatically.

So who else has examples of how personalized syntax and keyboard shorthand might be used?

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to