2005-10-04 15:11:39 +00:00
|
|
|
#ifndef FISH_TOKENIZER_H
|
|
|
|
#define FISH_TOKENIZER_H
|
|
|
|
|
2016-05-03 21:35:12 +00:00
|
|
|
#include <stddef.h>
|
2022-08-21 06:14:48 +00:00
|
|
|
#include <stdint.h>
|
2016-04-21 06:00:54 +00:00
|
|
|
|
2012-11-22 06:09:35 +00:00
|
|
|
#include "common.h"
|
2018-02-23 22:30:15 +00:00
|
|
|
#include "maybe.h"
|
2018-03-12 00:36:10 +00:00
|
|
|
#include "parse_constants.h"
|
2019-12-13 00:44:24 +00:00
|
|
|
#include "redirection.h"
|
2005-10-04 15:11:39 +00:00
|
|
|
|
2023-02-05 13:06:11 +00:00
|
|
|
using tok_flags_t = unsigned int;
|
2006-10-07 00:56:25 +00:00
|
|
|
|
2022-09-20 18:58:37 +00:00
|
|
|
#define TOK_ACCEPT_UNFINISHED 1
|
|
|
|
#define TOK_SHOW_COMMENTS 2
|
|
|
|
#define TOK_SHOW_BLANK_LINES 4
|
|
|
|
#define TOK_CONTINUE_AFTER_ERROR 8
|
2019-10-27 23:08:49 +00:00
|
|
|
|
2023-02-05 13:06:11 +00:00
|
|
|
#if INCLUDE_RUST_HEADERS
|
|
|
|
|
|
|
|
#include "tokenizer.rs.h"
|
|
|
|
using token_type_t = TokenType;
|
|
|
|
using tokenizer_error_t = TokenizerError;
|
|
|
|
using tok_t = Tok;
|
|
|
|
using tokenizer_t = Tokenizer;
|
|
|
|
using pipe_or_redir_t = PipeOrRedir;
|
|
|
|
using move_word_state_machine_t = MoveWordStateMachine;
|
|
|
|
using move_word_style_t = MoveWordStyle;
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2023-02-05 13:06:11 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
// Hacks to allow us to compile without Rust headers.
|
2021-12-21 10:26:41 +00:00
|
|
|
enum class tokenizer_error_t : uint8_t {
|
2018-09-28 01:25:49 +00:00
|
|
|
none,
|
|
|
|
unterminated_quote,
|
|
|
|
unterminated_subshell,
|
|
|
|
unterminated_slice,
|
|
|
|
unterminated_escape,
|
|
|
|
invalid_redirect,
|
|
|
|
invalid_pipe,
|
2019-10-27 21:35:14 +00:00
|
|
|
invalid_pipe_ampersand,
|
2018-09-28 01:25:49 +00:00
|
|
|
closing_unopened_subshell,
|
|
|
|
illegal_slice,
|
|
|
|
closing_unopened_brace,
|
|
|
|
unterminated_brace,
|
|
|
|
expected_pclose_found_bclose,
|
|
|
|
expected_bclose_found_pclose,
|
|
|
|
};
|
|
|
|
|
2023-02-05 13:06:11 +00:00
|
|
|
#endif
|
2012-12-11 00:23:08 +00:00
|
|
|
|
2005-10-04 15:11:39 +00:00
|
|
|
#endif
|