Back to index

glibc  2.9
Classes | Typedefs | Enumerations | Functions
rpc_scan.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  token

Typedefs

typedef struct token

Enumerations

enum  tok_kind {
  TOK_IDENT, TOK_CHARCONST, TOK_STRCONST, TOK_LPAREN,
  TOK_RPAREN, TOK_LBRACE, TOK_RBRACE, TOK_LBRACKET,
  TOK_RBRACKET, TOK_LANGLE, TOK_RANGLE, TOK_STAR,
  TOK_COMMA, TOK_EQUAL, TOK_COLON, TOK_SEMICOLON,
  TOK_CONST, TOK_STRUCT, TOK_UNION, TOK_SWITCH,
  TOK_CASE, TOK_DEFAULT, TOK_ENUM, TOK_TYPEDEF,
  TOK_INT, TOK_SHORT, TOK_LONG, TOK_HYPER,
  TOK_UNSIGNED, TOK_FLOAT, TOK_DOUBLE, TOK_OPAQUE,
  TOK_CHAR, TOK_STRING, TOK_BOOL, TOK_VOID,
  TOK_PROGRAM, TOK_VERSION, TOK_EOF
}

Functions

void scan (tok_kind expect, token *tokp)
void scan2 (tok_kind expect1, tok_kind expect2, token *tokp)
void scan3 (tok_kind expect1, tok_kind expect2, tok_kind expect3, token *tokp)
void scan_num (token *tokp)
void peek (token *tokp)
int peekscan (tok_kind expect, token *tokp)
void get_token (token *tokp)
void expected1 (tok_kind exp1) __attribute__((noreturn))
void expected2 (tok_kind exp1, tok_kind exp2) __attribute__((noreturn))
void expected3 (tok_kind exp1, tok_kind exp2, tok_kind exp3) __attribute__((noreturn))

Class Documentation

struct token

Definition at line 37 of file linereader.h.

Class Members
tok_kind kind
const char * str
enum token_t union token val

Typedef Documentation

typedef struct token

Definition at line 90 of file rpc_scan.h.


Enumeration Type Documentation

enum tok_kind
Enumerator:
TOK_IDENT 
TOK_CHARCONST 
TOK_STRCONST 
TOK_LPAREN 
TOK_RPAREN 
TOK_LBRACE 
TOK_RBRACE 
TOK_LBRACKET 
TOK_RBRACKET 
TOK_LANGLE 
TOK_RANGLE 
TOK_STAR 
TOK_COMMA 
TOK_EQUAL 
TOK_COLON 
TOK_SEMICOLON 
TOK_CONST 
TOK_STRUCT 
TOK_UNION 
TOK_SWITCH 
TOK_CASE 
TOK_DEFAULT 
TOK_ENUM 
TOK_TYPEDEF 
TOK_INT 
TOK_SHORT 
TOK_LONG 
TOK_HYPER 
TOK_UNSIGNED 
TOK_FLOAT 
TOK_DOUBLE 
TOK_OPAQUE 
TOK_CHAR 
TOK_STRING 
TOK_BOOL 
TOK_VOID 
TOK_PROGRAM 
TOK_VERSION 
TOK_EOF 

Definition at line 40 of file rpc_scan.h.


Function Documentation

void expected1 ( tok_kind  exp1)

Definition at line 319 of file rpc_util.c.

