home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume21 / p2c / part13 < prev    next >
Text File  |  1990-04-05  |  40KB  |  1,412 lines

  1. Subject:  v21i058:  Pascal to C translator, Part13/32
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: ff846a8f 2466420e ebd182ba 5ab226d5
  5.  
  6. Submitted-by: Dave Gillespie <daveg@csvax.caltech.edu>
  7. Posting-number: Volume 21, Issue 58
  8. Archive-name: p2c/part13
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 13 (of 32)."
  17. # Contents:  src/lex.c.2
  18. # Wrapped by rsalz@litchi.bbn.com on Mon Mar 26 14:29:36 1990
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f 'src/lex.c.2' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'src/lex.c.2'\"
  22. else
  23. echo shar: Extracting \"'src/lex.c.2'\" \(36991 characters\)
  24. sed "s/^X//" >'src/lex.c.2' <<'END_OF_FILE'
  25. X                        if (cp != closing)
  26. X                            return 0;
  27. X                        strlist_remove((Strlist **)rctable[i].ptr, namebuf);
  28. X                    } else {
  29. X                        if (!isspace(*cp) && *cp != '=')
  30. X                            return 0;
  31. X                        skipspc(cp);
  32. X                        if (*cp == '=') {
  33. X                            cp++;
  34. X                            skipspc(cp);
  35. X                        }
  36. X                        if (chgmode == '=' || isspace(chgmode))
  37. X                            strlist_remove((Strlist **)rctable[i].ptr, namebuf);
  38. X                        sp = strlist_append((Strlist **)rctable[i].ptr, namebuf);
  39. X                        if (tempopt)
  40. X                            strlist_insert(&tempoptionlist, namebuf)->value = i;
  41. X                        cp2 = namebuf;
  42. X                        while (*cp && cp != closing && !isspace(*cp))
  43. X                            *cp2++ = *cp++;
  44. X                        *cp2++ = 0;
  45. X                        skipspc(cp);
  46. X                        if (cp != closing)
  47. X                            return 0;
  48. X                        sp->value = (long)stralloc(namebuf);
  49. X                    }
  50. X                    inbufptr = after;
  51. X                    if (lex_initialized)
  52. X                        handle_nameof();        /* as good a place to do this as any! */
  53. X                    return 1;
  54. X
  55. X                case 3:     /* Synonym parameter */
  56. X            if (isspace(*cp) || *cp == '=' ||
  57. X            *cp == '+' || *cp == '-') {
  58. X            chgmode = *cp++;
  59. X            skipspc(cp);
  60. X            cp2 = namebuf;
  61. X            while (isalnum(*cp) || *cp == '_' ||
  62. X                   *cp == '$' || *cp == '%')
  63. X                *cp2++ = *cp++;
  64. X            *cp2++ = 0;
  65. X            if (!*namebuf)
  66. X                return 0;
  67. X            skipspc(cp);
  68. X            if (!pascalcasesens)
  69. X                upc(namebuf);
  70. X            sym = findsymbol(namebuf);
  71. X            if (chgmode == '-') {
  72. X                if (cp != closing)
  73. X                return 0;
  74. X                sym->flags &= ~SSYNONYM;
  75. X                inbufptr = after;
  76. X                return 1;
  77. X            }
  78. X            if (*cp == '=') {
  79. X                cp++;
  80. X                skipspc(cp);
  81. X            }
  82. X            cp2 = namebuf;
  83. X            while (isalnum(*cp) || *cp == '_' ||
  84. X                   *cp == '$' || *cp == '%')
  85. X                *cp2++ = *cp++;
  86. X            *cp2++ = 0;
  87. X            skipspc(cp);
  88. X            if (cp != closing)
  89. X                return 0;
  90. X            sym->flags |= SSYNONYM;
  91. X            if (!pascalcasesens)
  92. X                upc(namebuf);
  93. X            if (*namebuf)
  94. X                strlist_append(&sym->symbolnames, "===")->value =
  95. X                (long)findsymbol(namebuf);
  96. X            else
  97. X                strlist_append(&sym->symbolnames, "===")->value=0;
  98. X            inbufptr = after;
  99. X            return 1;
  100. X            }
  101. X            return 0;
  102. X
  103. X            }
  104. X            return 0;
  105. X
  106. X    }
  107. X    return 0;
  108. X}
  109. X
  110. X
  111. X
  112. XStatic void comment(starparen)
  113. Xint starparen;    /* 0={ }, 1=(* *), 2=C comments*/
  114. X{
  115. X    register char ch;
  116. X    int nestcount = 1, startlnum = inf_lnum, trailing;
  117. X    int i, cmtindent, cmtindent2;
  118. X    char *cp;
  119. X
  120. X    cp = inbuf;
  121. X    while (isspace(*cp))
  122. X    cp++;
  123. X    trailing = (*cp != '{' && ((*cp != '(' && *cp != '/') || cp[1] != '*'));
  124. X    cmtindent = inbufindent;
  125. X    cmtindent2 = cmtindent + 1 + (starparen != 0);
  126. X    cp = inbufptr;
  127. X    while (isspace(*cp))
  128. X    cmtindent2++, cp++;
  129. X    cp = curtokbuf;
  130. X    for (;;) {
  131. X        ch = *inbufptr++;
  132. X        switch (ch) {
  133. X
  134. X            case '}':
  135. X                if ((!starparen || nestedcomments == 0) &&
  136. X            starparen != 2 &&
  137. X                    --nestcount <= 0) {
  138. X                    *cp = 0;
  139. X            if (!commenting_flag)
  140. X            commentline(trailing ? CMT_TRAIL : CMT_POST);
  141. X                    return;
  142. X                }
  143. X                break;
  144. X
  145. X            case '{':
  146. X                if (nestedcomments == 1 && starparen != 2)
  147. X                    nestcount++;
  148. X                break;
  149. X
  150. X            case '*':
  151. X                if ((*inbufptr == ((starparen == 2) ? '/' : ')') &&
  152. X             (starparen || nestedcomments == 0)) &&
  153. X                    --nestcount <= 0) {
  154. X                    inbufptr++;
  155. X                    *cp = 0;
  156. X            if (!commenting_flag)
  157. X            commentline(trailing ? CMT_TRAIL : CMT_POST);
  158. X                    return;
  159. X                }
  160. X                break;
  161. X
  162. X            case '(':
  163. X                if (*inbufptr == '*' && nestedcomments == 1 &&
  164. X            starparen != 2) {
  165. X            *cp++ = ch;
  166. X            ch = *inbufptr++;
  167. X                    nestcount++;
  168. X        }
  169. X                break;
  170. X
  171. X            case 0:
  172. X                *cp = 0;
  173. X            if (commenting_flag)
  174. X            saveinputcomment(inbufptr-1);
  175. X        else
  176. X            commentline(CMT_POST);
  177. X        trailing = 0;
  178. X                getline();
  179. X        i = 0;
  180. X        for (;;) {
  181. X            if (*inbufptr == ' ') {
  182. X            inbufptr++;
  183. X            i++;
  184. X            } else if (*inbufptr == '\t') {
  185. X            inbufptr++;
  186. X            i++;
  187. X            if (intabsize)
  188. X                i = (i / intabsize + 1) * intabsize;
  189. X            } else
  190. X            break;
  191. X        }
  192. X        cp = curtokbuf;
  193. X        if (*inbufptr) {
  194. X            if (i == cmtindent2 && !starparen)
  195. X            cmtindent--;
  196. X            cmtindent2 = -1;
  197. X            if (i >= cmtindent) {
  198. X            *cp++ = '\002';
  199. X            i -= cmtindent;
  200. X            } else {
  201. X            *cp++ = '\003';
  202. X            }
  203. X            while (--i >= 0)
  204. X            *cp++ = ' ';
  205. X        } else
  206. X            *cp++ = '\003';
  207. X                continue;
  208. X
  209. X            case EOFMARK:
  210. X                error(format_d("Runaway comment from line %d", startlnum));
  211. X                return;     /* unnecessary */
  212. X
  213. X        }
  214. X        *cp++ = ch;
  215. X    }
  216. X}
  217. X
  218. X
  219. X
  220. Xchar *getinlinepart()
  221. X{
  222. X    char *cp, *buf;
  223. X
  224. X    for (;;) {
  225. X        if (isspace(*inbufptr)) {
  226. X            inbufptr++;
  227. X        } else if (!*inbufptr) {
  228. X            getline();
  229. X        } else if (*inbufptr == '{') {
  230. X            inbufptr++;
  231. X            comment(0);
  232. X        } else if (*inbufptr == '(' && inbufptr[1] == '*') {
  233. X            inbufptr += 2;
  234. X            comment(1);
  235. X        } else
  236. X            break;
  237. X    }
  238. X    cp = inbufptr;
  239. X    while (isspace(*cp) || isalnum(*cp) ||
  240. X           *cp == '_' || *cp == '$' || 
  241. X           *cp == '+' || *cp == '-' ||
  242. X           *cp == '<' || *cp == '>')
  243. X        cp++;
  244. X    if (cp == inbufptr)
  245. X        return "";
  246. X    while (isspace(cp[-1]))
  247. X        cp--;
  248. X    buf = format_s("%s", inbufptr);
  249. X    buf[cp-inbufptr] = 0;     /* truncate the string */
  250. X    inbufptr = cp;
  251. X    return buf;
  252. X}
  253. X
  254. X
  255. X
  256. X
  257. XStatic int getflag()
  258. X{
  259. X    int res = 1;
  260. X
  261. X    gettok();
  262. X    if (curtok == TOK_IDENT) {
  263. X        res = (strcmp(curtokbuf, "OFF") != 0);
  264. X        gettok();
  265. X    }
  266. X    return res;
  267. X}
  268. X
  269. X
  270. X
  271. X
  272. Xchar getchartok()
  273. X{
  274. X    if (!*inbufptr) {
  275. X        warning("Unexpected end of line [236]");
  276. X        return ' ';
  277. X    }
  278. X    if (isspace(*inbufptr)) {
  279. X        warning("Whitespace not allowed here [237]");
  280. X        return ' ';
  281. X    }
  282. X    return *inbufptr++;
  283. X}
  284. X
  285. X
  286. X
  287. Xchar *getparenstr(buf)
  288. Xchar *buf;
  289. X{
  290. X    int count = 0;
  291. X    char *cp;
  292. X
  293. X    if (inbufptr < buf)    /* this will get most bad cases */
  294. X        error("Can't handle a line break here");
  295. X    while (isspace(*buf))
  296. X        buf++;
  297. X    cp = buf;
  298. X    for (;;) {
  299. X        if (!*cp)
  300. X            error("Can't handle a line break here");
  301. X        if (*cp == '(')
  302. X            count++;
  303. X        if (*cp == ')')
  304. X            if (--count < 0)
  305. X                break;
  306. X        cp++;
  307. X    }
  308. X    inbufptr = cp + 1;
  309. X    while (cp > buf && isspace(cp[-1]))
  310. X        cp--;
  311. X    return format_ds("%.*s", (int)(cp - buf), buf);
  312. X}
  313. X
  314. X
  315. X
  316. Xvoid leadingcomments()
  317. X{
  318. X    for (;;) {
  319. X        switch (*inbufptr++) {
  320. X
  321. X            case 0:
  322. X                getline();
  323. X                break;
  324. X
  325. X            case ' ':
  326. X            case '\t':
  327. X            case 26:
  328. X                /* ignore whitespace */
  329. X                break;
  330. X
  331. X            case '{':
  332. X                if (!parsecomment(1, 0)) {
  333. X                    inbufptr--;
  334. X                    return;
  335. X                }
  336. X                break;
  337. X
  338. X        case '(':
  339. X        if (*inbufptr == '*') {
  340. X            inbufptr++;
  341. X            if (!parsecomment(1, 1)) {
  342. X            inbufptr -= 2;
  343. X            return;
  344. X            }
  345. X            break;
  346. X        }
  347. X        /* fall through */
  348. X
  349. X            default:
  350. X                inbufptr--;
  351. X                return;
  352. X
  353. X        }
  354. X    }
  355. X}
  356. X
  357. X
  358. X
  359. X
  360. Xvoid get_C_string(term)
  361. Xint term;
  362. X{
  363. X    char *cp = curtokbuf;
  364. X    char ch;
  365. X    int i;
  366. X
  367. X    while ((ch = *inbufptr++)) {
  368. X        if (ch == term) {
  369. X            *cp = 0;
  370. X            curtokint = cp - curtokbuf;
  371. X            return;
  372. X        } else if (ch == '\\') {
  373. X            if (isdigit(*inbufptr)) {
  374. X                i = (*inbufptr++) - '0';
  375. X                if (isdigit(*inbufptr))
  376. X                    i = i*8 + (*inbufptr++) - '0';
  377. X                if (isdigit(*inbufptr))
  378. X                    i = i*8 + (*inbufptr++) - '0';
  379. X                *cp++ = i;
  380. X            } else {
  381. X                ch = *inbufptr++;
  382. X                switch (tolower(ch)) {
  383. X                    case 'n':
  384. X                        *cp++ = '\n';
  385. X                        break;
  386. X                    case 't':
  387. X                        *cp++ = '\t';
  388. X                        break;
  389. X                    case 'v':
  390. X                        *cp++ = '\v';
  391. X                        break;
  392. X                    case 'b':
  393. X                        *cp++ = '\b';
  394. X                        break;
  395. X                    case 'r':
  396. X                        *cp++ = '\r';
  397. X                        break;
  398. X                    case 'f':
  399. X                        *cp++ = '\f';
  400. X                        break;
  401. X                    case '\\':
  402. X                        *cp++ = '\\';
  403. X                        break;
  404. X                    case '\'':
  405. X                        *cp++ = '\'';
  406. X                        break;
  407. X                    case '"':
  408. X                        *cp++ = '"';
  409. X                        break;
  410. X                    case 'x':
  411. X                        if (isxdigit(*inbufptr)) {
  412. X                            if (isdigit(*inbufptr))
  413. X                                i = (*inbufptr++) - '0';
  414. X                            else
  415. X                                i = (toupper(*inbufptr++)) - 'A' + 10;
  416. X                            if (isdigit(*inbufptr))
  417. X                                i = i*16 + (*inbufptr++) - '0';
  418. X                            else if (isxdigit(*inbufptr))
  419. X                                i = i*16 + (toupper(*inbufptr++)) - 'A' + 10;
  420. X                            *cp++ = i;
  421. X                            break;
  422. X                        }
  423. X                        /* fall through */
  424. X                    default:
  425. X                        warning("Strange character in C string [238]");
  426. X                }
  427. X            }
  428. X        } else
  429. X            *cp++ = ch;
  430. X    }
  431. X    *cp = 0;
  432. X    curtokint = cp - curtokbuf;
  433. X    warning("Unterminated C string [239]");
  434. X}
  435. X
  436. X
  437. X
  438. X
  439. X
  440. Xvoid begincommenting(cp)
  441. Xchar *cp;
  442. X{
  443. X    if (!commenting_flag) {
  444. X    commenting_ptr = cp;
  445. X    }
  446. X    commenting_flag++;
  447. X}
  448. X
  449. X
  450. Xvoid saveinputcomment(cp)
  451. Xchar *cp;
  452. X{
  453. X    if (commenting_ptr)
  454. X    sprintf(curtokbuf, "%.*s", (int)(cp - commenting_ptr), commenting_ptr);
  455. X    else
  456. X    sprintf(curtokbuf, "\003%.*s", (int)(cp - inbuf), inbuf);
  457. X    commentline(CMT_POST);
  458. X    commenting_ptr = NULL;
  459. X}
  460. X
  461. X
  462. Xvoid endcommenting(cp)
  463. Xchar *cp;
  464. X{
  465. X    commenting_flag--;
  466. X    if (!commenting_flag) {
  467. X    saveinputcomment(cp);
  468. X    }
  469. X}
  470. X
  471. X
  472. X
  473. X
  474. Xint peeknextchar()
  475. X{
  476. X    char *cp;
  477. X
  478. X    cp = inbufptr;
  479. X    while (isspace(*cp))
  480. X    cp++;
  481. X    return *cp;
  482. X}
  483. X
  484. X
  485. X
  486. X
  487. X#ifdef LEXDEBUG
  488. XStatic void zgettok();
  489. Xvoid gettok()
  490. X{
  491. X    zgettok();
  492. X    if (tokentrace) {
  493. X        printf("gettok() found %s", tok_name(curtok));
  494. X        switch (curtok) {
  495. X            case TOK_HEXLIT:
  496. X            case TOK_OCTLIT:
  497. X            case TOK_INTLIT:
  498. X            case TOK_MININT:
  499. X                printf(", curtokint = %d", curtokint);
  500. X                break;
  501. X            case TOK_REALLIT:
  502. X            case TOK_STRLIT:
  503. X                printf(", curtokbuf = %s", makeCstring(curtokbuf, curtokint));
  504. X                break;
  505. X        default:
  506. X        break;
  507. X        }
  508. X        putchar('\n');
  509. X    }
  510. X}
  511. XStatic void zgettok()
  512. X#else
  513. Xvoid gettok()
  514. X#endif
  515. X{
  516. X    register char ch;
  517. X    register char *cp;
  518. X    char ch2;
  519. X    char *startcp;
  520. X    int i;
  521. X
  522. X    debughook();
  523. X    for (;;) {
  524. X        switch ((ch = *inbufptr++)) {
  525. X
  526. X            case 0:
  527. X            if (commenting_flag)
  528. X            saveinputcomment(inbufptr-1);
  529. X                getline();
  530. X        cp = curtokbuf;
  531. X        for (;;) {
  532. X            inbufindent = 0;
  533. X            for (;;) {
  534. X            if (*inbufptr == '\t') {
  535. X                inbufindent++;
  536. X                if (intabsize)
  537. X                inbufindent = (inbufindent / intabsize + 1) * intabsize;
  538. X            } else if (*inbufptr == ' ')
  539. X                inbufindent++;
  540. X            else if (*inbufptr != 26)
  541. X                break;
  542. X            inbufptr++;
  543. X            }
  544. X            if (!*inbufptr && !commenting_flag) {   /* blank line */
  545. X            *cp++ = '\001';
  546. X            getline();
  547. X            } else
  548. X            break;
  549. X        }
  550. X        if (cp > curtokbuf) {
  551. X            *cp = 0;
  552. X            commentline(CMT_POST);
  553. X        }
  554. X                break;
  555. X
  556. X            case '\t':
  557. X            case ' ':
  558. X            case 26:    /* ignore ^Z's in Turbo files */
  559. X                while (*inbufptr++ == ch) ;
  560. X                inbufptr--;
  561. X                break;
  562. X
  563. X            case '$':
  564. X        if (dollar_idents)
  565. X            goto ident;
  566. X                if (dollar_flag) {
  567. X                    dollar_flag = 0;
  568. X                    curtok = TOK_DOLLAR;
  569. X                    return;
  570. X        }
  571. X        startcp = inbufptr-1;
  572. X        while (isspace(*inbufptr))
  573. X            inbufptr++;
  574. X        cp = inbufptr;
  575. X        while (isxdigit(*cp))
  576. X            cp++;
  577. X        if (cp > inbufptr && cp <= inbufptr+8 && !isalnum(*cp)) {
  578. X            while (isspace(*cp))
  579. X            cp++;
  580. X            if (!isdigit(*cp) && *cp != '\'') {
  581. X            cp = curtokbuf;    /* Turbo hex constant */
  582. X            while (isxdigit(*inbufptr))
  583. X                *cp++ = *inbufptr++;
  584. X            *cp = 0;
  585. X            curtok = TOK_HEXLIT;
  586. X            curtokint = my_strtol(curtokbuf, NULL, 16);
  587. X            return;
  588. X            }
  589. X                }
  590. X        dollar_flag++;     /* HP Pascal compiler directive */
  591. X        do {
  592. X            gettok();
  593. X            if (curtok == TOK_IF) {             /* $IF expr$ */
  594. X            Expr *ex;
  595. X            Value val;
  596. X            if (!skipping_module) {
  597. X                if (!setup_complete)
  598. X                error("$IF$ not allowed at top of program");
  599. X
  600. X                /* Even though HP Pascal doesn't let these nest,
  601. X                   there's no harm in supporting it. */
  602. X                if (if_flag) {
  603. X                skiptotoken(TOK_DOLLAR);
  604. X                if_flag++;
  605. X                break;
  606. X                }
  607. X                gettok();
  608. X                ex = p_expr(tp_boolean);
  609. X                val = eval_expr_consts(ex);
  610. X                freeexpr(ex);
  611. X                i = (val.type == tp_boolean && val.i);
  612. X                free_value(&val);
  613. X                if (!i) {
  614. X                if (curtok != TOK_DOLLAR) {
  615. X                    warning("Syntax error in $IF$ expression [240]");
  616. X                    skiptotoken(TOK_DOLLAR);
  617. X                }
  618. X                begincommenting(startcp);
  619. X                if_flag++;
  620. X                while (if_flag > 0)
  621. X                    gettok();
  622. X                endcommenting(inbufptr);
  623. X                }
  624. X            } else {
  625. X                skiptotoken(TOK_DOLLAR);
  626. X            }
  627. X            } else if (curtok == TOK_END) {     /* $END$ */
  628. X            if (if_flag) {
  629. X                gettok();
  630. X                if (!wexpecttok(TOK_DOLLAR))
  631. X                skiptotoken(TOK_DOLLAR);
  632. X                curtok = TOK_ENDIF;
  633. X                if_flag--;
  634. X                return;
  635. X            } else {
  636. X                gettok();
  637. X                if (!wexpecttok(TOK_DOLLAR))
  638. X                skiptotoken(TOK_DOLLAR);
  639. X            }
  640. X            } else if (curtok == TOK_IDENT) {
  641. X            if (!strcmp(curtokbuf, "INCLUDE") &&
  642. X                 !if_flag && !skipping_module) {
  643. X                char *fn;
  644. X                gettok();
  645. X                if (curtok == TOK_IDENT) {
  646. X                fn = stralloc(curtokcase);
  647. X                gettok();
  648. X                } else if (wexpecttok(TOK_STRLIT)) {
  649. X                fn = stralloc(curtokbuf);
  650. X                gettok();
  651. X                } else
  652. X                fn = "";
  653. X                if (!wexpecttok(TOK_DOLLAR)) {
  654. X                skiptotoken(TOK_DOLLAR);
  655. X                } else {
  656. X                if (handle_include(fn))
  657. X                    return;
  658. X                }
  659. X            } else if (ignore_directives ||
  660. X                   if_flag ||
  661. X                   !strcmp(curtokbuf, "SEARCH") ||
  662. X                   !strcmp(curtokbuf, "REF") ||
  663. X                   !strcmp(curtokbuf, "DEF")) {
  664. X                skiptotoken(TOK_DOLLAR);
  665. X            } else if (!strcmp(curtokbuf, "SWITCH_STRPOS")) {
  666. X                switch_strpos = getflag();
  667. X            } else if (!strcmp(curtokbuf, "SYSPROG")) {
  668. X                if (getflag())
  669. X                sysprog_flag |= 1;
  670. X                else
  671. X                sysprog_flag &= ~1;
  672. X            } else if (!strcmp(curtokbuf, "MODCAL")) {
  673. X                if (getflag())
  674. X                sysprog_flag |= 2;
  675. X                else
  676. X                sysprog_flag &= ~2;
  677. X            } else if (!strcmp(curtokbuf, "PARTIAL_EVAL")) {
  678. X                if (shortcircuit < 0)
  679. X                partial_eval_flag = getflag();
  680. X            } else if (!strcmp(curtokbuf, "IOCHECK")) {
  681. X                iocheck_flag = getflag();
  682. X            } else if (!strcmp(curtokbuf, "RANGE")) {
  683. X                if (getflag()) {
  684. X                if (!range_flag)
  685. X                    note("Range checking is ON [216]");
  686. X                range_flag = 1;
  687. X                } else {
  688. X                if (range_flag)
  689. X                    note("Range checking is OFF [216]");
  690. X                range_flag = 0;
  691. X                }
  692. X            } else if (!strcmp(curtokbuf, "OVFLCHECK")) {
  693. X                if (getflag()) {
  694. X                if (!ovflcheck_flag)
  695. X                    note("Overflow checking is ON [219]");
  696. X                ovflcheck_flag = 1;
  697. X                } else {
  698. X                if (ovflcheck_flag)
  699. X                    note("Overflow checking is OFF [219]");
  700. X                ovflcheck_flag = 0;
  701. X                }
  702. X            } else if (!strcmp(curtokbuf, "STACKCHECK")) {
  703. X                if (getflag()) {
  704. X                if (!stackcheck_flag)
  705. X                    note("Stack checking is ON [217]");
  706. X                stackcheck_flag = 1;
  707. X                } else {
  708. X                if (stackcheck_flag)
  709. X                    note("Stack checking is OFF [217]");
  710. X                stackcheck_flag = 0;
  711. X                }
  712. X            }
  713. X            skiptotoken2(TOK_DOLLAR, TOK_COMMA);
  714. X            } else {
  715. X            warning("Mismatched '$' signs [241]");
  716. X            dollar_flag = 0;    /* got out of sync */
  717. X            return;
  718. X            }
  719. X        } while (curtok == TOK_COMMA);
  720. X                break;
  721. X
  722. X            case '"':
  723. X        if (C_lex) {
  724. X            get_C_string(ch);
  725. X            curtok = TOK_STRLIT;
  726. X            return;
  727. X        }
  728. X        goto stringLiteral;
  729. X
  730. X            case '#':
  731. X        if (modula2) {
  732. X            curtok = TOK_NE;
  733. X            return;
  734. X        }
  735. X        cp = inbufptr;
  736. X        while (isspace(*cp)) cp++;
  737. X        if (!strcincmp(cp, "INCLUDE", 7)) {
  738. X            char *cp2, *cp3;
  739. X            cp += 7;
  740. X            while (isspace(*cp)) cp++;
  741. X            cp2 = cp + strlen(cp) - 1;
  742. X            while (isspace(*cp2)) cp2--;
  743. X            if ((*cp == '"' && *cp2 == '"' && cp2 > cp) ||
  744. X            (*cp == '<' && *cp2 == '>')) {
  745. X            inbufptr = cp2 + 1;
  746. X            cp3 = stralloc(cp + 1);
  747. X            cp3[cp2 - cp - 1] = 0;
  748. X            if (handle_include(cp3))
  749. X                return;
  750. X            else
  751. X                break;
  752. X            }
  753. X        }
  754. X        /* fall through */
  755. X
  756. X            case '\'':
  757. X                if (C_lex && ch == '\'') {
  758. X                    get_C_string(ch);
  759. X                    if (curtokint != 1)
  760. X                        warning("Character constant has length != 1 [242]");
  761. X                    curtokint = *curtokbuf;
  762. X                    curtok = TOK_CHARLIT;
  763. X                    return;
  764. X                }
  765. X          stringLiteral:
  766. X                cp = curtokbuf;
  767. X        ch2 = (ch == '"') ? '"' : '\'';
  768. X                do {
  769. X                    if (ch == ch2) {
  770. X                        while ((ch = *inbufptr++) != '\n' &&
  771. X                               ch != EOF) {
  772. X                            if (ch == ch2) {
  773. X                                if (*inbufptr != ch2 || modula2)
  774. X                                    break;
  775. X                                else
  776. X                                    inbufptr++;
  777. X                            }
  778. X                            *cp++ = ch;
  779. X                        }
  780. X                        if (ch != ch2)
  781. X                            warning("Error in string literal [243]");
  782. X                    } else {
  783. X                        ch = *inbufptr++;
  784. X                        if (isdigit(ch)) {
  785. X                            i = 0;
  786. X                            while (isdigit(ch)) {
  787. X                                i = i*10 + ch - '0';
  788. X                                ch = *inbufptr++;
  789. X                            }
  790. X                            inbufptr--;
  791. X                            *cp++ = i;
  792. X                        } else {
  793. X                            *cp++ = ch & 0x1f;
  794. X                        }
  795. X                    }
  796. X                    while (*inbufptr == ' ' || *inbufptr == '\t')
  797. X                        inbufptr++;
  798. X                } while ((ch = *inbufptr++) == ch2 || ch == '#');
  799. X                inbufptr--;
  800. X                *cp = 0;
  801. X                curtokint = cp - curtokbuf;
  802. X                curtok = TOK_STRLIT;
  803. X                return;
  804. X
  805. X            case '(':
  806. X                if (*inbufptr == '*' && !C_lex) {
  807. X                    inbufptr++;
  808. X            switch (commenting_flag ? 0 : parsecomment(0, 1)) {
  809. X                case 0:
  810. X                            comment(1);
  811. X                break;
  812. X                case 2:
  813. X                return;
  814. X            }
  815. X                    break;
  816. X                } else if (*inbufptr == '.') {
  817. X                    curtok = TOK_LBR;
  818. X                    inbufptr++;
  819. X                } else {
  820. X                    curtok = TOK_LPAR;
  821. X                }
  822. X                return;
  823. X
  824. X            case '{':
  825. X                if (C_lex || modula2) {
  826. X                    curtok = TOK_LBRACE;
  827. X                    return;
  828. X                }
  829. X                switch (commenting_flag ? 0 : parsecomment(0, 0)) {
  830. X                    case 0:
  831. X                        comment(0);
  832. X                        break;
  833. X                    case 2:
  834. X                        return;
  835. X                }
  836. X                break;
  837. X
  838. X            case '}':
  839. X                if (C_lex || modula2) {
  840. X                    curtok = TOK_RBRACE;
  841. X                    return;
  842. X                }
  843. X        if (skipflag > 0) {
  844. X            skipflag = 0;
  845. X        } else
  846. X            warning("Unmatched '}' in input file [244]");
  847. X                break;
  848. X
  849. X            case ')':
  850. X                curtok = TOK_RPAR;
  851. X                return;
  852. X
  853. X            case '*':
  854. X        if (*inbufptr == (C_lex ? '/' : ')')) {
  855. X            inbufptr++;
  856. X            if (skipflag > 0) {
  857. X            skipflag = 0;
  858. X            } else
  859. X            warning("Unmatched '*)' in input file [245]");
  860. X            break;
  861. X        } else if (*inbufptr == '*' && !C_lex) {
  862. X            curtok = TOK_STARSTAR;
  863. X            inbufptr++;
  864. X        } else
  865. X            curtok = TOK_STAR;
  866. X                return;
  867. X
  868. X            case '+':
  869. X                if (C_lex && *inbufptr == '+') {
  870. X                    curtok = TOK_PLPL;
  871. X                    inbufptr++;
  872. X                } else
  873. X                    curtok = TOK_PLUS;
  874. X                return;
  875. X
  876. X            case ',':
  877. X                curtok = TOK_COMMA;
  878. X                return;
  879. X
  880. X            case '-':
  881. X                if (C_lex && *inbufptr == '-') {
  882. X                    curtok = TOK_MIMI;
  883. X                    inbufptr++;
  884. X                } else if (*inbufptr == '>') {
  885. X                    curtok = TOK_ARROW;
  886. X                    inbufptr++;
  887. X                } else
  888. X                    curtok = TOK_MINUS;
  889. X                return;
  890. X
  891. X            case '.':
  892. X                if (*inbufptr == '.') {
  893. X                    curtok = TOK_DOTS;
  894. X                    inbufptr++;
  895. X                } else if (*inbufptr == ')') {
  896. X                    curtok = TOK_RBR;
  897. X                    inbufptr++;
  898. X                } else
  899. X                    curtok = TOK_DOT;
  900. X                return;
  901. X
  902. X            case '/':
  903. X        if (C_lex && *inbufptr == '*') {
  904. X            inbufptr++;
  905. X            comment(2);
  906. X            break;
  907. X        }
  908. X                curtok = TOK_SLASH;
  909. X                return;
  910. X
  911. X            case ':':
  912. X                if (*inbufptr == '=') {
  913. X                    curtok = TOK_ASSIGN;
  914. X                    inbufptr++;
  915. X        } else if (*inbufptr == ':') {
  916. X                    curtok = TOK_COLONCOLON;
  917. X                    inbufptr++;
  918. X                } else
  919. X                    curtok = TOK_COLON;
  920. X                return;
  921. X
  922. X            case ';':
  923. X                curtok = TOK_SEMI;
  924. X                return;
  925. X
  926. X            case '<':
  927. X                if (*inbufptr == '=') {
  928. X                    curtok = TOK_LE;
  929. X                    inbufptr++;
  930. X                } else if (*inbufptr == '>') {
  931. X                    curtok = TOK_NE;
  932. X                    inbufptr++;
  933. X                } else if (*inbufptr == '<') {
  934. X                    curtok = TOK_LTLT;
  935. X                    inbufptr++;
  936. X                } else
  937. X                    curtok = TOK_LT;
  938. X                return;
  939. X
  940. X            case '>':
  941. X                if (*inbufptr == '=') {
  942. X                    curtok = TOK_GE;
  943. X                    inbufptr++;
  944. X                } else if (*inbufptr == '>') {
  945. X                    curtok = TOK_GTGT;
  946. X                    inbufptr++;
  947. X                } else
  948. X                    curtok = TOK_GT;
  949. X                return;
  950. X
  951. X            case '=':
  952. X        if (*inbufptr == '=') {
  953. X            curtok = TOK_EQEQ;
  954. X            inbufptr++;
  955. X        } else
  956. X            curtok = TOK_EQ;
  957. X                return;
  958. X
  959. X            case '[':
  960. X                curtok = TOK_LBR;
  961. X                return;
  962. X
  963. X            case ']':
  964. X                curtok = TOK_RBR;
  965. X                return;
  966. X
  967. X            case '^':
  968. X                curtok = TOK_HAT;
  969. X                return;
  970. X
  971. X            case '&':
  972. X                if (*inbufptr == '&') {
  973. X                    curtok = TOK_ANDAND;
  974. X                    inbufptr++;
  975. X                } else
  976. X                    curtok = TOK_AMP;
  977. X                return;
  978. X
  979. X            case '|':
  980. X                if (*inbufptr == '|') {
  981. X                    curtok = TOK_OROR;
  982. X                    inbufptr++;
  983. X                } else
  984. X                    curtok = TOK_VBAR;
  985. X                return;
  986. X
  987. X            case '~':
  988. X                curtok = TOK_TWIDDLE;
  989. X                return;
  990. X
  991. X            case '!':
  992. X                if (*inbufptr == '=') {
  993. X                    curtok = TOK_BANGEQ;
  994. X                    inbufptr++;
  995. X                } else
  996. X                    curtok = TOK_BANG;
  997. X                return;
  998. X
  999. X            case '%':
  1000. X        if (C_lex) {
  1001. X            curtok = TOK_PERC;
  1002. X            return;
  1003. X        }
  1004. X        goto ident;
  1005. X
  1006. X            case '?':
  1007. X                curtok = TOK_QM;
  1008. X                return;
  1009. X
  1010. X            case '@':
  1011. X        curtok = TOK_ADDR;
  1012. X                return;
  1013. X
  1014. X            case EOFMARK:
  1015. X                if (curtok == TOK_EOF) {
  1016. X                    if (inputkind == INP_STRLIST)
  1017. X                        error("Unexpected end of macro");
  1018. X                    else
  1019. X                        error("Unexpected end of file");
  1020. X                }
  1021. X                curtok = TOK_EOF;
  1022. X                return;
  1023. X
  1024. X            default:
  1025. X                if (isdigit(ch)) {
  1026. X            cp = inbufptr;
  1027. X            while (isxdigit(*cp))
  1028. X            cp++;
  1029. X            if (*cp == '#' && isxdigit(cp[1])) {
  1030. X            i = atoi(inbufptr-1);
  1031. X            inbufptr = cp+1;
  1032. X            } else if (toupper(cp[-1]) == 'B' ||
  1033. X                   toupper(cp[-1]) == 'C') {
  1034. X                        inbufptr--;
  1035. X            i = 8;
  1036. X            } else if (toupper(*cp) == 'H') {
  1037. X                        inbufptr--;
  1038. X            i = 16;
  1039. X            } else if ((ch == '0' && toupper(*inbufptr) == 'X' &&
  1040. X                isxdigit(inbufptr[1]))) {
  1041. X            inbufptr++;
  1042. X            i = 16;
  1043. X            } else {
  1044. X            i = 10;
  1045. X            }
  1046. X            if (i != 10) {
  1047. X                        curtokint = 0;
  1048. X                        while (isdigit(*inbufptr) ||
  1049. X                   (i > 10 && isxdigit(*inbufptr))) {
  1050. X                            ch = toupper(*inbufptr++);
  1051. X                            curtokint *= i;
  1052. X                            if (ch <= '9')
  1053. X                                curtokint += ch - '0';
  1054. X                            else
  1055. X                                curtokint += ch - 'A' + 10;
  1056. X                        }
  1057. X                        sprintf(curtokbuf, "%ld", curtokint);
  1058. X            if ((toupper(*inbufptr) == 'B' && i == 8) ||
  1059. X                (toupper(*inbufptr) == 'H' && i == 16))
  1060. X                inbufptr++;
  1061. X            if (toupper(*inbufptr) == 'C' && i == 8) {
  1062. X                inbufptr++;
  1063. X                curtok = TOK_STRLIT;
  1064. X                curtokbuf[0] = curtokint;
  1065. X                curtokbuf[1] = 0;
  1066. X                curtokint = 1;
  1067. X                return;
  1068. X            }
  1069. X                        if (toupper(*inbufptr) == 'L') {
  1070. X                            strcat(curtokbuf, "L");
  1071. X                            inbufptr++;
  1072. X                        }
  1073. X                        curtok = (i == 8) ? TOK_OCTLIT : TOK_HEXLIT;
  1074. X                        return;
  1075. X                    }
  1076. X                    cp = curtokbuf;
  1077. X                    i = 0;
  1078. X                    while (ch == '0')
  1079. X                        ch = *inbufptr++;
  1080. X                    if (isdigit(ch)) {
  1081. X                        while (isdigit(ch)) {
  1082. X                            *cp++ = ch;
  1083. X                            ch = *inbufptr++;
  1084. X                        }
  1085. X                    } else
  1086. X                        *cp++ = '0';
  1087. X                    if (ch == '.') {
  1088. X                        if (isdigit(*inbufptr)) {
  1089. X                            *cp++ = ch;
  1090. X                            ch = *inbufptr++;
  1091. X                            i = 1;
  1092. X                            while (isdigit(ch)) {
  1093. X                                *cp++ = ch;
  1094. X                                ch = *inbufptr++;
  1095. X                            }
  1096. X                        }
  1097. X                    }
  1098. X                    if (ch == 'e' || ch == 'E' ||
  1099. X            ch == 'd' || ch == 'D' ||
  1100. X            ch == 'q' || ch == 'Q') {
  1101. X                        ch = *inbufptr;
  1102. X                        if (isdigit(ch) || ch == '+' || ch == '-') {
  1103. X                            *cp++ = 'e';
  1104. X                            inbufptr++;
  1105. X                            i = 1;
  1106. X                            do {
  1107. X                                *cp++ = ch;
  1108. X                                ch = *inbufptr++;
  1109. X                            } while (isdigit(ch));
  1110. X                        }
  1111. X                    }
  1112. X                    inbufptr--;
  1113. X                    *cp = 0;
  1114. X                    if (i) {
  1115. X                        curtok = TOK_REALLIT;
  1116. X                        curtokint = cp - curtokbuf;
  1117. X                    } else {
  1118. X                        if (cp >= curtokbuf+10) {
  1119. X                            i = strcmp(curtokbuf, "2147483648");
  1120. X                            if (cp > curtokbuf+10 || i > 0) {
  1121. X                curtok = TOK_REALLIT;
  1122. X                curtokint = cp - curtokbuf + 2;
  1123. X                strcat(curtokbuf, ".0");
  1124. X                return;
  1125. X                }
  1126. X                            if (i == 0) {
  1127. X                                curtok = TOK_MININT;
  1128. X                                curtokint = -2147483648;
  1129. X                                return;
  1130. X                            }
  1131. X                        }
  1132. X                        curtok = TOK_INTLIT;
  1133. X                        curtokint = atol(curtokbuf);
  1134. X                        if (toupper(*inbufptr) == 'L') {
  1135. X                            strcat(curtokbuf, "L");
  1136. X                            inbufptr++;
  1137. X                        }
  1138. X                    }
  1139. X                    return;
  1140. X                } else if (isalpha(ch) || ch == '_') {
  1141. Xident:
  1142. X                    {
  1143. X                        register char *cp2;
  1144. X                        curtoksym = NULL;
  1145. X                        cp = curtokbuf;
  1146. X                        cp2 = curtokcase;
  1147. X            *cp2++ = symcase ? ch : tolower(ch);
  1148. X            *cp++ = pascalcasesens ? ch : toupper(ch);
  1149. X            while (isalnum((ch = *inbufptr++)) ||
  1150. X                   ch == '_' ||
  1151. X                   (ch == '%' && !C_lex) ||
  1152. X                   (ch == '$' && dollar_idents)) {
  1153. X                *cp2++ = symcase ? ch : tolower(ch);
  1154. X                if (!ignorenonalpha || isalnum(ch))
  1155. X                *cp++ = pascalcasesens ? ch : toupper(ch);
  1156. X            }
  1157. X                        inbufptr--;
  1158. X                        *cp2 = 0;
  1159. X                        *cp = 0;
  1160. X            if (pascalsignif > 0)
  1161. X                curtokbuf[pascalsignif] = 0;
  1162. X                    }
  1163. X            if (*curtokbuf == '%') {
  1164. X            if (!strcicmp(curtokbuf, "%INCLUDE")) {
  1165. X                char *cp2 = inbufptr;
  1166. X                while (isspace(*cp2)) cp2++;
  1167. X                if (*cp2 == '\'')
  1168. X                cp2++;
  1169. X                cp = curtokbuf;
  1170. X                while (*cp2 && *cp2 != '\'' &&
  1171. X                   *cp2 != ';' && !isspace(*cp2)) {
  1172. X                *cp++ = *cp2++;
  1173. X                }
  1174. X                *cp = 0;
  1175. X                cp = my_strrchr(curtokbuf, '/');
  1176. X                if (cp && (!strcicmp(cp, "/LIST") ||
  1177. X                       !strcicmp(cp, "/NOLIST")))
  1178. X                *cp = 0;
  1179. X                if (*cp2 == '\'')
  1180. X                cp2++;
  1181. X                while (isspace(*cp2)) cp2++;
  1182. X                if (*cp2 == ';')
  1183. X                cp2++;
  1184. X                while (isspace(*cp2)) cp2++;
  1185. X                if (!*cp2) {
  1186. X                inbufptr = cp2;
  1187. X                (void) handle_include(stralloc(curtokbuf));
  1188. X                return;
  1189. X                }
  1190. X            } else if (!strcicmp(curtokbuf, "%TITLE") ||
  1191. X                   !strcicmp(curtokbuf, "%SUBTITLE")) {
  1192. X                gettok();   /* string literal */
  1193. X                break;
  1194. X            } else if (!strcicmp(curtokbuf, "%PAGE")) {
  1195. X                /* should store a special page-break comment? */
  1196. X                break;   /* ignore token */
  1197. X            } else if ((i = 2, !strcicmp(curtokbuf, "%B")) ||
  1198. X                   (i = 8, !strcicmp(curtokbuf, "%O")) ||
  1199. X                   (i = 16, !strcicmp(curtokbuf, "%X"))) {
  1200. X                while (isspace(*inbufptr)) inbufptr++;
  1201. X                if (*inbufptr == '\'') {
  1202. X                inbufptr++;
  1203. X                curtokint = 0;
  1204. X                while (*inbufptr && *inbufptr != '\'') {
  1205. X                    ch = toupper(*inbufptr++);
  1206. X                    if (isxdigit(ch)) {
  1207. X                    curtokint *= i;
  1208. X                    if (ch <= '9')
  1209. X                        curtokint += ch - '0';
  1210. X                    else
  1211. X                        curtokint += ch - 'A' + 10;
  1212. X                    } else if (!isspace(ch))
  1213. X                    warning("Bad digit in literal [246]");
  1214. X                }
  1215. X                if (*inbufptr)
  1216. X                    inbufptr++;
  1217. X                sprintf(curtokbuf, "%ld", curtokint);
  1218. X                curtok = (i == 8) ? TOK_OCTLIT : TOK_HEXLIT;
  1219. X                return;
  1220. X                }
  1221. X                        }
  1222. X            }
  1223. X                    {
  1224. X                        register unsigned int hash;
  1225. X                        register Symbol *sp;
  1226. X
  1227. X                        hash = 0;
  1228. X                        for (cp = curtokbuf; *cp; cp++)
  1229. X                            hash = hash*3 + *cp;
  1230. X                        sp = symtab[hash % SYMHASHSIZE];
  1231. X                        while (sp && (i = strcmp(sp->name, curtokbuf)) != 0) {
  1232. X                            if (i < 0)
  1233. X                                sp = sp->left;
  1234. X                            else
  1235. X                                sp = sp->right;
  1236. X                        }
  1237. X                        if (!sp)
  1238. X                            sp = findsymbol(curtokbuf);
  1239. X            if (sp->flags & SSYNONYM) {
  1240. X                i = 100;
  1241. X                while (--i > 0 && sp && (sp->flags & SSYNONYM)) {
  1242. X                Strlist *sl;
  1243. X                sl = strlist_find(sp->symbolnames, "===");
  1244. X                if (sl)
  1245. X                    sp = (Symbol *)sl->value;
  1246. X                else
  1247. X                    sp = NULL;
  1248. X                }
  1249. X                if (!sp)
  1250. X                break;    /* ignore token */
  1251. X            }
  1252. X            if (sp->kwtok && !(sp->flags & KWPOSS) &&
  1253. X                (pascalcasesens != 2 || !islower(*curtokbuf)) &&
  1254. X                (pascalcasesens != 3 || !isupper(*curtokbuf))) {
  1255. X                curtok = sp->kwtok;
  1256. X                return;
  1257. X            }
  1258. X            curtok = TOK_IDENT;
  1259. X                        curtoksym = sp;
  1260. X                        if ((i = withlevel) != 0 && sp->fbase) {
  1261. X                            while (--i >= 0) {
  1262. X                                curtokmeaning = sp->fbase;
  1263. X                                while (curtokmeaning) {
  1264. X                                    if (curtokmeaning->rectype == withlist[i]) {
  1265. X                                        curtokint = i;
  1266. X                                        return;
  1267. X                                    }
  1268. X                                    curtokmeaning = curtokmeaning->snext;
  1269. X                                }
  1270. X                            }
  1271. X                        }
  1272. X                        curtokmeaning = sp->mbase;
  1273. X                        while (curtokmeaning && !curtokmeaning->isactive)
  1274. X                            curtokmeaning = curtokmeaning->snext;
  1275. X            if (!curtokmeaning)
  1276. X                return;
  1277. X            while (curtokmeaning->kind == MK_SYNONYM)
  1278. X                curtokmeaning = curtokmeaning->xnext;
  1279. X            /* look for unit.ident notation */
  1280. X                        if (curtokmeaning->kind == MK_MODULE ||
  1281. X                curtokmeaning->kind == MK_FUNCTION) {
  1282. X                            for (cp = inbufptr; isspace(*cp); cp++) ;
  1283. X                            if (*cp == '.') {
  1284. X                                for (cp++; isspace(*cp); cp++) ;
  1285. X                                if (isalpha(*cp)) {
  1286. X                                    Meaning *mp = curtokmeaning;
  1287. X                                    Symbol *sym = curtoksym;
  1288. X                                    char *saveinbufptr = inbufptr;
  1289. X                                    gettok();
  1290. X                                    if (curtok == TOK_DOT)
  1291. X                    gettok();
  1292. X                    else
  1293. X                    curtok = TOK_END;
  1294. X                                    if (curtok == TOK_IDENT) {
  1295. X                    curtokmeaning = curtoksym->mbase;
  1296. X                    while (curtokmeaning &&
  1297. X                           curtokmeaning->ctx != mp)
  1298. X                        curtokmeaning = curtokmeaning->snext;
  1299. X                    if (!curtokmeaning &&
  1300. X                        !strcmp(sym->name, "SYSTEM")) {
  1301. X                        curtokmeaning = curtoksym->mbase;
  1302. X                        while (curtokmeaning &&
  1303. X                           curtokmeaning->ctx != nullctx)
  1304. X                        curtokmeaning = curtokmeaning->snext;
  1305. X                    }
  1306. X                    } else
  1307. X                    curtokmeaning = NULL;
  1308. X                                    if (!curtokmeaning) {
  1309. X                                        /* oops, was probably funcname.field */
  1310. X                                        inbufptr = saveinbufptr;
  1311. X                                        curtokmeaning = mp;
  1312. X                                        curtoksym = sym;
  1313. X                                    }
  1314. X                                }
  1315. X                            }
  1316. X                        }
  1317. X                        return;
  1318. X                    }
  1319. X                } else {
  1320. X                    warning("Unrecognized character in file [247]");
  1321. X                }
  1322. X        }
  1323. X    }
  1324. X}
  1325. X
  1326. X
  1327. X
  1328. Xvoid checkkeyword(tok)
  1329. XToken tok;
  1330. X{
  1331. X    if (curtok == TOK_IDENT &&
  1332. X    curtoksym->kwtok == tok) {
  1333. X    curtoksym->flags &= ~KWPOSS;
  1334. X    curtok = tok;
  1335. X    }
  1336. X}
  1337. X
  1338. X
  1339. Xvoid checkmodulewords()
  1340. X{
  1341. X    if (modula2) {
  1342. X    checkkeyword(TOK_FROM);
  1343. X    checkkeyword(TOK_DEFINITION);
  1344. X    checkkeyword(TOK_IMPLEMENT);
  1345. X    checkkeyword(TOK_MODULE);
  1346. X    checkkeyword(TOK_IMPORT);
  1347. X    checkkeyword(TOK_EXPORT);
  1348. X    } else if (curtok == TOK_IDENT &&
  1349. X           (curtoksym->kwtok == TOK_MODULE ||
  1350. X        curtoksym->kwtok == TOK_IMPORT ||
  1351. X        curtoksym->kwtok == TOK_EXPORT ||
  1352. X        curtoksym->kwtok == TOK_IMPLEMENT)) {
  1353. X    if (!strcmp(curtokbuf, "UNIT") ||
  1354. X        !strcmp(curtokbuf, "USES") ||
  1355. X        !strcmp(curtokbuf, "INTERFACE") ||
  1356. X        !strcmp(curtokbuf, "IMPLEMENTATION")) {
  1357. X        modulenotation = 0;
  1358. X        findsymbol("UNIT")->flags &= ~KWPOSS;
  1359. X        findsymbol("USES")->flags &= ~KWPOSS;
  1360. X        findsymbol("INTERFACE")->flags &= ~KWPOSS;
  1361. X        findsymbol("IMPLEMENTATION")->flags &= ~KWPOSS;
  1362. X    } else {
  1363. X        modulenotation = 1;
  1364. X        findsymbol("MODULE")->flags &= ~KWPOSS;
  1365. X        findsymbol("EXPORT")->flags &= ~KWPOSS;
  1366. X        findsymbol("IMPORT")->flags &= ~KWPOSS;
  1367. X        findsymbol("IMPLEMENT")->flags &= ~KWPOSS;
  1368. X    }
  1369. X    curtok = curtoksym->kwtok;
  1370. X    }
  1371. X}
  1372. X
  1373. X
  1374. X
  1375. X
  1376. X
  1377. X
  1378. X
  1379. X
  1380. X
  1381. X
  1382. X
  1383. X
  1384. X/* End. */
  1385. X
  1386. X
  1387. X
  1388. END_OF_FILE
  1389. if test 36991 -ne `wc -c <'src/lex.c.2'`; then
  1390.     echo shar: \"'src/lex.c.2'\" unpacked with wrong size!
  1391. fi
  1392. # end of 'src/lex.c.2'
  1393. fi
  1394. echo shar: End of archive 13 \(of 32\).
  1395. cp /dev/null ark13isdone
  1396. MISSING=""
  1397. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ; do
  1398.     if test ! -f ark${I}isdone ; then
  1399.     MISSING="${MISSING} ${I}"
  1400.     fi
  1401. done
  1402. if test "${MISSING}" = "" ; then
  1403.     echo You have unpacked all 32 archives.
  1404.     echo "Now see PACKNOTES and the README"
  1405.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1406. else
  1407.     echo You still need to unpack the following archives:
  1408.     echo "        " ${MISSING}
  1409. fi
  1410. ##  End of shell archive.
  1411. exit 0
  1412.