xref: /Universal-ctags/parsers/tcl.h (revision 1c3778f39cb6b22f33631b8570724d48eefd2335)
1 /*
2 *   Copyright (c) 2017, Masatake YAMATO
3 *
4 *   This source code is released for free distribution under the terms of the
5 *   GNU General Public License version 2 or (at your option) any later version.
6 */
7 
8 #ifndef CTAGS_PARSER_TCL_H
9 #define CTAGS_PARSER_TCL_H
10 
11 /*
12 *   INCLUDE FILES
13 */
14 #include "general.h"  /* must always come first */
15 
16 #include "subparser.h"
17 #include "tokeninfo.h"
18 
19 typedef struct sTclSubparser tclSubparser;
20 
21 enum TclTokenType {
22 	/* 0..255 are the byte's value */
23 	TOKEN_TCL_EOF = 256,
24 	TOKEN_TCL_UNDEFINED,
25 	TOKEN_TCL_KEYWORD,
26 	TOKEN_TCL_IDENTIFIER,
27 	TOKEN_TCL_VARIABLE,
28 	TOKEN_TCL_EOL,
29 	TOKEN_TCL_STRING,
30 };
31 
32 struct sTclSubparser {
33 	subparser subparser;
34 
35 	/* `pstate' is needed to call newTclToken(). */
36 	void (* namespaceImportNotify) (tclSubparser *s, char *namespace,
37 									void *pstate);
38 	/* Return CORK_NIL if the command line is NOT consumed.
39 	   If a positive integer is returned, end: field may
40 	   be attached by tcl base parser.
41 	   Return CORK_NIL - 1 if the command line is consumed
42 	   but not tag is made. */
43 	int (* commandNotify) (tclSubparser *s, char *command,
44 						   int parentIndex,
45 						   void *pstate);
46 };
47 
48 extern tokenInfo *newTclToken (void *pstate);
49 extern void skipToEndOfTclCmdline (tokenInfo *const token);
50 
51 #endif	/* CTAGS_PARSER_TCL_H */
52