PageRenderTime 35ms CodeModel.GetById 38ms RepoModel.GetById 1ms app.codeStats 0ms

/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/batch.py

https://github.com/astory/RankPanda
Python | 151 lines | 92 code | 15 blank | 44 comment | 8 complexity | 4f16798051368b48ffa223f39204511c MD5 | raw file
  1. ###############################################################################
  2. # Name: batch.py #
  3. # Purpose: Define DOS Batch syntax for highlighting and other features #
  4. # Author: Cody Precord <cprecord@editra.org> #
  5. # Copyright: (c) 2008 Cody Precord <staff@editra.org> #
  6. # License: wxWindows License #
  7. ###############################################################################
  8. """
  9. FILE: batch.py
  10. AUTHOR: Cody Precord
  11. @summary: Lexer configuration file for dos/windows batch scripts.
  12. @todo: incorportate winbat keywords
  13. """
  14. __author__ = "Cody Precord <cprecord@editra.org>"
  15. __svnid__ = "$Id: batch.py 53369 2008-04-26 05:35:41Z CJP $"
  16. __revision__ = "$Revision: 53369 $"
  17. #-----------------------------------------------------------------------------#
  18. import synglob
  19. #-----------------------------------------------------------------------------#
  20. DOSBAT_KEYWORDS = (0, "append arp assoc at atmadm attrib bootcfg break cacls "
  21. "call cd chcp chdir chkdsk chkntfs cls cmd color command "
  22. "comp compact control convert copy date debug defrag del "
  23. "delete dir diskcomp diskcopy doskey echo edit edlin "
  24. "else endlocal EQU erase errorlevel exists exit expand "
  25. "fc find findstr for format ftp ftype GEQ goto graftabl "
  26. "GTR help if ipconfig keyb label LEQ loadfix logoff LSS "
  27. "md mkdir mode more move nbtstat NEQ net netsh netstat "
  28. "nlsfunc not nslookup path pathping pause ping popd "
  29. "print prompt pushd rd rem ren rename replace restore "
  30. "rmdir route runas set setlocal setver share shift "
  31. "shutdown sort start subst time title telnet tracetr "
  32. "tree type ver verify vol xcopy ")
  33. # WinBatch Keywords
  34. WINBAT_KEYWORDS = (0, "if then else endif break end return exit next while for "
  35. "gosub goto switch select to case endselect endwhile "
  36. "endswitch aboveicons acc_attrib acc_chng_nt acc_control "
  37. "acc_create acc_delete acc_full_95 acc_full_nt acc_list "
  38. "acc_pfull_nt acc_pmang_nt acc_print_nt acc_read "
  39. "acc_read_95 acc_read_nt acc_write amc arrange ascending "
  40. "attr_a attr_a attr_ci attr_ci attr_dc attr_dc attr_di "
  41. "attr_di attr_dm attr_dm attr_h attr_h attr_ic attr_ic "
  42. "attr_p attr_p attr_ri attr_ri attr_ro attr_ro attr_sh "
  43. "attr_sh attr_sy attr_sy attr_t attr_t attr_x attr_x "
  44. "avogadro backscan boltzmann cancel capslock check "
  45. "columnscommonformat cr crlf ctrl default default "
  46. "deg2rad descending disable drive electric enable eulers "
  47. "false faraday float8 fwdscan gftsec globalgroup gmtsec "
  48. "goldenratio gravitation hidden icon lbutton lclick "
  49. "ldblclick lf lightmps lightmtps localgroup magfield "
  50. "major mbokcancel mbutton mbyesno mclick mdblclick minor "
  51. "msformat multiple ncsaformat no none none noresize "
  52. "normal notify nowait numlock off on open parsec "
  53. "parseonly pi planckergs planckjoules printer rad2deg "
  54. "rbutton rclick rdblclick regclasses regcurrent "
  55. "regmachine regroot regusers rows save scrolllock server "
  56. "shift single sorted stack string tab tile true uncheck "
  57. "unsorted wait wholesection word1 word2 word4 yes zoomed "
  58. "about abs acos addextender appexist appwaitclose asin "
  59. "askfilename askfiletext askitemlist askline askpassword "
  60. "askyesno atan average beep binaryalloc binarycopy "
  61. "binaryeodget binaryeodset binaryfree binaryhashrec "
  62. "binaryincr binaryincr2 binaryincr4 binaryincrflt "
  63. "binaryindex binaryindexnc binaryoletype binarypeek "
  64. "binarypeek2 binarypeek4 binarypeekflt binarypeekstr "
  65. "binarypoke binarypoke2 binarypoke4 binarypokeflt "
  66. "binarypokestr binaryread binarysort binarystrcnt "
  67. "binarywrite boxbuttondraw boxbuttonkill boxbuttonstat "
  68. "boxbuttonwait boxcaption boxcolor boxdataclear "
  69. "boxdatatag boxdestroy boxdrawcircle boxdrawline "
  70. "boxdrawrect boxdrawtext boxesup boxmapmode boxnew "
  71. "boxopen boxpen boxshut boxtext boxtextcolor boxtextfont "
  72. "boxtitle boxupdates break buttonnames by call callext "
  73. "ceiling char2num clipappend clipget clipput continue "
  74. "cos cosh datetime ddeexecute ddeinitiate ddepoke "
  75. "dderequest ddeterminate ddetimeout debug debugdata "
  76. "decimals delay dialog dialogbox dirattrget dirattrset "
  77. "dirchange direxist")
  78. #---- Language Styling Specs ----#
  79. SYNTAX_ITEMS = [ ('STC_BAT_DEFAULT', "default_style"),
  80. ('STC_BAT_COMMAND', "class_style"),
  81. ('STC_BAT_COMMENT', "comment_style"),
  82. ('STC_BAT_HIDE', "string_style"),
  83. ('STC_BAT_IDENTIFIER', "scalar_style"),
  84. ('STC_BAT_LABEL', "class_style"),
  85. ('STC_BAT_OPERATOR', "operator_style"),
  86. ('STC_BAT_WORD', "keyword_style") ]
  87. #---- Extra Properties ----#
  88. FOLD = ("fold", "1")
  89. #-----------------------------------------------------------------------------#
  90. #---- Required Module Functions ----#
  91. def Keywords(lang_id=0):
  92. """Returns Specified Keywords List
  93. @param lang_id: used to select specific subset of keywords
  94. """
  95. if lang_id == synglob.ID_LANG_BATCH:
  96. return [DOSBAT_KEYWORDS]
  97. else:
  98. return list()
  99. def SyntaxSpec(lang_id=0):
  100. """Syntax Specifications
  101. @param lang_id: used for selecting a specific subset of syntax specs
  102. """
  103. if lang_id == synglob.ID_LANG_BATCH:
  104. return SYNTAX_ITEMS
  105. else:
  106. return list()
  107. def Properties(lang_id=0):
  108. """Returns a list of Extra Properties to set
  109. @param lang_id: used to select a specific set of properties
  110. """
  111. if lang_id == synglob.ID_LANG_BATCH:
  112. return [FOLD]
  113. else:
  114. return list()
  115. def CommentPattern(lang_id=0):
  116. """Returns a list of characters used to comment a block of code
  117. @param lang_id: used to select a specific subset of comment pattern(s)
  118. """
  119. if lang_id == synglob.ID_LANG_BATCH:
  120. return [u'rem']
  121. else:
  122. return list()
  123. #---- End Required Functions ----#
  124. #---- Syntax Modules Internal Functions ----#
  125. def KeywordString():
  126. """Returns the specified Keyword String
  127. @note: not used by most modules
  128. """
  129. return None
  130. #---- End Syntax Modules Internal Functions ----#