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