home *** CD-ROM | disk | FTP | other *** search
- /**
- GRAB Graph Layout and Browser System
-
- Copyright (c) 1989, Tera Computer Company
- **/
-
- /* scanner header file */
-
- #ifndef token_h
- #define token_h
-
- /* our extra-special character friends */
- #define special(c) \
- ((c) == '\n' || \
- (c) == '=' || \
- (c) == '.' || \
- (c) == '(' || \
- (c) == ')' || \
- (c) == ';' || \
- (c) == '\"')
-
- /* characters to ignore */
- #define whitespace(c) \
- ((c) == ' ' || \
- (c) == '\t')
-
- /* indicators that a new token is anon */
- #define endchar(c) \
- (c == EOF || whitespace(c) || !isprint(c) || (c) == '\n')
-
- /* the tokens */
- typedef enum
- {
- /* scanner errors and eof */
- EOF_TOKEN, /* end of file */
- ILLEGAL_CHAR_TOKEN, /* non-white space, unprintable char */
- ILLEGAL_START_TOKEN, /* character that can't begin a string */
- /* tokens with extra info */
- STRING_TOKEN, /* character string */
- QSTRING_TOKEN, /* quoted character string */
- /* special characters */
- NEWLINE_TOKEN, /* newline */
- EQUAL_TOKEN, /* = */
- PERIOD_TOKEN, /* . */
- OPENPAREN_TOKEN, /* ( */
- CLOSEPAREN_TOKEN, /* ) */
- SEMICOLON_TOKEN, /* ; */
- /* predicate evaluation (the usual crowd) */
- AND_TOKEN, /* 'and' */
- OR_TOKEN, /* 'or' */
- NOT_TOKEN, /* 'not' */
- IF_TOKEN, /* 'if' */
- THEN_TOKEN, /* 'then' */
- ELSIF_TOKEN, /* 'elsif' */
- ELSE_TOKEN, /* 'else' */
- ENDIF_TOKEN, /* 'endif' */
- /* commands */
- BREAK_TOKEN, /* 'break' */
- CONTINUE_TOKEN, /* 'continue' */
- SET_TOKEN, /* 'set' */
- COALESCE_TOKEN, /* 'coalesce' */
- EXPAND_TOKEN, /* 'expand' */
- HIDE_TOKEN, /* 'hide' */
- DISPLAY_TOKEN, /* 'display' */
- FOCUS_TOKEN, /* 'focus' */
- /* predefined variables and attributes */
- SOURCE_TOKEN, /* 'source' */
- SINK_TOKEN, /* 'sink' */
- IN_TOKEN, /* 'in' */
- OUT_TOKEN, /* 'out' */
- PARENTS_TOKEN, /* 'parents' */
- CHILDREN_TOKEN, /* 'children' */
- ANCESTORS_TOKEN, /* 'ancestors' */
- DESCENDANTS_TOKEN, /* 'descendants' */
- SHAPE_TOKEN, /* 'shape' */
- BRUSH_TOKEN, /* 'brush' */
- COLOR_TOKEN, /* 'color' */
- /* predefined boolean attributes */
- DISPLAYED_TOKEN, /* 'displayed' */
- NODE_TOKEN, /* 'node' */
- EDGE_TOKEN, /* 'edge' */
- COALESCER_TOKEN /* 'coalescer' */
- } TOKEN;
-
- #define FIRST_RESERVED_TOKEN AND_TOKEN
- /* first reserved word in the token list. Used for
- converting from offsets in reserved_wd to values
- of type TOKEN */
- #define FIRST_NREL_TOKEN IN_TOKEN
- /* similarly, first token used to denote relatives
- of a node */
- #define FIRST_EREL_TOKEN SOURCE_TOKEN
- /* first token used to denote relatives of an edge */
-
- #define NUM_RESERVED 31 /* number of reserved words */
- #define NUM_NREL 6 /* number of tokens used to denote relatives
- of a node */
- #define NUM_EREL 2 /* number of tokens used to denote relatives
- of an edge */
-
- extern char *reserved_wd[NUM_RESERVED];
-
- #define MAXBUFFER 1024
-
- extern char char_val;
- extern char string_val[MAXBUFFER];
-
- #endif
-