home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / s / stronged / !StrongED / Defaults / Modes / Perl < prev    next >
Encoding:
Text File  |  1996-12-02  |  3.9 KB  |  175 lines

  1. #
  2. #    Mode for PERL.  Tested with  StrongEd 4.12 (7 Sept  96)
  3. #
  4. # $Header: RCS.perl 1.4 96/10/01 21:07:40 root Exp $
  5. #
  6. #     Written by Andrew Black  andrew@bach.demon.co.uk
  7. #
  8. #    You are welcome to make additions for your own purposes, and submit them
  9. #    to me as possible enhancements.  But please  do no circulate to anyone else
  10. #    except in this form.
  11. #
  12. #    Restrictions :
  13. #     - it makes no attempt understand regular expressions, or other
  14. #       contorted parts of PERL syntax
  15. #     - It gets confused by ' symbols inside " " strings
  16. #     - It only colours "if" when proceded by tab (dont understand that one
  17. #       - I will contact Guttorm)
  18. #
  19. ##
  20. #    
  21.  
  22.  
  23. #HelpPath    C,
  24.  
  25. #-------------------------------------------
  26.  
  27. Search
  28.     _Indent2    {" "} [ "#"  {" "} ]
  29.     
  30.     include1    ( "require" | "use" ) _spct @0  {AD}+ @9 
  31.     _perlsub     "sub" _spct   @0 { AD | "_" }+ @9
  32.     _pod        "=" @0 {AD}+ @9
  33.     _sub_or_head    _perlsub | _pod
  34. # click on any number of $, @ & % \ followed by alphnumeric
  35.     _markword    {'$@&%\\'}  {AD | '_' }+
  36. #     | "=" )
  37. End
  38.  
  39. ClickList
  40.     include1    LoadOne ("<PerlPrivLib$Dir>.pm.<tmp$word>","<PerlPrivLib$Dir>.pl.<tmp$word>","<tmp$path>.pm.<tmp$word>")
  41.     
  42. End
  43.  
  44. #-------------------------------------------
  45. # ID are not of great benefit - see the variable ones below
  46. ID_FirstChar    A-Za-z_0-9$@% 
  47. ID_Middle    A-Za-z_0-9
  48.  
  49. SyntaxOptions
  50.     SingleQuote    Yes
  51. # quotes are not treated - as we want to colour varaibles in " "
  52.     DoubleQuote    No
  53.     QuoteChar    \
  54.     QuoteQuote    No
  55.     SplitString    Yes
  56.     HexPrefix    0x
  57. End
  58.  
  59. SyntaxComment 1
  60.     Type        Oneline
  61.     StartWith    #
  62.     EndWith        '''
  63. End
  64.  
  65. SyntaxWords Group1 case Startspace
  66.     do default
  67.     continue
  68.     for while break do return goto next last
  69.            if else elsif
  70.     foreach
  71. End
  72.  
  73. #variables 
  74. SyntaxWords Group2 case EndOfId
  75.      $ @ % 
  76. End
  77.  
  78. SyntaxWords Group3 StartOfLine EndOfLine case
  79.     sub package = @ISA @EXPORT
  80. End
  81. #subroutine calls
  82. SyntaxWords Group4 case EndOfId
  83.       &
  84. End
  85. SyntaxWords Group5 case EndOfId
  86.       print write open close
  87. End
  88.  
  89.  
  90.  
  91. #----------------------------------------------------------
  92.  
  93. KeyList
  94.  
  95. #  return automatically continues comments 
  96.     Return        NewLine(indent,_Indent2)
  97.     ^Return        NewLine(noindent)
  98. End
  99.  
  100. #----------------------------------------------------------
  101.  
  102. Functions
  103.  
  104.     Key    F2
  105.     Menu    List of functions F2
  106.     Icon    LoF
  107.     Select    ListOfFound (_sub_or_head ,Text,Align,Line,Case)
  108.     Help    Click to generate list of all functions.
  109.  
  110.     Key     PgUp
  111.     Icon    up
  112.     Select    GotoPrev (_sub_or_head ,Text,Line,Case)
  113. #    Help    Click to go to previous function
  114.  
  115.     Key     PgDown
  116.     Icon    down
  117.     Select    GotoNext (_sub_or_head ,Text,Line,Case)
  118.     Help    Click to go to next function
  119.  
  120.     Key    ^H
  121.     Menu    Load pl or pm file
  122.     Icon    save
  123.     Help    Click to load the .pm or .pl file under cursor.
  124.     Select    SetTmp() LoadOne ("<PerlPrivLib$Dir>.pm.<tmp$word>","<PerlPrivLib$Dir>.pl.<tmp$word>")
  125.  
  126.     Key    F10
  127.     Menu    Save & Compile      F10
  128.     Icon    Run
  129.     Select    SetTmp() SaveDClick ("<tmp$path>.<tmp$leaf>")
  130.     Help    Click to save text and run.
  131.  
  132.     Adjust    SetTmp() SaveDrag ("perl")
  133.  
  134.  
  135. #    Key    ^G 1
  136. #    Menu    Goto function definition
  137. #    Icon    goto
  138. #    Select    Push ListOfC (all,gotofound)
  139. #    Help    Click to go to the definition of the function you're standing on.
  140.  
  141.  
  142. End
  143.  
  144. Shortcuts
  145.     ''w    while (\@) \n\i{\n\i  \@\n\i}
  146.     ''f    for (\@;\@;\@) \n\i{\n\i  \@\n\i}
  147.  
  148. #    This inroduces an if statement, followed by a "pseudo-comment"
  149. #    #els.   This may be followed by
  150. #      -     (deletes the  #els )
  151. #      e     for else
  152. #      if    for elsif 
  153.     ''i    if (\@) \n\i{\n\i  \@\n\i}\n\i#els\@
  154.     #els-     
  155.     #elsif    elsif (\@) \n\i{\n\i  \@\n\i}\n\i#els\@
  156.     #else    else\n\i{\n\i  \@\n\i}
  157.  
  158. #    iterate over key/value pairs of a hash
  159.     ''k    while ( ($key , $value ) = each (%\@) )\n\i{\n\i  \@\n\i}
  160.     ''p    print "\@\\n" ;
  161.     ''l     &print_line ( "\@") ;
  162.  
  163.     ''s     #------------------------------------------------------------------------\nsub  \@ \n{\n    local ( \@ ) = @_  ;\n    \@\n}
  164.     ''or     open ( \@ , "\@" ) || die  "Cant open \@ file" ;
  165.     ''ow     open ( \@ , ">\@" ) || die  "Cant open \@ file" ;
  166.  
  167.  
  168. End
  169.  
  170. #    Library routines are write protected by default.
  171. WriteProtect
  172. ,**.!Perl.**
  173. End
  174.  
  175.