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