summaryrefslogtreecommitdiff
path: root/unproto/token.h
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1996-03-24 17:45:55 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:29:43 +0200
commitfe22c37817ce338fbbc90b239320248c270957fa (patch)
treed9550410c4a20bdd382fcc58d2d3d7c5e04e5245 /unproto/token.h
parenta7aba15e8efffb1c5d3097656f1a93955a64f01f (diff)
parent42192453ea219b80d0bf9f41e51e36d3d4d0740b (diff)
downloaddev86-fe22c37817ce338fbbc90b239320248c270957fa.tar.gz
Import Dev86-0.0.4.tar.gzv0.0.4
Diffstat (limited to 'unproto/token.h')
-rw-r--r--unproto/token.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/unproto/token.h b/unproto/token.h
new file mode 100644
index 0000000..672039d
--- /dev/null
+++ b/unproto/token.h
@@ -0,0 +1,47 @@
+/* @(#) token.h 1.3 91/11/30 21:10:37 */
+
+struct token {
+ int tokno; /* token value, see below */
+ int len; /* string or list length */
+ struct vstring *vstr; /* token contents */
+ struct token *next;
+ struct token *head;
+ struct token *tail;
+};
+
+/* Special token values */
+
+#define TOK_LIST 256 /* () delimited list */
+#define TOK_WORD 257 /* keyword or identifier */
+#define TOK_NUMBER 258 /* number */
+#define TOK_WSPACE 259 /* white space except newline */
+#define TOK_OTHER 260 /* other multi-char token */
+#define TOK_CONTROL 261 /* flow control keyword */
+#define TOK_COMPOSITE 262 /* struct or union */
+
+/* Input/output functions and macros */
+
+extern struct token *tok_get(); /* read next single token */
+extern void tok_show(); /* display (composite) token */
+extern struct token *tok_class(); /* classify tokens */
+extern void put_ch(); /* write character */
+extern void put_str(); /* write string */
+extern void tok_unget(); /* stuff token back into input */
+
+#define tok_flush(t) (tok_show(t), tok_free(t))
+
+/* tok_get() and tok_class() options */
+
+#define DO_WSPACE 0 /* retain space, tab */
+#define NO_WSPACE 1 /* skip space, tab */
+
+/* Memory management */
+
+struct token *tok_alloc(); /* allocate token storage */
+extern void tok_free(); /* re-cycle storage */
+
+/* Context */
+
+extern char curr_path[]; /* current path name */
+extern int curr_line; /* current line number */
+#define show_line_control() printf("# %d %s\n", curr_line, curr_path);