# HG changeset patch # User Richard M. Stallman # Date 872528802 0 # Node ID 8fc9b5fc76330b47eb5083175f7de12ebae55913 # Parent cec6bad39e23dde3124977dde2600c399cb220e6 (hif-greater, hif-less, hif-greater-equal) (hif-less-equal): New functions. (hif-tokenize): Handle new tokens >, <, >=, <=. (hif-eq-expr): Handle parsing these new tokens. (hif-token-regexp): Match >, <. >=, <= diff -r cec6bad39e23 -r 8fc9b5fc7633 lisp/progmodes/hideif.el --- a/lisp/progmodes/hideif.el Mon Aug 25 17:06:01 1997 +0000 +++ b/lisp/progmodes/hideif.el Mon Aug 25 17:06:42 1997 +0000 @@ -351,7 +351,7 @@ ; pattern to match initial identifier, !, &&, ||, (, or ). ; Added ==, + and -: garyo@avs.com 8/9/94 -(defconst hif-token-regexp "^\\(&&\\|||\\|[!=]=\\|!\\|[()+-]\\|\\w+\\)") +(defconst hif-token-regexp "^\\(&&\\|||\\|[!=]=\\|!\\|[()+-]\\|[<>]=?\\|\\w+\\)") (defconst hif-end-of-comment "\\*/") @@ -403,6 +403,10 @@ ((string-equal token "defined") 'hif-defined) ((string-equal token "(") 'lparen) ((string-equal token ")") 'rparen) + ((string-equal token ">") 'hif-greater) + ((string-equal token "<") 'hif-less) + ((string-equal token ">=") 'hif-greater-equal) + ((string-equal token "<=") 'hif-less-equal) ((string-equal token "+") 'hif-plus) ((string-equal token "-") 'hif-minus) (t (intern token))) @@ -448,10 +452,11 @@ result)) (defun hif-eq-expr () - "Parse an eq-expr : math | eq-expr '=='|'!=' math." + "Parse an eq-expr : math | eq-expr `=='|`!='|`<'|`>'|`>='|`<=' math." (let ((result (hif-math)) (eq-token nil)) - (while (or (eq token 'equal) (eq token 'hif-notequal)) + (while (memq token '(equal hif-notequal hif-greater hif-less + hif-greater-equal hif-less-equal)) (setq eq-token token) (hif-nexttoken) (setq result (list eq-token result (hif-math)))) @@ -524,7 +529,18 @@ (defun hif-notequal (a b) "Like (not (equal A B)) but as one symbol." (not (equal a b))) - +(defun hif-greater (a b) + "Simple comparison." + (> (hif-mathify a) (hif-mathify b))) +(defun hif-less (a b) + "Simple comparison." + (< (hif-mathify a) (hif-mathify b))) +(defun hif-greater-equal (a b) + "Simple comparison." + (>= (hif-mathify a) (hif-mathify b))) +(defun hif-less-equal (a b) + "Simple comparison." + (<= (hif-mathify a) (hif-mathify b))) ;;;----------- end of parser -----------------------