xref: /original-bsd/usr.bin/pascal/src/yyseman.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1980, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)yyseman.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include "whoami.h"
13 #include "0.h"
14 #include "tree_ty.h"	/* must be included for yy.h */
15 #include "yy.h"
16 
17 /*
18  * Assign semantics to a generated token
19  *
20  * Most terminals have a semantic value the current
21  * input line.  If they are generated they are flagged
22  * by having this number negated.
23  *
24  * The terminals which have true semantics such
25  * as identifiers and strings are instead given
26  * semantic value NIL here - we do not attempt
27  * to do repair, e.g. by giving generated integers
28  * the value 1, etc.
29  */
30 nullsem(ch)
31 	int ch;
32 {
33 
34 	switch (ch) {
35 		case YID:
36 		case YINT:
37 		case YNUMB:
38 		case YBINT:
39 		case YSTRING:
40 			return (NIL);
41 		default:
42 			return (-yyeline);
43 	}
44 }
45