5 __IDSTRING(rcsid_syntax_h, "$MirOS: contrib/code/jupp/syntax.h,v 1.5 2017/12/02 17:00:50 tg Exp $");
11 * Syntax highlighting DFA interpreter
13 * (C) 2004 Joseph H. Allen
15 * This file is part of JOE (Joe's Own Editor)
18 /* Color definition */
21 struct high_color *next;
22 const unsigned char *name; /* Symbolic name of color */
23 int color; /* Color value */
29 int no; /* State number */
30 const unsigned char *name; /* Highlight state name */
31 int color; /* Color for this state */
32 struct high_cmd *cmd[256]; /* Character table */
35 /* Command (transition) */
38 struct high_state *new_state; /* The new state */
39 HASH *keywords; /* Hash table of keywords */
40 int recolor; /* No. chars to recolor if <0. */
41 unsigned noeat : 1; /* Set to give this character to next state */
42 unsigned start_buffering : 1; /* Set if we should start buffering */
43 unsigned stop_buffering : 1; /* Set if we should stop buffering */
44 unsigned ignore : 1; /* Set to ignore case */
47 /* Loaded form of syntax file */
50 struct high_syntax *next; /* Linked list of loaded syntaxes */
51 const unsigned char *name; /* Name of this syntax */
52 struct high_state **states; /* The states of this syntax. states[0] is idle state */
53 int nstates; /* No. states */
54 int szstates; /* Malloc size of states array */
55 struct high_color *color; /* Linked list of color definitions */
56 int sync_lines; /* No. lines back to start parsing when we lose sync. -1 means start at beginning */
57 struct high_cmd default_cmd; /* Default transition for new states */
60 /* Find a syntax. Load it if necessary. */
62 struct high_syntax *load_dfa(const unsigned char *name);
64 /* Parse a lines. Returns new state. */
67 int parse(struct high_syntax *syntax, P *line, int state);