1: #
2: /*
3: * pi - Pascal interpreter code translator
4: *
5: * Charles Haley, Bill Joy UCB
6: * Version 1.2 January 1979
7: *
8: *
9: * pxp - Pascal execution profiler
10: *
11: * Bill Joy UCB
12: * Version 1.2 January 1979
13: */
14:
15: #include "0.h"
16: #include "yy.h"
17:
18: long tokname();
19:
20: STATIC char bounce;
21:
22: /*
23: * Printing representation of a
24: * "character" - a lexical token
25: * not in a yytok structure.
26: */
27: long
28: charname(ch)
29: int ch;
30: {
31: struct yytok Ych;
32:
33: Ych.Yychar = ch;
34: Ych.Yylval = nullsem(ch);
35: return (tokname(&Ych));
36: }
37:
38: /*
39: * Printing representation of a token
40: */
41: long
42: tokname(tp)
43: register struct yytok *tp;
44: {
45: register char *cp;
46: register struct kwtab *kp;
47: long l;
48:
49: (&l)->pint2 = "";
50: switch (tp->Yychar) {
51: case YCASELAB:
52: cp = "case-label";
53: break;
54: case YEOF:
55: cp = "end-of-file";
56: break;
57: case YILLCH:
58: cp = "illegal character";
59: break;
60: case 256:
61: /* error token */
62: cp = "error";
63: break;
64: case YID:
65: cp = "identifier";
66: break;
67: case YNUMB:
68: cp = "real number";
69: break;
70: case YINT:
71: case YBINT:
72: cp = "number";
73: break;
74: case YSTRING:
75: cp = tp->Yylval;
76: cp = cp == NIL || cp[1] == 0 ? "character" : "string";
77: break;
78: case YDOTDOT:
79: cp = "'..'";
80: break;
81: default:
82: if (tp->Yychar < 256) {
83: cp = "'x'\0'x'";
84: if (bounce = ((bounce + 1) & 1))
85: cp =+ 4;
86: cp[1] = tp->Yychar;
87: break;
88: }
89: for (kp = yykey; kp->kw_str != NIL && kp->kw_val != tp->Yychar; kp++)
90: continue;
91: cp = "keyword ";
92: (&l)->pint2 = kp->kw_str;
93: }
94: (&l)->pint = cp;
95: return (l);
96: }
Defined functions
tokname
defined in line
41; used 15 times
- in line 18,
35
- in /usr/src/ucb/pascal/pxp/yy.h line
136
- in /usr/src/ucb/pascal/pxp/yyrecover.c line
212,
236,
400,
414(2),
430,
441,
537,
546,
614,
623(2)
Defined variables