Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make get_variable usable from outside the crate #16

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,24 @@ where

/// A parsed variable.
#[derive(Debug)]
struct Variable<'a> {
pub struct Variable<'a> {
/// The name of the variable.
name: &'a str,
pub name: &'a str,

/// The start position of the name in the source.
name_start: usize,
pub name_start: usize,

/// The default value of the variable.
default: Option<std::ops::Range<usize>>,
pub default: Option<std::ops::Range<usize>>,

/// The end position of the entire variable in the source.
end_position: usize,
pub end_position: usize,
}

/// Parse a variable from source at the given position.
///
/// The finger must be the position of the dollar sign in the source.
fn parse_variable(source: &[u8], finger: usize) -> Result<Variable, Error> {
pub fn parse_variable(source: &[u8], finger: usize) -> Result<Variable, Error> {
if finger == source.len() {
return Err(error::MissingVariableName {
position: finger,
Expand Down
Loading