• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/progmodes/

Lines Matching +defs:end +defs:of

10 ;; This file is part of GNU Emacs.
13 ;; it under the terms of the GNU General Public License as published by
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; You should have received a copy of the GNU General Public License
29 ;; This file contains (most of) the adaptations to cc-mode required for the
30 ;; integration of AWK Mode.
38 ;; 6. AWK Mode specific versions of commands like beginning-of-defun.
61 (cc-bytecomp-defun c-beginning-of-statement-1)
91 ;; This section defines regular expressions used in the analysis of AWK code.
105 ;; Matches a newline, or the end of buffer.
113 ;; Matches a possibly empty sequence of escaped newlines. Used in
122 ;; Matches a possibly empty sequence of escaped newlines with optional
126 ;; Matche (the tail of) a line containing at most either a comment or an
137 ;; Matches a (possibly empty) sequence of chars without unescaped /, ", \,
141 ;; Matches the (possibly empty) sequence of chars without unescaped /, ", \,
146 ;; Matches (the tail of) an AWK \"logical\" line not containing an unescaped
148 ;; is matched as part of the line even if it contains a " or a /. The End of
149 ;; buffer is also an end of line.
152 ;; Matches a sequence of (at least one) \"harmless-line\" at point.
160 ;; Matches the inside of an AWK string (i.e. without the enclosing quotes).
161 (defconst c-awk-string-without-end-here-re
173 ;; Matches a (possibly empty) sequence of escaped newlines.
191 ;; Matches the head (or all) of a regexp char class, up to (but not
196 ;; Matches the inside of an AWK regexp (i.e. without the enclosing /s)
197 (defconst c-awk-regexp-without-end-re
205 ;; Matches as much of the head of an AWK regexp which fits on one line,
206 ;; possibly all of it.
215 ;; A "neutral" char(pair). Doesn't change the "state" of a subsequent /.
217 ;; escaped character. Or one of the (illegal) characters @ or `. But NOT an
218 ;; end of line (even if escaped).
221 ;; A (possibly empty) string of neutral characters (or character pairs).
223 ;; Matches a char which is a constituent of a variable or number, or a ket
228 ;; Will match a piece of AWK buffer ending in / which is a division sign, in
237 ;; regexp bracket) these arith ops are unnecessary and a pain, because of "++"
241 ;; Will match a piece of AWK buffer ending in / which is an opening regexp
262 ;; The next section of code is about determining whether or not an AWK
266 ;; it might be the end of a do-while. In AWK, on the other hand, semicolons
268 ;; addition, we have the complexity of escaped EOLs. The core of this
269 ;; analysis is in the middle of the function
276 ;; required but not cached. The c-awk-NL-prop property should be thought of
295 ;; '\' There is an escaped newline at the end of this line and this '\' is
296 ;; essential to the syntax of the program. (i.e. if it had been a
297 ;; frivolous \, it would have been ignored and the line been given one of
306 ;; This set of values has been chosen so that the property's value on a line
307 ;; is completely determined by the contents of the line and the property on
309 ;; statement of a do-while.
314 ;; Note that the end of the ) in a do .... while (<condition>) doesn't
315 ;; count, since the purpose of this routine is essentially to decide
318 ;; DO-LIM sets a limit on how far back we search for the "do" of a possible
331 (not (eq (c-beginning-of-statement-1 do-lim)
377 ;; Move back to just after the first found of either (i) an EOL which has
379 ;; We return either the value of c-awk-NL-prop (in case (i)) or nil.
415 (end-of-line)
417 "\\(^\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\$" ; ODD number of \s at EOL :-)
419 (progn (end-of-line) ; escaped EOL.
422 (end-of-line))) ; The \ at eol is a fake.
427 ;; Calculate and set the value of the c-awk-NL-prop on the immediately
437 ;; See c-awk-after-if-for-while-condition-p for a description of DO-LIM.
442 (beginning-of-line)
464 (end-of-line)
468 ;; We are now at a (possibly empty) sequence of content-free lines.
469 ;; Set c-awk-NL-prop on each of these lines's EOL.
484 ;; See c-awk-after-if-for-while-condition-p for a description of DO-LIM.
498 ;; See c-awk-after-if-for-while-condition-p for a description of DO-LIM.
503 (end-of-line) ; Necessary for the following test to work.
511 ;; Is there an incomplete statement at the end of the previous line?
512 ;; See c-awk-after-if-for-while-condition-p for a description of DO-LIM.
518 ;; Is there an incomplete statement at the end of the current line?
519 ;; See c-awk-after-if-for-while-condition-p for a description of DO-LIM.
530 ;;;; was considered an attribute of the EOL on the line). A real semicolon
550 ;; defeat the (admittedly kludgey) purpose of this function, which is to
551 ;; prevent an infinite recursion in c-beginning-of-statement-1 when point
555 (defun c-awk-clear-NL-props (beg end)
557 ;; c-awk-NL-prop text property from beg to the end of the buffer (The END
576 ;; The following is purely a diagnostic command, to be commented out of the
595 ;; The following section of the code is to do with font-locking. The biggest
599 ;; purpose of the function c-awk-set-syntax-table-properties and the myriad
609 ;; function to have access to the start of the string/regexp, which may be
613 (defun c-awk-beginning-of-logical-line (&optional pos)
614 ;; Go back to the start of the (apparent) current line (or the start of the
615 ;; line containing POS), returning the buffer position of that point. I.e.,
630 (defun c-awk-end-of-logical-line (&optional pos)
631 ;; Go forward to the end of the (apparent) current logical line (or the end of
632 ;; the line containing POS), returning the buffer position of that point. I.e.,
633 ;; go to the end of the next line which doesn't have an escaped EOL.
641 (end-of-line)
644 (end-of-line 2))
647 ;; ACM, 2002/02/15: The idea of the next function is to put the "Error font"
653 (defun c-awk-set-string-regexp-syntax-table-properties (beg end)
657 ;; contents of this string/regex.
670 (cond ((eq end (point-max)) ; string/regexp terminated by EOB
672 ((/= (char-after beg) (char-after end)) ; missing end delimiter
674 (c-put-char-property end 'syntax-table '(15)))
677 (c-put-char-property end 'syntax-table '(7)))
679 ;; Now change the properties of any escaped "s in the string to punctuation.
683 (while (search-forward "\"" end t)
687 ;; Point is at the opening " or _" of a string. Set the syntax-table
694 (search-forward-regexp c-awk-string-without-end-here-re nil t) ; a (possibly unterminated) string
696 (match-beginning 0) (match-end 0))
730 (search-forward-regexp c-awk-regexp-without-end-re)
732 (match-beginning 0) (match-end 0))
748 ;; Fontification"). It also gets called, with a bit of glue, from
755 ;; delimiter of the properly terminated regexp (and left unset on a
757 ;; (ii) the opener of an unterminated string/regexp, we set the property
758 ;; "generic string delimiter" on both the opening " or / and the end of the
768 (c-awk-beginning-of-logical-line) ; ACM 2002/7/21. This is probably redundant.
789 ;; subsequent use of movement functions, etc. However, it seems that if font
793 ;; End of logical line following the region which is about to be changed. Set
796 (defun c-awk-before-change (beg end)
798 ;; It does two things: Finds the end of the (logical) line on which END lies,
804 (setq c-awk-old-EOLL (c-awk-end-of-logical-line end))
806 (c-awk-clear-NL-props end (point-max))))))
808 (defun c-awk-end-of-change-region (beg end old-len)
809 ;; Find the end of the region which needs to be font-locked after a change.
810 ;; This is the end of the logical line on which the change happened, either
815 (max (+ (- c-awk-old-EOLL old-len) (- end beg))
816 (c-awk-end-of-logical-line end)))
818 (defun c-awk-after-change (beg end old-len)
830 (setq end (c-awk-end-of-change-region beg end old-len))
831 (c-awk-beginning-of-logical-line beg)
834 (c-awk-set-syntax-table-properties end)))))))
838 ;; include ALL of any string or regexp within the region. The simplest way to
839 ;; do this in practice is to use the beginning/end-of-logical-line functions.
840 ;; Don't overlook the possibility of the buffer change being the "recapturing"
841 ;; of a previously escaped newline.
848 (ad-set-arg 1 (c-awk-end-of-change-region
850 (ad-get-arg 1) ; end
852 (ad-set-arg 0 (c-awk-beginning-of-logical-line (ad-get-arg 0)))))))
861 ;; Take GNU Emacs's 'words out of the following regexp-opts. They dont work
960 ;; Matches an unterminated string/regexp, NOT including the eol at the end.
966 (defun c-awk-at-statement-end-p ()
967 ;; Point is not inside a comment or string. Is it AT the end of a
968 ;; statement? This means immediately after the last non-ws character of the
981 (defun c-awk-beginning-of-defun (&optional arg)
982 "Move backward to the beginning of an AWK \"defun\". With ARG, do it that
983 many times. Negative arg -N means move forward to Nth following beginning of
984 defun. Returns t unless search stops due to beginning or end of buffer.
987 of a defun is recognized as code starting at column zero which is neither a
988 closing brace nor a comment nor a continuation of the previous line. Unlike
993 comment at the start of cc-engine.el for more info."
999 (let ((found t)) ; Has the most recent regexp search found b-of-defun?
1004 ;; is genuinely a beginning-of-defun.
1020 ;; Point is at the start of an AWK pattern (which may be null) or function
1021 ;; declaration. Move to the pattern's end, and past any trailing space or
1024 ;; absence of an explicit action.
1030 (if (looking-at "#") (end-of-line))
1042 (defun c-awk-end-of-defun1 ()
1043 ;; point is at the start of a "defun". Move to its end. Return end position.
1051 (t (error "c-awk-end-of-defun1: Failure of c-awk-forward-awk-pattern")))
1054 (defun c-awk-beginning-of-defun-p ()
1055 ;; Are we already at the beginning of a defun? (i.e. at code in column 0
1056 ;; which isn't a }, and isn't a continuation line of any sort.
1062 (defun c-awk-end-of-defun (&optional arg)
1063 "Move forward to next end of defun. With argument, do it that many times.
1064 Negative argument -N means move back to Nth preceding end of defun.
1066 An end of a defun occurs right after the closing brace that matches the
1068 no explicit action; see function `c-awk-beginning-of-defun'.
1071 comment at the start of cc-engine.el for more info."
1077 (let ((start-point (point)) end-point)
1078 ;; Strategy: (For +ve ARG): If we're not already at a beginning-of-defun,
1080 ;; Repeat [(i) move forward to end-of-current-defun (see below);
1081 ;; (ii) If this isn't it, move forward to beginning-of-defun].
1084 ;; Try to move back to a beginning-of-defun, if not already at one.
1085 (if (not (c-awk-beginning-of-defun-p))
1086 (when (not (c-awk-beginning-of-defun 1)) ; No bo-defun before point.
1088 (c-awk-beginning-of-defun -1))) ; if this fails, we're at EOB, tough!
1091 (c-awk-end-of-defun1)
1094 (c-awk-beginning-of-defun -1))))
1097 (setq end-point start-point)
1099 (c-awk-beginning-of-defun 1)
1100 (if (< (setq end-point (if (bobp) (point)
1101 (save-excursion (c-awk-end-of-defun1))))
1105 (goto-char (min start-point end-point)))))))