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 <ctype.h>
+#include <stdbool.h>
+
+#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 <stddef.h>
/* 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);
/* Token matching functions. */
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);
void lex_put_back (int);
-void lex_put_forward (int);
+void lex_put_back_id (const char *tokid);
/* Weird line processing functions. */
-char *lex_entire_line (void);
-char *lex_rest_of_line (int *had_dot);
+const char *lex_entire_line (void);
+const char *lex_rest_of_line (int *end_dot);
void lex_discard_line (void);
void lex_set_prog (char *p);