;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Author : $Author$ ; Created By : ; Created : Tue Jun 6 20:36:29 2000 ; Last Modified : <:00606.2042> ; ; Description ; ; Notes ; ; History ; ; Copyright (c) 2000 . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Jscript mode hook ; ; Last Modified : <:00502.0606> ; !if &band .hilight.flags 0x02 !if ¬ &exist .hilight.js set-variable .hilight.js &pinc .hilight.next 1 !endif ; ; High-light Jscript Mode ; 0 hilight .hilight.js 2 50 $global-scheme hilight .hilight.js 2 "//" .scheme.comment hilight .hilight.js 20 "/\\*" "*/" "" .scheme.comment hilight .hilight.js 4 "\"" "\"" "\\" .scheme.string hilight .hilight.js 0 "'.'" .scheme.quote hilight .hilight.js 0 "'\\\\.'" .scheme.quote hilight .hilight.js 0 "'\\\\'" .scheme.error hilight .hilight.js 0 "'\\\\''" .scheme.quote ; hilight .hilight.js 1 "break" .scheme.keyword hilight .hilight.js 1 "case" .scheme.keyword hilight .hilight.js 1 "continue" .scheme.keyword hilight .hilight.js 1 "default" .scheme.keyword hilight .hilight.js 1 "do" .scheme.keyword hilight .hilight.js 1 "else" .scheme.keyword hilight .hilight.js 1 "for" .scheme.keyword hilight .hilight.js 1 "goto" .scheme.keyword hilight .hilight.js 1 "if" .scheme.keyword hilight .hilight.js 1 "in" .scheme.keyword hilight .hilight.js 1 "return" .scheme.keyword hilight .hilight.js 1 "switch" .scheme.keyword hilight .hilight.js 1 "while" .scheme.keyword hilight .hilight.js 1 "with" .scheme.keyword ; hilight .hilight.js 1 "var" .scheme.type hilight .hilight.js 1 "function" .scheme.type hilight .hilight.js 1 "false" .scheme.type hilight .hilight.js 1 "true" .scheme.type hilight .hilight.js 1 "void" .scheme.type hilight .hilight.js 1 "typeof" .scheme.type hilight .hilight.js 1 "volatile" .scheme.type ; Add some system types hilight .hilight.js 1 "Array" .scheme.prepro hilight .hilight.js 1 "Boolean" .scheme.prepro hilight .hilight.js 1 "Date" .scheme.prepro hilight .hilight.js 1 "Function" .scheme.prepro hilight .hilight.js 1 "Math" .scheme.prepro hilight .hilight.js 1 "Number" .scheme.prepro hilight .hilight.js 1 "String" .scheme.prepro hilight .hilight.js 1 "delete" .scheme.keyword hilight .hilight.js 1 "new" .scheme.keyword hilight .hilight.js 1 "this" .scheme.keyword hilight .hilight.js 4 "\\$" "\\}\\W" "" .scheme.variable !endif ;adjustment of matching and replacement-patterns set-variable .hilight.jsR &pinc .hilight.next 1 hilight .hilight.js 0x80 "replace(/" .hilight.jsR .scheme.string 0 hilight .hilight.jsR 0 .scheme.string hilight .hilight.jsR 0x80 ")" .hilight.js .scheme.string ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Bunch of Jscript macros we may need. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; comment line ie xxx -> /*xxx*/ ; define-macro js-start-comment insert-string "/* " &sub &sub $fill-col $window-wcol 2 insert-string "*" !emacro define-macro js-comment-line !while &gre &pdec @# 1 0 beginning-of-line insert-string "/*" end-of-line insert-string "*/" beginning-of-line forward-line !done !emacro ; ; uncoment line ie /*xxx*/ -> xxx ; define-macro js-uncomment-line ; The next line store magic state and enables magic &set #l0 &bmod "magic" buffer-mode "magic" !while &gre &pdec @# 1 0 search-forward "*/" search-backward "/\\*" forward-delete-char forward-delete-char search-forward "*/" backward-delete-char backward-delete-char beginning-of-line forward-line !done ; restore magic mode #l0 buffer-mode "magic" !emacro ; ; fill from the current column to fill-col with '*' and a trailing '/' ; define-macro js-comm-to-end &sub &sub $fill-col $window-wcol 2 insert-string "*" insert-string "*/" !emacro ; ; setup fuctions to auto-load cmacros (the big ones) ; define-macro-file cmacros c-insert-tab c-slashify c-deslashify c-start-comment c-hash-eval c-hash-set-define c-hash-unset-define c-hash-del define-macro-file cbox c-box ; ; Set up the variables for 'C' ; set-variable $c-contcomm " * " define-macro fhook-js ; if arg is 0 this is a new file so add template !if ¬ @# etfinsrt "js" !endif 1 buffer-mode "time" ; 1 buffer-mode "cmode" buffer-abbrev-file "c" set-variable $buffer-mask "luh1" !if &band .hilight.flags 0x02 set-variable $buffer-hilight .hilight.js !endif buffer-bind-key js-start-comment "esc C-c" buffer-bind-key js-comment-line "C-c C-c" buffer-bind-key js-uncomment-line "C-c C-d" buffer-bind-key js-comm-to-end "C-c C-e" buffer-bind-key c-insert-tab "A-tab" buffer-bind-key restyle-region "A-C-i" buffer-bind-key c-box "esc q" buffer-bind-key c-box "esc o" ; Set up the folds for 'C' and C++ buffer-bind-key fold-current "f2" buffer-bind-key fold-all "f3" ; execute user extensions if enabled !if &exist my-fhook-js my-fhook-js !endif !emacro ; set up the indentation for JavaScript 0 indent .hilight.js 0 10 indent .hilight.js n "{" 4 indent .hilight.js o "}" -4 indent .hilight.js i "//" set-variable $buffer-indent .hilight.js 1 buffer-mode "indent" ; folding set-variable .fhook-js.fold-open "^{" set-variable .fhook-js.fold-close "^}" set-variable .fhook-js.item-list-s1 "^\\s *function\\s +\\(\\w[1-9A-Za-z_']*\\)" set-variable .fhook-js.item-list-r1 "Func \ecB\\1\ecA" ml-write "[Jscript file hook loaded]" ; load in user extensions if found !force execute-file "myjs"