mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-01 15:14:26 +08:00
Make some names public
This commit is contained in:
parent
dc6aead17b
commit
36ba912779
|
@ -1898,7 +1898,7 @@ define_keyword_node!(KeywordWhile, ParseKeyword::kw_while);
|
||||||
|
|
||||||
impl DecoratedStatement {
|
impl DecoratedStatement {
|
||||||
/// \return the decoration for this statement.
|
/// \return the decoration for this statement.
|
||||||
fn decoration(&self) -> StatementDecoration {
|
pub fn decoration(&self) -> StatementDecoration {
|
||||||
let Some(decorator) = &self.opt_decoration else {
|
let Some(decorator) = &self.opt_decoration else {
|
||||||
return StatementDecoration::none;
|
return StatementDecoration::none;
|
||||||
};
|
};
|
||||||
|
@ -1942,6 +1942,9 @@ impl AcceptorMut for ArgumentOrRedirectionVariant {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ArgumentOrRedirectionVariant {
|
impl ArgumentOrRedirectionVariant {
|
||||||
|
pub fn typ(&self) -> Type {
|
||||||
|
self.embedded_node().typ()
|
||||||
|
}
|
||||||
fn embedded_node(&self) -> &dyn NodeMut {
|
fn embedded_node(&self) -> &dyn NodeMut {
|
||||||
match self {
|
match self {
|
||||||
ArgumentOrRedirectionVariant::Argument(node) => node,
|
ArgumentOrRedirectionVariant::Argument(node) => node,
|
||||||
|
@ -2032,6 +2035,9 @@ impl AcceptorMut for StatementVariant {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StatementVariant {
|
impl StatementVariant {
|
||||||
|
pub fn typ(&self) -> Type {
|
||||||
|
self.embedded_node().typ()
|
||||||
|
}
|
||||||
fn embedded_node(&self) -> &dyn NodeMut {
|
fn embedded_node(&self) -> &dyn NodeMut {
|
||||||
match self {
|
match self {
|
||||||
StatementVariant::None => panic!("cannot visit null statement"),
|
StatementVariant::None => panic!("cannot visit null statement"),
|
||||||
|
@ -2113,6 +2119,9 @@ impl AcceptorMut for BlockStatementHeaderVariant {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockStatementHeaderVariant {
|
impl BlockStatementHeaderVariant {
|
||||||
|
pub fn typ(&self) -> Type {
|
||||||
|
self.embedded_node().typ()
|
||||||
|
}
|
||||||
fn embedded_node(&self) -> &dyn NodeMut {
|
fn embedded_node(&self) -> &dyn NodeMut {
|
||||||
match self {
|
match self {
|
||||||
BlockStatementHeaderVariant::None => panic!("cannot visit null block header"),
|
BlockStatementHeaderVariant::None => panic!("cannot visit null block header"),
|
||||||
|
|
|
@ -1725,7 +1725,7 @@ pub fn valid_var_name_char(chr: char) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Test if the given string is a valid variable name.
|
/// Test if the given string is a valid variable name.
|
||||||
fn valid_var_name(s: &wstr) -> bool {
|
pub fn valid_var_name(s: &wstr) -> bool {
|
||||||
// Note do not use c_str(), we want to fail on embedded nul bytes.
|
// Note do not use c_str(), we want to fail on embedded nul bytes.
|
||||||
!s.is_empty() && s.chars().all(valid_var_name_char)
|
!s.is_empty() && s.chars().all(valid_var_name_char)
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ mod parse_constants_ffi {
|
||||||
|
|
||||||
/// A range of source code.
|
/// A range of source code.
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||||
struct SourceRange {
|
pub struct SourceRange {
|
||||||
start: u32,
|
start: u32,
|
||||||
length: u32,
|
length: u32,
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ mod parse_constants_ffi {
|
||||||
/// IMPORTANT: If the following enum table is modified you must also update token_type_description below.
|
/// IMPORTANT: If the following enum table is modified you must also update token_type_description below.
|
||||||
/// TODO above comment can be removed when we drop the FFI and get real enums.
|
/// TODO above comment can be removed when we drop the FFI and get real enums.
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
enum ParseTokenType {
|
pub enum ParseTokenType {
|
||||||
invalid = 1,
|
invalid = 1,
|
||||||
|
|
||||||
// Terminal types.
|
// Terminal types.
|
||||||
|
@ -115,7 +115,7 @@ mod parse_constants_ffi {
|
||||||
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
enum ParseKeyword {
|
pub enum ParseKeyword {
|
||||||
// 'none' is not a keyword, it is a sentinel indicating nothing.
|
// 'none' is not a keyword, it is a sentinel indicating nothing.
|
||||||
none,
|
none,
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ mod parse_constants_ffi {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The location of a pipeline.
|
// The location of a pipeline.
|
||||||
enum PipelinePosition {
|
pub enum PipelinePosition {
|
||||||
none, // not part of a pipeline
|
none, // not part of a pipeline
|
||||||
first, // first command in a pipeline
|
first, // first command in a pipeline
|
||||||
subsequent, // second or further command in a pipeline
|
subsequent, // second or further command in a pipeline
|
||||||
|
@ -243,7 +243,8 @@ mod parse_constants_ffi {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use parse_constants_ffi::{
|
pub use parse_constants_ffi::{
|
||||||
parse_error_t, ParseErrorCode, ParseKeyword, ParseTokenType, SourceRange, StatementDecoration,
|
parse_error_t, ParseErrorCode, ParseKeyword, ParseTokenType, PipelinePosition, SourceRange,
|
||||||
|
StatementDecoration,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl SourceRange {
|
impl SourceRange {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user