aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax.h')
-rw-r--r--src/syntax.h36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/syntax.h b/src/syntax.h
index 1350d87162b..73fbb153338 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -83,35 +83,49 @@ struct gl_state_s
83extern struct gl_state_s gl_state; 83extern struct gl_state_s gl_state;
84 84
85/* Fetch the information from the entry for character C 85/* Fetch the information from the entry for character C
86 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).
87 Does inheritance. */ 88 Does inheritance. */
88 89
89INLINE Lisp_Object 90INLINE Lisp_Object
90SYNTAX_ENTRY (int c) 91syntax_property_entry (int c, bool via_property)
91{ 92{
92#ifdef SYNTAX_ENTRY_VIA_PROPERTY 93 if (via_property)
93 return (gl_state.use_global 94 return (gl_state.use_global
94 ? gl_state.global_code 95 ? gl_state.global_code
95 : CHAR_TABLE_REF (gl_state.current_syntax_table, c)); 96 : CHAR_TABLE_REF (gl_state.current_syntax_table, c));
96#else
97 return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c); 97 return CHAR_TABLE_REF (BVAR (current_buffer, syntax_table), c);
98#endif 98}
99INLINE Lisp_Object
100SYNTAX_ENTRY (int c)
101{
102 return syntax_property_entry (c, 0);
99} 103}
100 104
101/* Extract the information from the entry for character C 105/* Extract the information from the entry for character C
102 in the current syntax table. */ 106 in the current syntax table. */
103 107
104INLINE int 108INLINE int
105SYNTAX_WITH_FLAGS (int c) 109syntax_property_with_flags (int c, bool via_property)
106{ 110{
107 Lisp_Object ent = SYNTAX_ENTRY (c); 111 Lisp_Object ent = syntax_property_entry (c, via_property);
108 return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace; 112 return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace;
109} 113}
114INLINE int
115SYNTAX_WITH_FLAGS (int c)
116{
117 return syntax_property_with_flags (c, 0);
118}
110 119
111INLINE enum syntaxcode 120INLINE enum syntaxcode
121syntax_property (int c, bool via_property)
122{
123 return syntax_property_with_flags (c, via_property) & 0xff;
124}
125INLINE enum syntaxcode
112SYNTAX (int c) 126SYNTAX (int c)
113{ 127{
114 return SYNTAX_WITH_FLAGS (c) & 0xff; 128 return syntax_property (c, 0);
115} 129}
116 130
117 131