extern Lisp_Object Qsyntax_table_p;
extern void update_syntax_table P_ ((int, int, int, Lisp_Object));
#define Vstandard_syntax_table buffer_defaults.syntax_table
enum syntaxcode
{
Swhitespace,
Spunct,
Sword,
Ssymbol,
Sopen,
Sclose,
Squote,
Sstring,
Smath,
Sescape,
Scharquote,
Scomment,
Sendcomment,
Sinherit,
Scomment_fence,
Sstring_fence,
Smax
};
#define SET_RAW_SYNTAX_ENTRY(table, c, val) \
((((c) & 0xFF) == (c)) \
? (XCHAR_TABLE (table)->contents[(unsigned char) (c)] = (val)) \
: Faset ((table), make_number (c), (val)))
#ifdef __GNUC__
#define SYNTAX_ENTRY_FOLLOW_PARENT(table, c) \
({ Lisp_Object _syntax_tbl = (table); \
Lisp_Object _syntax_temp = XCHAR_TABLE (_syntax_tbl)->contents[(c)]; \
while (NILP (_syntax_temp)) \
{ \
_syntax_tbl = XCHAR_TABLE (_syntax_tbl)->parent; \
if (NILP (_syntax_tbl)) \
break; \
_syntax_temp = XCHAR_TABLE (_syntax_tbl)->contents[(c)]; \
} \
_syntax_temp; })
#else
extern Lisp_Object syntax_temp;
extern Lisp_Object syntax_parent_lookup P_ ((Lisp_Object, int));
#define SYNTAX_ENTRY_FOLLOW_PARENT(table, c) \
(syntax_temp = XCHAR_TABLE (table)->contents[(c)], \
(NILP (syntax_temp) \
? syntax_parent_lookup (table, (c)) \
: syntax_temp))
#endif
#ifdef SYNTAX_ENTRY_VIA_PROPERTY
# define SYNTAX_ENTRY(c) \
(gl_state.use_global ? gl_state.global_code : SYNTAX_ENTRY_INT (c))
# define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table
#else
# define SYNTAX_ENTRY SYNTAX_ENTRY_INT
# define CURRENT_SYNTAX_TABLE current_buffer->syntax_table
#endif
#define SYNTAX_ENTRY_INT(c) \
((((c) & 0xFF) == (c)) \
? SYNTAX_ENTRY_FOLLOW_PARENT (CURRENT_SYNTAX_TABLE, \
(unsigned char) (c)) \
: Faref (CURRENT_SYNTAX_TABLE, \
make_number (c)))
#ifdef __GNUC__
#define SYNTAX(c) \
({ Lisp_Object _syntax_temp; \
_syntax_temp = SYNTAX_ENTRY (c); \
(CONSP (_syntax_temp) \
? (enum syntaxcode) (XINT (XCAR (_syntax_temp)) & 0xff) \
: Swhitespace); })
#define SYNTAX_WITH_FLAGS(c) \
({ Lisp_Object _syntax_temp; \
_syntax_temp = SYNTAX_ENTRY (c); \
(CONSP (_syntax_temp) \
? XINT (XCAR (_syntax_temp)) \
: (int) Swhitespace); })
#define SYNTAX_MATCH(c) \
({ Lisp_Object _syntax_temp; \
_syntax_temp = SYNTAX_ENTRY (c); \
(CONSP (_syntax_temp) \
? XCDR (_syntax_temp) \
: Qnil); })
#else
#define SYNTAX(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? (enum syntaxcode) (XINT (XCAR (syntax_temp)) & 0xff) \
: Swhitespace))
#define SYNTAX_WITH_FLAGS(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? XINT (XCAR (syntax_temp)) \
: (int) Swhitespace))
#define SYNTAX_MATCH(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? XCDR (syntax_temp) \
: Qnil))
#endif
#define SYNTAX_COMSTART_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 16) & 1)
#define SYNTAX_COMSTART_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 17) & 1)
#define SYNTAX_COMEND_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 18) & 1)
#define SYNTAX_COMEND_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 19) & 1)
#define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1)
#define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1)
#define SYNTAX_COMMENT_NESTED(c) ((SYNTAX_WITH_FLAGS (c) >> 22) & 1)
#define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1)
#define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1)
#define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1)
#define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1)
#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1)
#define SYNTAX_FLAGS_COMMENT_STYLE(flags) (((flags) >> 21) & 1)
#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1)
extern unsigned char syntax_spec_code[0400];
extern char syntax_code_spec[16];
#define SYNTAX_TABLE_BYTE_TO_CHAR(bytepos) \
(! 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) + BUF_BEGV_BYTE (XBUFFER (gl_state.object)) - 1) - BUF_BEGV (XBUFFER (gl_state.object)) + 1 \
: NILP (gl_state.object) \
? BYTE_TO_CHAR ((bytepos) + BEGV_BYTE - 1) - BEGV + 1 \
: (bytepos))
#define UPDATE_SYNTAX_TABLE_FORWARD(charpos) \
(parse_sexp_lookup_properties \
&& (charpos) >= gl_state.e_property \
? (update_syntax_table ((charpos) + gl_state.offset, 1, 0, \
gl_state.object), \
1) \
: 0)
#define UPDATE_SYNTAX_TABLE_BACKWARD(charpos) \
(parse_sexp_lookup_properties \
&& (charpos) < gl_state.b_property \
? (update_syntax_table ((charpos) + gl_state.offset, -1, 0, \
gl_state.object), \
1) \
: 0)
#define UPDATE_SYNTAX_TABLE(charpos) \
(parse_sexp_lookup_properties \
&& (charpos) < gl_state.b_property \
? (update_syntax_table ((charpos) + gl_state.offset, -1, 0, \
gl_state.object), \
1) \
: (parse_sexp_lookup_properties \
&& (charpos) >= gl_state.e_property \
? (update_syntax_table ((charpos) + gl_state.offset, 1, 0,\
gl_state.object), \
1) \
: 0))
#define SETUP_SYNTAX_TABLE(FROM, COUNT) \
if (1) \
{ \
gl_state.b_property = BEGV; \
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) \
if ((COUNT) > 0 || (FROM) > BEGV) \
update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\
1, Qnil); \
} \
else
#define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT) \
if (1) \
{ \
gl_state.object = (OBJECT); \
if (BUFFERP (gl_state.object)) \
{ \
struct buffer *buf = XBUFFER (gl_state.object); \
gl_state.b_property = 1; \
gl_state.e_property = BUF_ZV (buf) - BUF_BEGV (buf) + 1; \
gl_state.offset = BUF_BEGV (buf) - 1; \
} \
else if (NILP (gl_state.object)) \
{ \
gl_state.b_property = 1; \
gl_state.e_property = ZV - BEGV + 1; \
gl_state.offset = BEGV - 1; \
} \
else if (EQ (gl_state.object, Qt)) \
{ \
gl_state.b_property = 0; \
gl_state.e_property = 1500000000; \
gl_state.offset = 0; \
} \
else \
{ \
gl_state.b_property = 0; \
gl_state.e_property = 1 + SCHARS (gl_state.object); \
gl_state.offset = 0; \
} \
gl_state.use_global = 0; \
gl_state.current_syntax_table = current_buffer->syntax_table; \
if (parse_sexp_lookup_properties) \
update_syntax_table (((FROM) + gl_state.offset \
+ (COUNT > 0 ? 0 : -1)), \
COUNT, 1, gl_state.object); \
} \
else
struct gl_state_s
{
Lisp_Object object;
int start;
int stop;
int use_global;
Lisp_Object global_code;
Lisp_Object current_syntax_table;
Lisp_Object old_prop;
int b_property;
int e_property;
INTERVAL forward_i;
INTERVAL backward_i;
int offset;
};
extern struct gl_state_s gl_state;
extern int parse_sexp_lookup_properties;
extern INTERVAL interval_of P_ ((int, Lisp_Object));
extern int scan_words P_ ((int, int));