Logo Search packages:      
Sourcecode: pbs-drmaa version File versions

int fsd_dt_lex ( union YYSTYPE lvalp,
fsd_dt_lexer_t lexer 
)

Lexer interface (hand written).

Definition at line 317 of file datetime.c.

References fsd_dt_lexer_s::end, fsd_dt_error(), fsd_dt_lexer_s::p, and fsd_dt_lexer_s::parser.

{
      const unsigned char *end = lex->end;
      /* int sign = +1; */
      while( isspace(*lex->p)  &&  lex->p != end )
            lex->p++;
      if( lex->p == end )
            return -1;
      switch( *lex->p )
       {
            case '/':  case ':':
            case '+':  case '-':
            case 'T':  case 'Z':
                  return * lex->p++;
#if 0
            case '-':
                  sign = -1;
            case '+': /* fall through */
                  if( ++(lex->p) == end )
                   {
                        fsd_dt_error( lex->parser, lex, "unexpected EOT" );
                        return -1;
                   }
            default: /* fall through */
#endif
            default:
             {
                  int num = 0;
                  if( ! ('0' <= *lex->p  &&  *lex->p <= '9') )
                   {
                        fsd_dt_error( lex->parser, lex, "invalid char '%c'", *(lex->p)++ );
                        return LEXER_ERROR;
                   }
                  while( lex->p != end  &&  '0' <= *lex->p  &&  *lex->p <= '9' )
                   {
                        num *= 10;
                        num += *(lex->p)++ - '0';
                   }
                  lvalp->integer = num;
                  return NUM;
             }
       }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index