Switch to using a type for bracket depth.
This is to make changing the type easier in the future.
This commit is contained in:
@@ -11,15 +11,17 @@ use nom::Slice;
|
||||
use crate::error::CustomError;
|
||||
use crate::error::MyError;
|
||||
|
||||
pub type BracketDepth = i16;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct OrgSource<'s> {
|
||||
full_source: &'s str,
|
||||
start: usize,
|
||||
end: usize, // exclusive
|
||||
start_of_line: usize,
|
||||
bracket_depth: i16, // []
|
||||
brace_depth: i16, // {}
|
||||
parenthesis_depth: i16, // ()
|
||||
bracket_depth: BracketDepth, // []
|
||||
brace_depth: BracketDepth, // {}
|
||||
parenthesis_depth: BracketDepth, // ()
|
||||
preceding_character: Option<char>,
|
||||
}
|
||||
|
||||
@@ -71,15 +73,15 @@ impl<'s> OrgSource<'s> {
|
||||
self.slice(..(other.start - self.start))
|
||||
}
|
||||
|
||||
pub fn get_bracket_depth(&self) -> i16 {
|
||||
pub fn get_bracket_depth(&self) -> BracketDepth {
|
||||
self.bracket_depth
|
||||
}
|
||||
|
||||
pub fn get_brace_depth(&self) -> i16 {
|
||||
pub fn get_brace_depth(&self) -> BracketDepth {
|
||||
self.brace_depth
|
||||
}
|
||||
|
||||
pub fn get_parenthesis_depth(&self) -> i16 {
|
||||
pub fn get_parenthesis_depth(&self) -> BracketDepth {
|
||||
self.parenthesis_depth
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user