diff options
| author | Jim Blandy | 1992-01-13 22:04:23 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-01-13 22:04:23 +0000 |
| commit | 9889c728e0ac840005a175e736f9bacd1a45cd56 (patch) | |
| tree | 565fd03a44a520f7af8538200d89824c4f1a762e /src/syntax.h | |
| parent | 265a9e559da4ac72d154ecd638c51801b3e97847 (diff) | |
| download | emacs-9889c728e0ac840005a175e736f9bacd1a45cd56.tar.gz emacs-9889c728e0ac840005a175e736f9bacd1a45cd56.zip | |
Initial revision
Diffstat (limited to 'src/syntax.h')
| -rw-r--r-- | src/syntax.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/syntax.h b/src/syntax.h new file mode 100644 index 00000000000..6bd9757c3a8 --- /dev/null +++ b/src/syntax.h | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | /* Declarations having to do with GNU Emacs syntax tables. | ||
| 2 | Copyright (C) 1985 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This file is part of GNU Emacs. | ||
| 5 | |||
| 6 | GNU Emacs is free software; you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 1, or (at your option) | ||
| 9 | any later version. | ||
| 10 | |||
| 11 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with GNU Emacs; see the file COPYING. If not, write to | ||
| 18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
| 19 | |||
| 20 | |||
| 21 | extern Lisp_Object Qsyntax_table_p; | ||
| 22 | extern Lisp_Object Fsyntax_table_p (), Fsyntax_table (), Fset_syntax_table (); | ||
| 23 | |||
| 24 | /* The standard syntax table is stored where it will automatically | ||
| 25 | be used in all new buffers. */ | ||
| 26 | #define Vstandard_syntax_table buffer_defaults.syntax_table | ||
| 27 | |||
| 28 | /* A syntax table is a Lisp vector of length 0400, whose elements are integers. | ||
| 29 | |||
| 30 | The low 8 bits of the integer is a code, as follows: | ||
| 31 | */ | ||
| 32 | |||
| 33 | enum syntaxcode | ||
| 34 | { | ||
| 35 | Swhitespace, /* for a whitespace character */ | ||
| 36 | Spunct, /* for random punctuation characters */ | ||
| 37 | Sword, /* for a word constituent */ | ||
| 38 | Ssymbol, /* symbol constituent but not word constituent */ | ||
| 39 | Sopen, /* for a beginning delimiter */ | ||
| 40 | Sclose, /* for an ending delimiter */ | ||
| 41 | Squote, /* for a prefix character like Lisp ' */ | ||
| 42 | Sstring, /* for a string-grouping character like Lisp " */ | ||
| 43 | Smath, /* for delimiters like $ in Tex. */ | ||
| 44 | Sescape, /* for a character that begins a C-style escape */ | ||
| 45 | Scharquote, /* for a character that quotes the following character */ | ||
| 46 | Scomment, /* for a comment-starting character */ | ||
| 47 | Sendcomment, /* for a comment-ending character */ | ||
| 48 | Smax /* Upper bound on codes that are meaningful */ | ||
| 49 | }; | ||
| 50 | |||
| 51 | #define SYNTAX(c) \ | ||
| 52 | ((enum syntaxcode) (XINT (XVECTOR (current_buffer->syntax_table)->contents[c]) & 0377)) | ||
| 53 | |||
| 54 | /* The next 8 bits of the number is a character, | ||
| 55 | the matching delimiter in the case of Sopen or Sclose. */ | ||
| 56 | |||
| 57 | #define SYNTAX_MATCH(c) \ | ||
| 58 | ((XINT (XVECTOR (current_buffer->syntax_table)->contents[c]) >> 8) & 0377) | ||
| 59 | |||
| 60 | /* Then there are five single-bit flags that have the following meanings: | ||
| 61 | 1. This character is the first of a two-character comment-start sequence. | ||
| 62 | 2. This character is the second of a two-character comment-start sequence. | ||
| 63 | 3. This character is the first of a two-character comment-end sequence. | ||
| 64 | 4. This character is the second of a two-character comment-end sequence. | ||
| 65 | 5. This character is a prefix, for backward-prefix-chars. | ||
| 66 | Note that any two-character sequence whose first character has flag 1 | ||
| 67 | and whose second character has flag 2 will be interpreted as a comment start. */ | ||
| 68 | |||
| 69 | #define SYNTAX_COMSTART_FIRST(c) \ | ||
| 70 | ((XINT (XVECTOR (current_buffer->syntax_table)->contents[c]) >> 16) & 1) | ||
| 71 | |||
| 72 | #define SYNTAX_COMSTART_SECOND(c) \ | ||
| 73 | ((XINT (XVECTOR (current_buffer->syntax_table)->contents[c]) >> 17) & 1) | ||
| 74 | |||
| 75 | #define SYNTAX_COMEND_FIRST(c) \ | ||
| 76 | ((XINT (XVECTOR (current_buffer->syntax_table)->contents[c]) >> 18) & 1) | ||
| 77 | |||
| 78 | #define SYNTAX_COMEND_SECOND(c) \ | ||
| 79 | ((XINT (XVECTOR (current_buffer->syntax_table)->contents[c]) >> 19) & 1) | ||
| 80 | |||
| 81 | #define SYNTAX_PREFIX(c) \ | ||
| 82 | ((XINT (XVECTOR (current_buffer->syntax_table)->contents[c]) >> 20) & 1) | ||
| 83 | |||
| 84 | /* This array, indexed by a character, contains the syntax code which that | ||
| 85 | character signifies (as a char). For example, | ||
| 86 | (enum syntaxcode) syntax_spec_code['w'] is Sword. */ | ||
| 87 | |||
| 88 | extern unsigned char syntax_spec_code[0400]; | ||
| 89 | |||
| 90 | /* Indexed by syntax code, give the letter that describes it. */ | ||
| 91 | |||
| 92 | extern char syntax_code_spec[13]; | ||