home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / icon / dos / src / icont / toktab.c < prev    next >
C/C++ Source or Header  |  1992-02-10  |  10KB  |  171 lines

  1. #include "../h/gsupport.h"
  2. #include "tproto.h"
  3. #include "trans.h"
  4. #include "tlex.h"
  5. #include "token.h"
  6.  
  7. /*
  8.  * Token table - contains an entry for each token type
  9.  * with printable name of token, token type, and flags
  10.  * for semicolon insertion.
  11.  */
  12.  
  13. struct toktab toktab[] = {
  14. /*  token        token type    flags */
  15.  
  16.    /* primitives */
  17.    "identifier",      IDENT,         Beginner+Ender,    /*   0 */
  18.    "integer-literal", INTLIT,        Beginner+Ender,    /*   1 */
  19.    "real-literal",    REALLIT,       Beginner+Ender,    /*   2 */
  20.    "string-literal",  STRINGLIT,     Beginner+Ender,    /*   3 */
  21.    "cset-literal",    CSETLIT,       Beginner+Ender,    /*   4 */
  22.    "end-of-file",     EOFX,          0,                 /*   5 */
  23.  
  24.    /* reserved words */
  25.    "break",           BREAK,         Beginner+Ender,    /*   6 */
  26.    "by",              BY,            0,                 /*   7 */
  27.    "case",            CASE,          Beginner,          /*   8 */
  28.    "create",          CREATE,        Beginner,          /*   9 */
  29.    "default",         DEFAULT,       Beginner,          /*  10 */
  30.    "do",              DO,            0,                 /*  11 */
  31.    "else",            ELSE,          0,                 /*  12 */
  32.    "end",             END,           Beginner,          /*  13 */
  33.    "every",           EVERY,         Beginner,          /*  14 */
  34.    "fail",            FAIL,          Beginner+Ender,    /*  15 */
  35.    "global",          GLOBAL,        0,                 /*  16 */
  36.    "if",              IF,            Beginner,          /*  17 */
  37.    "initial",         INITIAL,       Beginner,          /*  18 */
  38.    "invocable",       INVOCABLE,     0,                 /*  19 */
  39.    "link",            LINK,          0,                 /*  20 */
  40.    "local",           LOCAL,         Beginner,          /*  21 */
  41.    "next",            NEXT,          Beginner+Ender,    /*  22 */
  42.    "not",             NOT,           Beginner,          /*  23 */
  43.    "of",              OF,            0,                 /*  24 */
  44.    "procedure",       PROCEDURE,     0,                 /*  25 */
  45.    "record",          RECORD,        0,                 /*  26 */
  46.    "repeat",          REPEAT,        Beginner,          /*  27 */
  47.    "return",          RETURN,        Beginner+Ender,    /*  28 */
  48.    "static",          STATIC,        Beginner,          /*  29 */
  49.    "suspend",         SUSPEND,       Beginner+Ender,    /*  30 */
  50.    "then",            THEN,          0,                 /*  31 */
  51.    "to",              TO,            0,                 /*  32 */
  52.    "until",           UNTIL,         Beginner,          /*  33 */
  53.    "while",           WHILE,         Beginner,          /*  34 */
  54.  
  55.    /* operators */
  56.    ":=",              ASSIGN,        0,                 /*  35 */
  57.    "@",               AT,            Beginner,          /*  36 */
  58.    "@:=",             AUGACT,        0,                 /*  37 */
  59.    "&:=",             AUGAND,        0,                 /*  38 */
  60.    "=:=",             AUGEQ,         0,                 /*  39 */
  61.    "===:=",           AUGEQV,        0,                 /*  40 */
  62.    ">=:=",            AUGGE,         0,                 /*  41 */
  63.    ">:=",             AUGGT,         0,                 /*  42 */
  64.    "<=:=",            AUGLE,         0,                 /*  43 */
  65.    "<:=",             AUGLT,         0,                 /*  44 */
  66.    "~=:=",            AUGNE,         0,                 /*  45 */
  67.    "~===:=",          AUGNEQV,       0,                 /*  46 */
  68.    "==:=",            AUGSEQ,        0,                 /*  47 */
  69.    ">>=:=",           AUGSGE,        0,                 /*  48 */
  70.    ">>:=",            AUGSGT,        0,                 /*  49 */
  71.    "<<=:=",           AUGSLE,        0,                 /*  50 */
  72.    "<<:=",            AUGSLT,        0,                 /*  51 */
  73.    "~==:=",           AUGSNE,        0,                 /*  52 */
  74.    "\\",              BACKSLASH,     Beginner,          /*  53 */
  75.    "!",               BANG,          Beginner,          /*  54 */
  76.    "|",               BAR,           Beginner,          /*  55 */
  77.    "^",               CARET,         Beginner,          /*  56 */
  78.    "^:=",             CARETASGN,     0,                 /*  57 */
  79.    ":",               COLON,         0,                 /*  58 */
  80.    ",",               COMMA,         0,                 /*  59 */
  81.    "||",              CONCAT,        Beginner,          /*  60 */
  82.    "||:=",            CONCATASGN,    0,                 /*  61 */
  83.    "&",               CONJUNC,       Beginner,          /*  62 */
  84.    ".",               DOT,           Beginner,          /*  63 */
  85.    "--",              DIFF,          Beginner,          /*  64 */
  86.    "--:=",            DIFFASGN,      0,                 /*  65 */
  87.    "===",             EQUIV,         Beginner,          /*  66 */
  88.    "**",              INTER,         Beginner,          /*  67 */
  89.    "**:=",            INTERASGN,     0,                 /*  68 */
  90.    "{",               LBRACE,        Beginner,          /*  69 */
  91.    "[",               LBRACK,        Beginner,          /*  70 */
  92.    "|||",             LCONCAT,       Beginner,          /*  71 */
  93.    "|||:=",           LCONCATASGN,   0,                 /*  72 */
  94.    "==",              LEXEQ,         Beginner,          /*  73 */
  95.    ">>=",             LEXGE,         0,                 /*  74 */
  96.    ">>",              LEXGT,         0,                 /*  75 */
  97.    "<<=",             LEXLE,         0,                 /*  76 */
  98.    "<<",              LEXLT,         0,                 /*  77 */
  99.    "~==",             LEXNE,         Beginner,          /*  78 */
  100.    "(",               LPAREN,        Beginner,          /*  79 */
  101.    "-:",              MCOLON,        0,                 /*  80 */
  102.    "-",               MINUS,         Beginner,          /*  81 */
  103.    "-:=",             MINUSASGN,     0,                 /*  82 */
  104.    "%",               MOD,           0,                 /*  83 */
  105.    "%:=",             MODASGN,       0,                 /*  84 */
  106.    "~===",            NOTEQUIV,      Beginner,          /*  85 */
  107.    "=",               NUMEQ,         Beginner,          /*  86 */
  108.    ">=",              NUMGE,         0,                 /*  87 */
  109.    ">",               NUMGT,         0,                 /*  88 */
  110.    "<=",              NUMLE,         0,                 /*  89 */
  111.    "<",               NUMLT,         0,                 /*  90 */
  112.    "~=",              NUMNE,         Beginner,          /*  91 */
  113.    "+:",              PCOLON,        0,                 /*  92 */
  114.    "+",               PLUS,          Beginner,          /*  93 */
  115.    "+:=",             PLUSASGN,      0,                 /*  94 */
  116.    "?",               QMARK,         Beginner,          /*  95 */
  117.    "<-",              REVASSIGN,     0,                 /*  96 */
  118.    "<->",             REVSWAP,       0,                 /*  97 */
  119.    "}",               RBRACE,        Ender,             /*  98 */
  120.    "]",               RBRACK,        Ender,             /*  99 */
  121.    ")",               RPAREN,        Ender,             /* 100 */
  122.    ";",               SEMICOL,       0,                 /* 101 */
  123.    "?:=",             SCANASGN,      0,                 /* 102 */
  124.    "/",               SLASH,         Beginner,          /* 103 */
  125.    "/:=",             SLASHASGN,     0,                 /* 104 */
  126.    "*",               STAR,          Beginner,          /* 105 */
  127.    "*:=",             STARASGN,      0,                 /* 106 */
  128.    ":=:",             SWAP,          0,                 /* 107 */
  129.    "~",               TILDE,         Beginner,          /* 108 */
  130.    "++",              UNION,         Beginner,          /* 109 */
  131.    "++:=",            UNIONASGN,     0,                 /* 110 */
  132.    "$(",              LBRACE,        Beginner,          /* 111 */
  133.    "$)",              RBRACE,        Ender,             /* 112 */
  134.    "$<",              LBRACK,        Beginner,          /* 113 */
  135.    "$>",              RBRACK,        Ender,             /* 114 */
  136.    "end-of-file",     0,             0,
  137.    };
  138.  
  139. /*
  140.  * restab[c] points to the first reserved word in toktab which
  141.  * begins with the letter c.
  142.  */
  143.  
  144. #if !EBCDIC
  145. struct toktab *restab[] = {
  146.    NULL,        &toktab[ 6], &toktab[ 8], &toktab[10], /* abcd */
  147.    &toktab[12], &toktab[15], &toktab[16], NULL,        /* efgh */
  148.    &toktab[17], NULL,        NULL,        &toktab[20], /* ijkl */
  149.    NULL,        &toktab[22], &toktab[24], &toktab[25], /* mnop */
  150.    NULL,        &toktab[26], &toktab[29], &toktab[31], /* qrst */
  151.    &toktab[33], NULL,        &toktab[34], NULL,        /* uvwx */
  152.    NULL,        NULL,                                  /* yz */
  153.    };
  154. #else                    /* !EBCDIC */
  155. struct toktab *restab[] = {
  156.                NULL       ,&toktab[ 6],&toktab[ 8],    /* 81-83  abc */
  157.    &toktab[10],&toktab[12],&toktab[15],&toktab[16],    /* 84-87 defg */
  158.     NULL       ,&toktab[17],NULL       ,NULL      ,    /* 88-8B hi.. */
  159.     NULL       ,NULL      ,NULL       ,NULL       ,    /* 8C-8F .... */
  160.  
  161.    NULL       ,NULL      ,NULL       ,&toktab[19],    /* 90-93 .jkl */
  162.    NULL       ,&toktab[21],&toktab[23],&toktab[24],    /* 94-97 mnop */
  163.    NULL       ,&toktab[25],NULL       ,NULL      ,    /* 98-9B qr.. */
  164.    NULL       ,NULL      ,NULL       ,NULL       ,    /* 9C-9F .... */
  165.  
  166.    NULL       ,NULL      ,&toktab[28],&toktab[30],    /* A0-A3 ..st */
  167.    &toktab[32],NULL      ,&toktab[33],NULL,           /* A4-A7 uvwx */
  168.    NULL       ,NULL      ,                            /* A8-AB yz   */
  169.    };
  170. #endif                                  /* !EBCDIC */
  171.