mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 15:25:31 +08:00
Implement more bitwise operation for parser bitfields
These will be used in the parser. Maybe this type should be a struct with boolean fields. The current way has the upside that the usage is exactly the same as in C++.
This commit is contained in:
parent
5dbffa8b6d
commit
2c331e9c69
|
@ -6,7 +6,7 @@ use crate::wchar::{wstr, WString, L};
|
||||||
use crate::wchar_ffi::{wcharz, WCharFromFFI, WCharToFFI};
|
use crate::wchar_ffi::{wcharz, WCharFromFFI, WCharToFFI};
|
||||||
use crate::wutil::{sprintf, wgettext_fmt};
|
use crate::wutil::{sprintf, wgettext_fmt};
|
||||||
use cxx::{CxxWString, UniquePtr};
|
use cxx::{CxxWString, UniquePtr};
|
||||||
use std::ops::{BitAnd, BitOrAssign};
|
use std::ops::{BitAnd, BitOr, BitOrAssign};
|
||||||
use widestring_suffix::widestrs;
|
use widestring_suffix::widestrs;
|
||||||
|
|
||||||
pub type SourceOffset = u32;
|
pub type SourceOffset = u32;
|
||||||
|
@ -39,6 +39,12 @@ impl BitAnd for ParseTreeFlags {
|
||||||
(self.0 & rhs.0) != 0
|
(self.0 & rhs.0) != 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl BitOr for ParseTreeFlags {
|
||||||
|
type Output = ParseTreeFlags;
|
||||||
|
fn bitor(self, rhs: Self) -> Self::Output {
|
||||||
|
Self(self.0 | rhs.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
impl BitOrAssign for ParseTreeFlags {
|
impl BitOrAssign for ParseTreeFlags {
|
||||||
fn bitor_assign(&mut self, rhs: Self) {
|
fn bitor_assign(&mut self, rhs: Self) {
|
||||||
self.0 |= rhs.0
|
self.0 |= rhs.0
|
||||||
|
|
|
@ -180,6 +180,11 @@ impl BitOr for TokFlags {
|
||||||
Self(self.0 | rhs.0)
|
Self(self.0 | rhs.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl BitOrAssign for TokFlags {
|
||||||
|
fn bitor_assign(&mut self, rhs: Self) {
|
||||||
|
self.0 |= rhs.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Flag telling the tokenizer to accept incomplete parameters, i.e. parameters with mismatching
|
/// Flag telling the tokenizer to accept incomplete parameters, i.e. parameters with mismatching
|
||||||
/// parenthesis, etc. This is useful for tab-completion.
|
/// parenthesis, etc. This is useful for tab-completion.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user