Changeset 9


Ignore:
Timestamp:
Aug 17, 2010, 11:02:59 AM (14 years ago)
Author:
ertl-ishikawa
Message:

WORNINGとERRORのEND対応がとれていないバグを修正.

Location:
tf-mode/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tf-mode/trunk/tf-mode.el

    r2 r9  
    119119
    120120(defvar *tf-block-beg-re*
    121   "[\$]\\(IF\\|FOREACH\\|JOINEACH\\|FUNCTION\\)[ ]")
     121  "[\$]\\(\\(IF\\|FOREACH\\|JOINEACH\\|FUNCTION\\|ERROR\\|WORNING\\)[ ]\\|\\(ERROR\\|WORNING\\)[\$]\\)")
    122122(defvar *tf-block-mid-re*
    123123  "\$ELSE[\$]")
     
    240240
    241241;; 対応を探すための正規表現
    242 (defvar *tf-block-keyword* "[\$]\\(IF[ \t]\\|FOREACH[ \t]\\|JOINEACH[ \t]\\|FUNCTION[ \t]\\|END[\$]\\)")
     242(defvar *tf-block-keyword* "[\$]\\(IF[ \t]\\|FOREACH[ \t]\\|JOINEACH[ \t]\\|FUNCTION[ \t]\\|END[\$]\\|ERROR[ \$]\\|WORNING[ \$]\\)")
    243243(defvar *tf-block-tag* 'tf-block)
    244244
  • tf-mode/trunk/tf-mode.l

    r2 r9  
    7575  (setq *tf-mode-map* (make-sparse-keymap))
    7676  (define-key *tf-mode-map* #\TAB 'tf-indent-line)
     77  (define-key *tf-mode-map* '(#\C-c #\I) 'tf-indent-region)
    7778  )
    7879
    7980(defvar *tf-mode-syntax-table* nil)
    8081(unless *tf-mode-syntax-table*
    81   (setq *tf-mode-syntax-table* (make-syntax-table)))
    82 ;;  (set-syntax-start-comment *tf-mode-syntax-table* #\$\t t)
    83 ;;  (set-syntax-end-comment *tf-mode-syntax-table* #\LFD nil t))
     82  (setq *tf-mode-syntax-table* (make-syntax-table))
     83  (do ((x #x21 (1+ x)))((>= x #x7f))
     84    (let ((c (code-char x)))
     85      (unless (alphanumericp c)
     86        (set-syntax-punctuation *tf-mode-syntax-table* c))))
     87  (set-syntax-option *tf-mode-syntax-table*
     88                     *syntax-option-c-preprocessor*)
     89  (set-syntax-string *tf-mode-syntax-table* #\")
     90  (set-syntax-string *tf-mode-syntax-table* #\')
     91  (set-syntax-escape *tf-mode-syntax-table* #\\)
     92  (set-syntax-symbol *tf-mode-syntax-table* #\_)
     93  (set-syntax-symbol *tf-mode-syntax-table* #\#)
     94  (set-syntax-match *tf-mode-syntax-table* #\( #\))
     95  (set-syntax-match *tf-mode-syntax-table* #\{ #\})
     96  (set-syntax-match *tf-mode-syntax-table* #\[ #\]))
    8497
    8598
     
    117130
    118131(defvar *tf-block-beg-re*
    119   "[\$]\\(IF\\|FOREACH\\|JOINEACH\\|FUNCTION\\)[ ]")
     132  "[\$]\\(\\(IF\\|FOREACH\\|JOINEACH\\|FUNCTION\\|ERROR\\|WORNING\\)[ ]\\|\\(ERROR\\|WORNING\\)[\$]\\)")
    120133(defvar *tf-block-mid-re*
    121134  "\$ELSE[\$]")
     
    213226  t)
    214227
     228(defun tf-indent-region (from to)
     229  (interactive "*r")
     230  (if (> from to)
     231      (rotatef from to))
     232  (save-excursion
     233    (save-restriction
     234      (narrow-to-region (point-min) to)
     235      (goto-char from)
     236      (goto-eol)
     237;;      (delete-trailing-spaces)
     238      (while (forward-line 1)
     239        (goto-eol)
     240;;      (delete-trailing-spaces)
     241        (unless (bolp)
     242          (funcall mode-specific-indent-command)))))
     243  t)
     244
    215245;; -------------------------------------------------------------------------
    216246;;
     
    246276
    247277;; ‘Ήž‚ð’T‚·‚½‚߂̐³‹K•\Œ»
    248 (defvar *tf-block-keyword* "[\$]\\(IF[ \t]\\|FOREACH[ \t]\\|JOINEACH[ \t]\\|FUNCTION[ \t]\\|END[\$]\\)")
     278(defvar *tf-block-keyword* "[\$]\\(IF[ \t]\\|FOREACH[ \t]\\|JOINEACH[ \t]\\|FUNCTION[ \t]\\|END[\$]\\|ERROR[ \$]\\|WORNING[ \$]\\)")
    249279(defvar *tf-block-tag* 'tf-block)
    250280
Note: See TracChangeset for help on using the changeset viewer.