X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fidentifier.h;h=02fc0db97b28aef3f975ad79466921f4186779b0;hb=refs%2Fbuilds%2F20101210030502%2Fpspp;hp=a8c2a9fde11ace731e1c5878a7d6458dfa4b9248;hpb=43b1296aafe7582e7dbe6c2b6a8b478d7d9b0fcf;p=pspp diff --git a/src/data/identifier.h b/src/data/identifier.h index a8c2a9fde1..02fc0db97b 100644 --- a/src/data/identifier.h +++ b/src/data/identifier.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,18 +19,31 @@ #include #include -#include -#include +#include +#include "libpspp/str.h" /* Token types. */ -enum +enum token_type { - T_ID = 256, /* Identifier. */ + T_ID = 1, /* Identifier. */ T_POS_NUM, /* Positive number. */ T_NEG_NUM, /* Negative number. */ T_STRING, /* Quoted string. */ T_STOP, /* End of input. */ + T_ENDCMD, /* End of command (e.g. '.'). */ + + T_PLUS, /* + */ + T_DASH, /* - */ + T_ASTERISK, /* * */ + T_SLASH, /* / */ + T_EQUALS, /* = */ + T_LPAREN, /* ( */ + T_RPAREN, /* ) */ + T_LBRACK, /* [ */ + T_RBRACK, /* ] */ + T_COMMA, /* , */ + T_AND, /* AND */ T_OR, /* OR */ T_NOT, /* NOT */ @@ -51,18 +64,23 @@ enum }; /* Tokens. */ -bool lex_is_keyword (int token); +bool lex_is_keyword (enum token_type); /* Recognizing identifiers. */ bool lex_is_id1 (char); bool lex_is_idn (char); +bool lex_uc_is_id1 (ucs4_t); +bool lex_uc_is_idn (ucs4_t); +bool lex_uc_is_space (ucs4_t); size_t lex_id_get_length (struct substring); /* Comparing identifiers. */ bool lex_id_match (struct substring keyword, struct substring token); +bool lex_id_match_n (struct substring keyword, struct substring token, + size_t n); int lex_id_to_token (struct substring); /* Identifier names. */ -const char *lex_id_name (int); +const char *lex_id_name (enum token_type); #endif /* !data/identifier.h */