1 /* START OF:        rdc_lex_.incl.pl1                         *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
 2 
 3           /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
 4           /*                                                                                        */
 5           /* N^H__^Ha_^Hm_^He:  rdc_lex_.incl.pl1                                                             */
 6           /*                                                                                        */
 7           /*      This include segment is used by compilers generated by the reduction_compiler.    */
 8           /* It contains the LEX subroutine which is used to manipulate the pointer to the          */
 9           /* "current" token, Pthis_token.                                                          */
10           /*                                                                                        */
11           /* E^H__^Hn_^Ht_^Hr_^Hy:  LEX                                                                       */
12           /*                                                                                        */
13           /*      This entry makes the |_^Hnth|-next (or -preceding) token the "current" token, where         */
14           /* _^Hn is its positive (or negative) input argument.                                     */
15           /*                                                                                        */
16           /* U^H__^Hs_^Ha_^Hg_^He                                                                                       */
17           /*                                                                                        */
18           /*      call LEX(n);                                                                      */
19           /*                                                                                        */
20           /* 1) n   is the number of the token to be made the "current" token, relative to the      */
21           /*        token identified by Pthis_token (the present "current" token).  If n is         */
22           /*        positive, the nth token following the "current" token made "current".  If n     */
23           /*        is negative, the nth token preceding the "current" token is made "current".     */
24           /*                                                                                        */
25           /* S^H__^Ht_^Ha_^Ht_^Hu_^Hs                                                                                   */
26           /*                                                                                        */
27           /* 0) Created by:  G. C. Dixon  in  February, 1975                                        */
28           /*                                                                                        */
29           /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
30 
31 LEX:      procedure (n);
32 
33      dcl  n                             fixed bin,
34           i                             fixed bin;
35 
36           Ptoken = Pthis_token;                             /* do everything relative to "current" token.     */
37           if Ptoken = null then return;                     /* can't lex if token list exhausted.             */
38           if n >= 0 then do;                                /* new "current" token will follow present one.   */
39                do i = 1 to n while (token.Pnext ^= null);   /* find new "current" token, taking care not to   */
40                     Ptoken = token.Pnext;                   /*   run off end of token list.                   */
41                     end;
42                if ^SPDL then if i <= n then Ptoken = null;  /* if not in 'PUSH DOWN LANGUAGE' mode, allow     */
43                                                             /*   running off end of token list.               */
44                end;
45           else                                              /* new "current" token precedes present one.      */
46                do i = -1 to n by -1 while (token.Plast ^= null);
47                     Ptoken = token.Plast;
48                     end;
49           Pthis_token = Ptoken;                             /* simple wasn't it.                              */
50 
51           end LEX;
52 
53 /* END OF:          rdc_lex_.incl.pl1                         *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */