X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flexer.h;h=0880773390dece125d26d5bfed42a5047e65fa4f;hb=dcf9b154cbcaa35c3d8459a201b77eec8bcb30bd;hp=23ce64bf2154b20098dfd2a44e7cde9e6d469aa3;hpb=97d6c6f6b1922621ca013668eba9a9a9f71d60fe;p=pspp diff --git a/src/lexer.h b/src/lexer.h index 23ce64bf21..0880773390 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -14,81 +14,42 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #if !lexer_h #define lexer_h 1 -/* Returns nonzero if character CH may be the first character in an - identifier. */ -#define CHAR_IS_ID1(CH) \ - (isalpha ((unsigned char) (CH)) \ - || (CH) == '@' \ - || (CH) == '#' \ - || (CH) == '$') - -/* Returns nonzero if character CH may be a character in an - identifier other than the first. */ -#define CHAR_IS_IDN(CH) \ - (CHAR_IS_ID1 (CH) \ - || isdigit ((unsigned char) (CH)) \ - || (CH) == '.' \ - || (CH) == '_') - -/* Token types. */ -/* The order of the enumerals below is important. Do not change it. */ -enum - { - T_ID = 256, /* Identifier. */ - T_NUM, /* Number. */ - T_STRING, /* Quoted string. */ - T_STOP, /* End of input. */ - - T_AND, /* AND */ - T_OR, /* OR */ - T_NOT, /* NOT */ - - T_EQ, /* EQ */ - T_GE, /* GE or >= */ - T_GT, /* GT or > */ - T_LE, /* LE or <= */ - T_LT, /* LT or < */ - T_NE, /* NE or ~= */ - - T_ALL, /* ALL */ - T_BY, /* BY */ - T_TO, /* TO */ - T_WITH, /* WITH */ - - T_EXP, /* ** */ - - T_FIRST_KEYWORD = T_AND, - T_LAST_KEYWORD = T_WITH, - T_N_KEYWORDS = T_LAST_KEYWORD - T_FIRST_KEYWORD + 1, - }; +#include "var.h" +#include +#include + +#include "lex-def.h" extern int token; extern double tokval; -extern char tokid[9]; +extern char tokid[LONG_NAME_LEN + 1]; extern struct string tokstr; #include /* Initialization. */ void lex_init (void); +void lex_done (void); /* Common functions. */ void lex_get (void); void lex_error (const char *, ...); +void lex_sbc_only_once (const char *); +void lex_sbc_missing (const char *); int lex_end_of_command (void); /* Token testing functions. */ -int lex_integer_p (void); +bool lex_is_number (void); +double lex_number (void); +bool lex_is_integer (void); long lex_integer (void); -int lex_double_p (void); -double lex_double (void); /* Token matching functions. */ int lex_match (int); @@ -102,11 +63,6 @@ int lex_force_int (void); int lex_force_num (void); int lex_force_id (void); int lex_force_string (void); - -/* Comparing identifiers. */ -int lex_id_match_len (const char *keyword_string, size_t keyword_len, - const char *token_string, size_t token_len); -int lex_id_match (const char *keyword_string, const char *token_string); /* Weird token functions. */ int lex_look_ahead (void);