2005-10-05 01:11:39 +10:00
|
|
|
#ifndef FISH_TOKENIZER_H
|
|
|
|
#define FISH_TOKENIZER_H
|
|
|
|
|
2016-05-03 14:35:12 -07:00
|
|
|
#include <stddef.h>
|
2022-08-20 23:14:48 -07:00
|
|
|
#include <stdint.h>
|
2016-04-20 23:00:54 -07:00
|
|
|
|
2012-11-21 22:09:35 -08:00
|
|
|
#include "common.h"
|
2018-02-23 14:30:15 -08:00
|
|
|
#include "maybe.h"
|
2018-03-11 19:36:10 -05:00
|
|
|
#include "parse_constants.h"
|
2019-12-12 16:44:24 -08:00
|
|
|
#include "redirection.h"
|
2005-10-05 01:11:39 +10:00
|
|
|
|
2023-02-05 14:06:11 +01:00
|
|
|
using tok_flags_t = unsigned int;
|
2006-10-07 10:56:25 +10:00
|
|
|
|
2022-09-20 11:58:37 -07: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 16:08:49 -07:00
|
|
|
|
2023-02-05 14:06:11 +01: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 23:26:39 +10:00
|
|
|
|
2023-02-05 14:06:11 +01:00
|
|
|
#else
|
|
|
|
|
|
|
|
// Hacks to allow us to compile without Rust headers.
|
2021-12-21 02:26:41 -08:00
|
|
|
enum class tokenizer_error_t : uint8_t {
|
2018-09-27 21:25:49 -04:00
|
|
|
none,
|
|
|
|
unterminated_quote,
|
|
|
|
unterminated_subshell,
|
|
|
|
unterminated_slice,
|
|
|
|
unterminated_escape,
|
|
|
|
invalid_redirect,
|
|
|
|
invalid_pipe,
|
2019-10-27 14:35:14 -07:00
|
|
|
invalid_pipe_ampersand,
|
2018-09-27 21:25:49 -04:00
|
|
|
closing_unopened_subshell,
|
|
|
|
illegal_slice,
|
|
|
|
closing_unopened_brace,
|
|
|
|
unterminated_brace,
|
|
|
|
expected_pclose_found_bclose,
|
|
|
|
expected_bclose_found_pclose,
|
|
|
|
};
|
|
|
|
|
2023-02-05 14:06:11 +01:00
|
|
|
#endif
|
2012-12-10 16:23:08 -08:00
|
|
|
|
2005-10-05 01:11:39 +10:00
|
|
|
#endif
|