summaryrefslogtreecommitdiff
path: root/src/syntax.h
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-03-02 06:01:09 +0000
committerRichard M. Stallman <rms@gnu.org>1998-03-02 06:01:09 +0000
commit663bbb7d811b4faed36e1999047f834bcc2fd777 (patch)
tree67e091e8012fe80ca52353ed4a3afbd35a3ded4c /src/syntax.h
parent71d133dd7a22b9f02545ebed118fab37cbc0c5a3 (diff)
downloademacs-663bbb7d811b4faed36e1999047f834bcc2fd777.tar.gz
(UPDATE_SYNTAX_TABLE): Do nothing unless parse_sexp_lookup_properties.
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD): Likewise. (SYNTAX_TABLE_BYTE_TO_CHAR): If parse_sexp_lookup_properties is 0, return 0 right away. (SETUP_SYNTAX_TABLE): Add if (1) ... else.
Diffstat (limited to 'src/syntax.h')
-rw-r--r--src/syntax.h44
1 files changed, 29 insertions, 15 deletions
diff --git a/src/syntax.h b/src/syntax.h
index ac4b84db04b..dcca2110ce1 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -195,10 +195,16 @@ extern unsigned char syntax_spec_code[0400];
extern char syntax_code_spec[16];
/* Convert the byte offset BYTEPOS into a character position,
- for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT. */
+ for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT.
+
+ The value is meant for use in the UPDATE_SYNTAX_TABLE... macros.
+ These macros do nothing when parse_sexp_lookup_properties is 0,
+ so we return 0 in that case, for speed. */
#define SYNTAX_TABLE_BYTE_TO_CHAR(bytepos) \
- (STRINGP (gl_state.object) \
+ (! parse_sexp_lookup_properties \
+ ? 0 \
+ : STRINGP (gl_state.object) \
? string_byte_to_char (gl_state.object, (bytepos)) \
: BUFFERP (gl_state.object) \
? buf_bytepos_to_charpos (XBUFFER (gl_state.object), (bytepos)) \
@@ -210,7 +216,8 @@ extern char syntax_code_spec[16];
currently good for a position before POS. */
#define UPDATE_SYNTAX_TABLE_FORWARD(pos) \
- ((pos) >= gl_state.e_property \
+ (parse_sexp_lookup_properties \
+ && (pos) >= gl_state.e_property \
? (update_syntax_table ((pos) + gl_state.offset, 1, 0, \
gl_state.object), \
1) \
@@ -220,7 +227,8 @@ extern char syntax_code_spec[16];
currently good for a position after POS. */
#define UPDATE_SYNTAX_TABLE_BACKWARD(pos) \
- ((pos) <= gl_state.b_property \
+ (parse_sexp_lookup_properties \
+ && (pos) <= gl_state.b_property \
? (update_syntax_table ((pos) + gl_state.offset, -1, 0, \
gl_state.object), \
1) \
@@ -229,11 +237,13 @@ extern char syntax_code_spec[16];
/* Make syntax table good for POS. */
#define UPDATE_SYNTAX_TABLE(pos) \
- ((pos) <= gl_state.b_property \
+ (parse_sexp_lookup_properties \
+ && (pos) <= gl_state.b_property \
? (update_syntax_table ((pos) + gl_state.offset, -1, 0, \
gl_state.object), \
1) \
- : ((pos) >= gl_state.e_property \
+ : (parse_sexp_lookup_properties \
+ && (pos) >= gl_state.e_property \
? (update_syntax_table ((pos) + gl_state.offset, 1, 0, \
gl_state.object), \
1) \
@@ -248,15 +258,19 @@ extern char syntax_code_spec[16];
*/
#define SETUP_SYNTAX_TABLE(FROM, COUNT) \
- gl_state.b_property = BEGV - 1; \
- gl_state.e_property = ZV + 1; \
- gl_state.object = Qnil; \
- gl_state.use_global = 0; \
- gl_state.offset = 0; \
- gl_state.current_syntax_table = current_buffer->syntax_table; \
- if (parse_sexp_lookup_properties) \
- update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT), \
- 1, Qnil);
+if (1) \
+ { \
+ gl_state.b_property = BEGV - 1; \
+ gl_state.e_property = ZV + 1; \
+ gl_state.object = Qnil; \
+ gl_state.use_global = 0; \
+ gl_state.offset = 0; \
+ gl_state.current_syntax_table = current_buffer->syntax_table; \
+ if (parse_sexp_lookup_properties) \
+ update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT), \
+ 1, Qnil); \
+ } \
+else
/* Same as above, but in OBJECT. If OBJECT is nil, use current buffer.
If it is t, ignore properties altogether.