{
  s_print (expectbuf, "expected '%s'",
          toktostr (exp1));
  error (expectbuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void expected2 ( tok_kind  exp1,
tok_kind  exp2 
)

Definition at line 330 of file rpc_util.c.

{
  s_print (expectbuf, "expected '%s' or '%s'",
          toktostr (exp1),
          toktostr (exp2));
  error (expectbuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void expected3 ( tok_kind  exp1,
tok_kind  exp2,
tok_kind  exp3 
)

Definition at line 342 of file rpc_util.c.

{
  s_print (expectbuf, "expected '%s', '%s' or '%s'",
          toktostr (exp1),
          toktostr (exp2),
          toktostr (exp3));
  error (expectbuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void get_token ( token tokp)

Definition at line 147 of file rpc_scan.c.

{
  int commenting;

  if (pushed)
    {
      pushed = 0;
      *tokp = lasttok;
      return;
    }
  commenting = 0;
  for (;;)
    {
      if (*where == 0)
       {
         for (;;)
           {
             if (!fgets (curline, MAXLINESIZE, fin))
              {
                tokp->kind = TOK_EOF;
                *curline = 0;
                where = curline;
                return;
              }
             linenum++;
             if (commenting)
              {
                break;
              }
             else if (cppline (curline))
              {
                docppline (curline, &linenum,
                          &infilename);
              }
             else if (directive (curline))
              {
                printdirective (curline);
              }
             else
              {
                break;
              }
           }
         where = curline;
       }
      else if (isspace (*where))
       {
         while (isspace (*where))
           {
             where++;              /* eat */
           }
       }
      else if (commenting)
       {
         for (where++; *where; where++)
           {
             if (endcomment (where))
              {
                where++;
                commenting--;
                break;
              }
           }
       }
      else if (startcomment (where))
       {
         where += 2;
         commenting++;
       }
      else
       {
         break;
       }
    }

  /*
   * 'where' is not whitespace, comment or directive Must be a token!
   */
  switch (*where)
    {
    case ':':
      tokp->kind = TOK_COLON;
      where++;
      break;
    case ';':
      tokp->kind = TOK_SEMICOLON;
      where++;
      break;
    case ',':
      tokp->kind = TOK_COMMA;
      where++;
      break;
    case '=':
      tokp->kind = TOK_EQUAL;
      where++;
      break;
    case '*':
      tokp->kind = TOK_STAR;
      where++;
      break;
    case '[':
      tokp->kind = TOK_LBRACKET;
      where++;
      break;
    case ']':
      tokp->kind = TOK_RBRACKET;
      where++;
      break;
    case '{':
      tokp->kind = TOK_LBRACE;
      where++;
      break;
    case '}':
      tokp->kind = TOK_RBRACE;
      where++;
      break;
    case '(':
      tokp->kind = TOK_LPAREN;
      where++;
      break;
    case ')':
      tokp->kind = TOK_RPAREN;
      where++;
      break;
    case '<':
      tokp->kind = TOK_LANGLE;
      where++;
      break;
    case '>':
      tokp->kind = TOK_RANGLE;
      where++;
      break;

    case '"':
      tokp->kind = TOK_STRCONST;
      findstrconst (&where, &tokp->str);
      break;
    case '\'':
      tokp->kind = TOK_CHARCONST;
      findchrconst (&where, &tokp->str);
      break;

    case '-':
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      tokp->kind = TOK_IDENT;
      findconst (&where, &tokp->str);
      break;

    default:
      if (!(isalpha (*where) || *where == '_'))
       {
         char buf[100];
         char *p;

         s_print (buf, _("illegal character in file: "));
         p = buf + strlen (buf);
         if (isprint (*where))
           {
             s_print (p, "%c", *where);
           }
         else
           {
             s_print (p, "%d", *where);
           }
         error (buf);
       }
      findkind (&where, tokp);
      break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void peek ( token tokp)

Definition at line 122 of file rpc_scan.c.

{
  get_token (tokp);
  unget_token (tokp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int peekscan ( tok_kind  expect,
token tokp 
)

Definition at line 132 of file rpc_scan.c.

{
  peek (tokp);
  if (tokp->kind == expect)
    {
      get_token (tokp);
      return 1;
    }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void scan ( tok_kind  expect,
token tokp 
)

Definition at line 68 of file rpc_scan.c.

{
  get_token (tokp);
  if (tokp->kind != expect)
    expected1 (expect);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void scan2 ( tok_kind  expect1,
tok_kind  expect2,
token tokp 
)

Definition at line 79 of file rpc_scan.c.

{
  get_token (tokp);
  if (tokp->kind != expect1 && tokp->kind != expect2)
    {
      expected2 (expect1, expect2);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void scan3 ( tok_kind  expect1,
tok_kind  expect2,
tok_kind  expect3,
token tokp 
)

Definition at line 92 of file rpc_scan.c.

{
  get_token (tokp);
  if (tokp->kind != expect1 && tokp->kind != expect2
      && tokp->kind != expect3)
    {
      expected3 (expect1, expect2, expect3);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void scan_num ( token tokp)

Definition at line 106 of file rpc_scan.c.

{
  get_token (tokp);
  switch (tokp->kind)
    {
    case TOK_IDENT:
      break;
    default:
      error (_("constant or identifier expected"));
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: