home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / linuxdoc-sgml-1.1 / sgmls-1.1 / lexrf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  7.1 KB  |  125 lines

  1. /* LEXRF: Lexical tables for reference concrete syntax.
  2. */
  3.  
  4. #include "config.h"
  5. #include "entity.h"           /* Templates for entity control blocks. */
  6. #include "synxtrn.h"          /* Declarations for concrete syntax constants. */
  7. #include "action.h"           /* Action names for all parsing. */
  8. #include "lexcode.h"
  9.  
  10. static UNCH SRTAB[] = { TABCHAR, '\0' };
  11. static UNCH SRRE[] = { RECHAR, '\0' };
  12. static UNCH SRRS[] = { RSCHAR, '\0' };
  13. static UNCH SRRSB[] = { RSCHAR, 'B', '\0' };
  14. static UNCH SRRSRE[] = { RSCHAR, RECHAR, '\0' };
  15. static UNCH SRRSBRE[] = { RSCHAR, 'B', RECHAR, '\0' };
  16. static UNCH SRBRE[] = { 'B', RECHAR, '\0' };
  17.  
  18. struct lexical lex = {        /* Delimiter set constants for parser use. */
  19.      {                        /* Markup strings for text processor use. */
  20.           (UNCH *)"\4&#",                 /* LEXCON markup string: CRO        */
  21.           (UNCH *)"[",                     /* LEXCON markup string: DSO        */
  22.           (UNCH *)"\3&",                   /* LEXCON markup string: ERO        */
  23.           (UNCH *)"\4</",                  /* LEXMARK markup string: end-tag   */
  24.           (UNCH *)"\3\"",                  /* LEXMARK markup string: LIT       */
  25.           (UNCH *)"\3'",                   /* LEXMARK markup string: LITA      */
  26.           (UNCH *)"\3>",                   /* LEXCON markup string: MDC        */
  27.           (UNCH *)"\4<!",                  /* LEXCON markup string: MDO        */
  28.           (UNCH *)"\5]]>",                 /* LEXCON markup string: mse        */
  29.           (UNCH *)"\5<![",                 /* LEXCON markup string: mss        */
  30.           (UNCH *)"\13<![CDATA[",          /* LEXCON markup string: mss CDATA  */
  31.           (UNCH *)"\14<![RCDATA[",         /* LEXCON markup string: mss RCDATA */
  32.           (UNCH *)"\3>",                   /* LEXCON markup string: PIC        */
  33.           (UNCH *)"\4<?",                  /* LEXCON markup string: PIO        */
  34.           (UNCH *)"\3;",                   /* LEXGRP markup string: ref close. */
  35.           (UNCH *)"\3<",                   /* LEXMARK markup string: start-tag */
  36.           (UNCH *)"\3>",                   /* LEXMARK markup string: TAGC      */
  37.           (UNCH *)"\3=",                   /* LEXMARK markup string: VI        */
  38.           3,                       /* LEXMARK: length of null end-tag. */
  39.           2                        /* LEXMARK: length of null start-tag. */
  40.      },
  41.      {                        /* Short reference delimiters. */
  42.           {                        /* Short reference delimiter table. */
  43.                {(UNCH *)"",       SRCT},        /* Dummy entry to store SR count. */
  44.                {SRTAB,          1},           /* TAB */
  45.                {SRRE,             2},           /* RE */
  46.                {SRRS,             3},           /* RS */
  47.                {SRRSB,            4},           /* Leading blanks */
  48.                {SRRSRE,           5},           /* Null record */
  49.                {SRRSBRE,          6},           /* Blank record */
  50.                {SRBRE,            7},           /* Trailing blanks */
  51.                {(UNCH *)" ",      8},           /* Space */
  52.                {(UNCH *)"BB",     9},           /* Two or more blanks */
  53.                {(UNCH *)"\"",    10},           /* Quotation mark (first data character) */
  54.                {(UNCH *)"#",     11},           /* Number sign */
  55.                {(UNCH *)"%",     12},           /* FCE CHARACTERS start here */
  56.                {(UNCH *)"'",     13},
  57.                {(UNCH *)"(",     14},
  58.                {(UNCH *)")",     15},
  59.                {(UNCH *)"*",     16},
  60.                {(UNCH *)"+",     17},
  61.                {(UNCH *)",",     18},
  62.                {(UNCH *)"-",     19},           /* Hyphen */
  63.                {(UNCH *)"--",    20},           /* Two hyphens */
  64.                {(UNCH *)":",     21},
  65.                {(UNCH *)";",     22},
  66.                {(UNCH *)"=",     23},
  67.                {(UNCH *)"@",     24},
  68.                {(UNCH *)"[",     25},
  69.                {(UNCH *)"]",     26},
  70.                {(UNCH *)"^",     27},
  71.                {(UNCH *)"_",     28},           /* Low line */
  72.                {(UNCH *)"{",     29},
  73.                {(UNCH *)"|",     30},
  74.                {(UNCH *)"}",     31},
  75.                {(UNCH *)"~",     32},
  76.                {0,     0}
  77.           },
  78.           {                        /* Printable form of unprintable SR delims.*/
  79.                "",                      /* Dummy entry to balance s.dtb. */
  80.                "&#TAB;",                /* TAB */
  81.                "&#RE;",                 /* RE */
  82.                "&#RS;",                 /* RS */
  83.                "&#RS;B",                /* Leading blanks */
  84.                "&#RS;&#RE;",            /* Null record */
  85.                "&#RS;B&#RE;",           /* Blank record */
  86.                "B&#RE;",                /* Trailing blanks */
  87.                "&#SPACE;"               /* Space */
  88.           },
  89.           12,                      /* LEXCNM: Index of first FCE in srdeltab. */
  90.           20,                      /*LEXCNM:Index of "two hyphens" in srdeltab*/
  91.           10,                      /* LEXCNM: Index of first SR with data char. */
  92.           19,                      /* LEXCNM: Index of hyphen in srdeltab. */
  93.           SRNPRT+1,                /* LEXCNM: Index of 1st printable SR. */
  94.           8,                       /* LEXCNM: Index of space in srdeltab. */
  95.       25,               /* LEXCNM: Index of left bracket in srdeltab. */
  96.       26,               /* LEXCNM: Index of right bracket in srdeltab. */
  97.      },                       /* End of short reference delimiters. */
  98.      {                        /* General delimiter characters. */
  99.           GENRECHAR,               /*LEXCNM:(BS)Generated RE; can't be markup.*/
  100.           '"',                     /* LEXMARK: Char used as LIT delimiter.*/
  101.           '\'',                    /* LEXMARK: Char used as LITA delimiter.*/
  102.           '>',                     /* LEXLMS: Char used as MDC delimiter.*/
  103.           ']',                     /* LEXLMS: Char used as MSC when enabled.*/
  104.           '/',                     /* LEXCON: Char used as NET when enabled.*/
  105.           '%',                     /* LEXMARK: Char used as PERO delimiter. */
  106.           '>',                     /* LEXCON: Char used as PIC delimiter.*/
  107.           '<'                      /* LEXCON: Char used as TAGO when enabled.*/
  108.      },
  109.      {                        /* Lexical table code assignments. */
  110.           FCE,                    /* LEXCNM: FRE char as entity reference.*/
  111.           FRE,                    /* LEXLMS: Free character not an entity ref.*/
  112.           LITC,                   /* LEXLMS: Literal close delimiter enabled. */
  113.           MSC3,                   /* LEXLMS: Marked section close delim enabled. */
  114.           NET,                    /* LEXCON: Null end-tag delimiter enabled. */
  115.           ETI,                    /* LEXCON: NET disabled; still used as ETI. */
  116.           SPCR,                   /* LEXCNM: Space in use as SHORTREF delim. */
  117.           TGO2,                   /* LEXCON: Tag open delimiter enabled. */
  118.           CDE                     /* LEXLMS: CDATA/SDATA delimiters. */
  119.      }
  120. };
  121.  
  122. UNCH *lextabs[] = {
  123.      lexcnm, lexcon, lexgrp, lexlms, lexmark, lexsd, lextoke, 0
  124. };
  125.