diff options
Diffstat (limited to 'src/syntax.h')
| -rw-r--r-- | src/syntax.h | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/src/syntax.h b/src/syntax.h index 1b96284af42..73fbb153338 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -19,9 +19,6 @@ You should have received a copy of the GNU General Public License | |||
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 20 | 20 | ||
| 21 | INLINE_HEADER_BEGIN | 21 | INLINE_HEADER_BEGIN |
| 22 | #ifndef SYNTAX_INLINE | ||
| 23 | # define SYNTAX_INLINE INLINE | ||
| 24 | #endif | ||
| 25 | 22 | ||
| 26 | extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); | 23 | extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); |
| 27 | 24 | ||
| @@ -86,35 +83,49 @@ struct gl_state_s | |||
| 86 | extern struct gl_state_s gl_state; | 83 | extern struct gl_state_s gl_state; |
| 87 | 84 | ||
| 88 | /* Fetch the information from the entry for character C | 85 | /* Fetch the information from the entry for character C |
| 89 | in syntax table TABLE, or from globally kept data (gl_state). | 86 | in the current buffer's syntax table, |
| 87 | or (if VIA_PROPERTY) from globally kept data (gl_state). | ||
| 90 | Does inheritance. */ | 88 | Does inheritance. */ |
| 91 | 89 | ||
| 92 | SYNTAX_INLINE Lisp_Object | 90 | INLINE Lisp_Object |
| 93 | SYNTAX_ENTRY (int c) | 91 | syntax_property_entry (int c, bool via_property) |
| 94 | { | 92 | { |
| 95 | #ifdef SYNTAX_ENTRY_VIA_PROPERTY | 93 | if (via_property) |
| 96 | return (gl_state.use_global | 94 | return (gl_state.use_global |
| 97 | ? gl_state.global_code | 95 | ? gl_state.global_code |
| 98 | : CHAR_TABLE_REF (gl_state.current_syntax_table, c)); | 96 | : CHAR_TABLE_REF (gl_state.current_syntax_table, c)); |
| 99 | #else | ||
| 100 | return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c); | 97 | return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c); |
| 101 | #endif | 98 | } |
| 99 | INLINE Lisp_Object | ||
| 100 | SYNTAX_ENTRY (int c) | ||
| 101 | { | ||
| 102 | return syntax_property_entry (c, 0); | ||
| 102 | } | 103 | } |
| 103 | 104 | ||
| 104 | /* Extract the information from the entry for character C | 105 | /* Extract the information from the entry for character C |
| 105 | in the current syntax table. */ | 106 | in the current syntax table. */ |
| 106 | 107 | ||
| 107 | SYNTAX_INLINE int | 108 | INLINE int |
| 108 | SYNTAX_WITH_FLAGS (int c) | 109 | syntax_property_with_flags (int c, bool via_property) |
| 109 | { | 110 | { |
| 110 | Lisp_Object ent = SYNTAX_ENTRY (c); | 111 | Lisp_Object ent = syntax_property_entry (c, via_property); |
| 111 | return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace; | 112 | return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace; |
| 112 | } | 113 | } |
| 114 | INLINE int | ||
| 115 | SYNTAX_WITH_FLAGS (int c) | ||
| 116 | { | ||
| 117 | return syntax_property_with_flags (c, 0); | ||
| 118 | } | ||
| 113 | 119 | ||
| 114 | SYNTAX_INLINE enum syntaxcode | 120 | INLINE enum syntaxcode |
| 121 | syntax_property (int c, bool via_property) | ||
| 122 | { | ||
| 123 | return syntax_property_with_flags (c, via_property) & 0xff; | ||
| 124 | } | ||
| 125 | INLINE enum syntaxcode | ||
| 115 | SYNTAX (int c) | 126 | SYNTAX (int c) |
| 116 | { | 127 | { |
| 117 | return SYNTAX_WITH_FLAGS (c) & 0xff; | 128 | return syntax_property (c, 0); |
| 118 | } | 129 | } |
| 119 | 130 | ||
| 120 | 131 | ||
| @@ -137,7 +148,7 @@ extern char const syntax_code_spec[16]; | |||
| 137 | The value is meant for use in code that does nothing when | 148 | The value is meant for use in code that does nothing when |
| 138 | parse_sexp_lookup_properties is 0, so return 0 in that case, for speed. */ | 149 | parse_sexp_lookup_properties is 0, so return 0 in that case, for speed. */ |
| 139 | 150 | ||
| 140 | SYNTAX_INLINE ptrdiff_t | 151 | INLINE ptrdiff_t |
| 141 | SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos) | 152 | SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos) |
| 142 | { | 153 | { |
| 143 | return (! parse_sexp_lookup_properties | 154 | return (! parse_sexp_lookup_properties |
| @@ -157,7 +168,7 @@ SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos) | |||
| 157 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is | 168 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is |
| 158 | currently good for a position before CHARPOS. */ | 169 | currently good for a position before CHARPOS. */ |
| 159 | 170 | ||
| 160 | SYNTAX_INLINE void | 171 | INLINE void |
| 161 | UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) | 172 | UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) |
| 162 | { | 173 | { |
| 163 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) | 174 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) |
| @@ -167,7 +178,7 @@ UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) | |||
| 167 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is | 178 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is |
| 168 | currently good for a position after CHARPOS. */ | 179 | currently good for a position after CHARPOS. */ |
| 169 | 180 | ||
| 170 | SYNTAX_INLINE void | 181 | INLINE void |
| 171 | UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos) | 182 | UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos) |
| 172 | { | 183 | { |
| 173 | if (parse_sexp_lookup_properties && charpos < gl_state.b_property) | 184 | if (parse_sexp_lookup_properties && charpos < gl_state.b_property) |
| @@ -176,7 +187,7 @@ UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos) | |||
| 176 | 187 | ||
| 177 | /* Make syntax table good for CHARPOS. */ | 188 | /* Make syntax table good for CHARPOS. */ |
| 178 | 189 | ||
| 179 | SYNTAX_INLINE void | 190 | INLINE void |
| 180 | UPDATE_SYNTAX_TABLE (ptrdiff_t charpos) | 191 | UPDATE_SYNTAX_TABLE (ptrdiff_t charpos) |
| 181 | { | 192 | { |
| 182 | UPDATE_SYNTAX_TABLE_BACKWARD (charpos); | 193 | UPDATE_SYNTAX_TABLE_BACKWARD (charpos); |
| @@ -185,7 +196,7 @@ UPDATE_SYNTAX_TABLE (ptrdiff_t charpos) | |||
| 185 | 196 | ||
| 186 | /* Set up the buffer-global syntax table. */ | 197 | /* Set up the buffer-global syntax table. */ |
| 187 | 198 | ||
| 188 | SYNTAX_INLINE void | 199 | INLINE void |
| 189 | SETUP_BUFFER_SYNTAX_TABLE (void) | 200 | SETUP_BUFFER_SYNTAX_TABLE (void) |
| 190 | { | 201 | { |
| 191 | gl_state.use_global = 0; | 202 | gl_state.use_global = 0; |