-bool lex_force_match (struct lexer *, int);
-bool lex_force_match_id (struct lexer *, const char *);
-bool lex_force_int (struct lexer *);
-bool lex_force_num (struct lexer *);
-bool lex_force_id (struct lexer *);
-bool lex_force_string (struct lexer *);
-
-/* Weird token functions. */
-int lex_look_ahead (struct lexer *);
-void lex_put_back (struct lexer *, int);
-void lex_put_back_id (struct lexer *, const char *tokid);
-
-/* Weird line processing functions. */
-const char *lex_entire_line (const struct lexer *);
-const struct string *lex_entire_line_ds (const struct lexer *);
-const char *lex_rest_of_line (const struct lexer *);
-bool lex_end_dot (const struct lexer *);
-void lex_preprocess_line (struct string *, enum syntax_mode,
- bool *line_starts_command,
- bool *line_ends_command);
-void lex_discard_line (struct lexer *);
-void lex_discard_rest_of_command (struct lexer *);
+bool lex_force_match (struct lexer *, enum token_type) WARN_UNUSED_RESULT;
+bool lex_force_match_id (struct lexer *, const char *) WARN_UNUSED_RESULT;
+bool lex_force_int (struct lexer *) WARN_UNUSED_RESULT;
+bool lex_force_int_range (struct lexer *, const char *name,
+ long min, long max) WARN_UNUSED_RESULT;
+bool lex_force_num (struct lexer *) WARN_UNUSED_RESULT;
+bool lex_force_num_range_closed (struct lexer *, const char *name,
+ double min, double max) WARN_UNUSED_RESULT;
+bool lex_force_num_range_halfopen (struct lexer *, const char *name,
+ double min, double max) WARN_UNUSED_RESULT;
+bool lex_force_num_range_open (struct lexer *, const char *name,
+ double min, double max) WARN_UNUSED_RESULT;
+bool lex_force_id (struct lexer *) WARN_UNUSED_RESULT;
+bool lex_force_string (struct lexer *) WARN_UNUSED_RESULT;
+bool lex_force_string_or_id (struct lexer *) WARN_UNUSED_RESULT;
+
+/* Token accessors. */
+enum token_type lex_token (const struct lexer *);
+double lex_tokval (const struct lexer *);
+const char *lex_tokcstr (const struct lexer *);
+struct substring lex_tokss (const struct lexer *);
+
+/* Looking ahead. */
+const struct token *lex_next (const struct lexer *, int n);
+enum token_type lex_next_token (const struct lexer *, int n);
+const char *lex_next_tokcstr (const struct lexer *, int n);
+double lex_next_tokval (const struct lexer *, int n);
+struct substring lex_next_tokss (const struct lexer *, int n);
+
+/* Looking at the current command, including lookahead and lookbehind. */
+int lex_ofs (const struct lexer *);
+int lex_max_ofs (const struct lexer *);
+const struct token *lex_ofs_token (const struct lexer *, int ofs);
+struct msg_location *lex_ofs_location (const struct lexer *, int ofs0, int ofs1);
+struct msg_point lex_ofs_start_point (const struct lexer *, int ofs);
+struct msg_point lex_ofs_end_point (const struct lexer *, int ofs);
+
+/* Token representation. */
+char *lex_next_representation (const struct lexer *, int n0, int n1);
+char *lex_ofs_representation (const struct lexer *, int ofs0, int ofs1);
+bool lex_next_is_from_macro (const struct lexer *, int n);
+
+/* Current position. */
+const char *lex_get_file_name (const struct lexer *);
+struct msg_location *lex_get_location (const struct lexer *, int n0, int n1);
+const char *lex_get_encoding (const struct lexer *);
+const struct lex_source *lex_source (const struct lexer *);
+
+/* Issuing errors and warnings. */
+void lex_error (struct lexer *, const char *, ...) PRINTF_FORMAT (2, 3);
+void lex_next_error (struct lexer *, int n0, int n1, const char *, ...)
+ PRINTF_FORMAT (4, 5);
+void lex_ofs_error (struct lexer *, int ofs0, int ofs1, const char *, ...)
+ PRINTF_FORMAT (4, 5);
+
+void lex_msg (struct lexer *, enum msg_class, const char *, ...)
+ PRINTF_FORMAT (3, 4);
+void lex_next_msg (struct lexer *, enum msg_class, int n0, int n1,
+ const char *, ...)
+ PRINTF_FORMAT (5, 6);
+void lex_ofs_msg (struct lexer *, enum msg_class, int ofs0, int ofs1,
+ const char *, ...)
+ PRINTF_FORMAT (5, 6);
+void lex_ofs_msg_valist (struct lexer *lexer, enum msg_class,
+ int ofs0, int ofs1, const char *format, va_list)
+ PRINTF_FORMAT (5, 0);