[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/hideif.el
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/hideif.el |
Date: |
Mon, 21 Oct 2002 05:06:38 -0400 |
Index: emacs/lisp/progmodes/hideif.el
diff -c emacs/lisp/progmodes/hideif.el:1.45 emacs/lisp/progmodes/hideif.el:1.46
*** emacs/lisp/progmodes/hideif.el:1.45 Sat Dec 1 13:20:52 2001
--- emacs/lisp/progmodes/hideif.el Wed Mar 6 10:11:20 2002
***************
*** 1,6 ****
;;; hideif.el --- hides selected code within ifdef
! ;; Copyright (C) 1988,1994,2001 Free Software Foundation, Inc.
;; Author: Daniel LaLiberte <address@hidden>
;; Maintainer: FSF
--- 1,6 ----
;;; hideif.el --- hides selected code within ifdef
! ;; Copyright (C) 1988,1994,2001, 2002 Free Software Foundation, Inc.
;; Author: Daniel LaLiberte <address@hidden>
;; Maintainer: FSF
***************
*** 309,315 ****
;; pattern to match initial identifier, !, &&, ||, (, or ).
;; Added ==, + and -: address@hidden 8/9/94
(defconst hif-token-regexp
! "\\(&&\\|||\\|[!=]=\\|!\\|[()+-]\\|[<>]=?\\|\\w+\\)")
(defun hif-tokenize (start end)
"Separate string between START and END into a list of tokens."
--- 309,315 ----
;; pattern to match initial identifier, !, &&, ||, (, or ).
;; Added ==, + and -: address@hidden 8/9/94
(defconst hif-token-regexp
! "\\(&&\\|||\\|[!=]=\\|!\\|[()+?:-]\\|[<>]=?\\|\\w+\\)")
(defun hif-tokenize (start end)
"Separate string between START and END into a list of tokens."
***************
*** 342,347 ****
--- 342,349 ----
((string-equal token "<=") 'hif-less-equal)
((string-equal token "+") 'hif-plus)
((string-equal token "-") 'hif-minus)
+ ((string-equal token "?") 'hif-conditional)
+ ((string-equal token ":") 'hif-colon)
((string-match "\\`[0-9]*\\'" token)
(string-to-number token))
(t (intern token)))
***************
*** 368,382 ****
(defun hif-expr ()
"Parse an expression as found in #if.
! expr : term | expr '||' term."
! (let ((result (hif-term)))
(while (eq hif-token 'or)
(hif-nexttoken)
! (setq result (list 'hif-or result (hif-term))))
result))
! (defun hif-term ()
! "Parse a term : eq-expr | term '&&' eq-expr."
(let ((result (hif-eq-expr)))
(while (eq hif-token 'and)
(hif-nexttoken)
--- 370,398 ----
(defun hif-expr ()
"Parse an expression as found in #if.
! expr : or-expr | or-expr '?' expr ':' expr."
! (let ((result (hif-or-expr))
! middle)
! (while (eq hif-token 'hif-conditional)
! (hif-nexttoken)
! (setq middle (hif-expr))
! (if (eq hif-token 'hif-colon)
! (progn
! (hif-nexttoken)
! (setq result (list 'hif-conditional result middle (hif-expr))))
! (error "Error: unexpected token: %s" hif-token)))
! result))
!
! (defun hif-or-expr ()
! "Parse n or-expr : and-expr | or-expr '||' and-expr."
! (let ((result (hif-and-expr)))
(while (eq hif-token 'or)
(hif-nexttoken)
! (setq result (list 'hif-or result (hif-and-expr))))
result))
! (defun hif-and-expr ()
! "Parse an and-expr : eq-expr | and-expr '&&' eq-expr."
(let ((result (hif-eq-expr)))
(while (eq hif-token 'and)
(hif-nexttoken)
***************
*** 449,454 ****
--- 465,472 ----
((null val) 0)
(t val)))
+ (defun hif-conditional (a b c)
+ (if (not (zerop (hif-mathify a))) (hif-mathify b) (hif-mathify c)))
(defun hif-and (a b)
(and (not (zerop (hif-mathify a))) (not (zerop (hif-mathify b)))))
(defun hif-or (a b)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/progmodes/hideif.el,
Juanma Barranquero <=