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