+/* 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 *);
+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 *);
+
+/* Issuing errors. */
+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);
+int lex_end_of_command (struct lexer *);
+
+void lex_error_expecting (struct lexer *, ...) SENTINEL(0);
+#define lex_error_expecting(...) \
+ lex_error_expecting(__VA_ARGS__, NULL_SENTINEL)
+void lex_error_expecting_valist (struct lexer *, va_list);
+void lex_error_expecting_array (struct lexer *, const char **, size_t n);