Put back in needed pubs.

This commit is contained in:
Tom Alexander
2023-09-11 13:13:28 -04:00
parent 7650a9edff
commit 84953c1669
71 changed files with 522 additions and 515 deletions

View File

@@ -69,13 +69,13 @@ use crate::types::Verbatim;
use crate::types::VerseBlock;
#[derive(Debug)]
enum DiffEntry<'s> {
pub enum DiffEntry<'s> {
DiffResult(DiffResult<'s>),
DiffLayer(DiffLayer<'s>),
}
#[derive(Debug)]
struct DiffResult<'s> {
pub struct DiffResult<'s> {
status: DiffStatus,
name: String,
message: Option<String>,
@@ -86,13 +86,13 @@ use crate::types::VerseBlock;
}
#[derive(Debug, PartialEq)]
enum DiffStatus {
enum DiffStatus {
Good,
Bad,
}
#[derive(Debug)]
struct DiffLayer<'s> {
pub struct DiffLayer<'s> {
name: String,
children: Vec<DiffEntry<'s>>,
}
@@ -126,11 +126,11 @@ impl<'s> DiffEntry<'s> {
}
}
fn is_bad(&self) -> bool {
pub fn is_bad(&self) -> bool {
self.is_immediately_bad() || self.has_bad_children()
}
fn print(&self, original_document: &str) -> Result<(), Box<dyn std::error::Error>> {
pub fn print(&self, original_document: &str) -> Result<(), Box<dyn std::error::Error>> {
self.print_indented(0, original_document)
}
@@ -374,7 +374,7 @@ fn compare_object<'s>(
}
}
fn compare_document<'s>(
pub fn compare_document<'s>(
emacs: &'s Token<'s>,
rust: &'s Document<'s>,
) -> Result<DiffEntry<'s>, Box<dyn std::error::Error>> {

View File

@@ -1,8 +1,8 @@
mod diff;
mod parse;
mod util;
use diff::compare_document;
use parse::emacs_parse_anonymous_org_document;
use parse::emacs_parse_file_org_document;
use parse::get_emacs_version;
use parse::get_org_mode_version;
pub use diff::compare_document;
pub use parse::emacs_parse_anonymous_org_document;
pub use parse::emacs_parse_file_org_document;
pub use parse::get_emacs_version;
pub use parse::get_org_mode_version;

View File

@@ -1,7 +1,7 @@
use std::path::Path;
use std::process::Command;
fn emacs_parse_anonymous_org_document<C>(
pub fn emacs_parse_anonymous_org_document<C>(
file_contents: C,
) -> Result<String, Box<dyn std::error::Error>>
where
@@ -31,7 +31,7 @@ where
Ok(String::from_utf8(org_sexp)?)
}
fn emacs_parse_file_org_document<P>(file_path: P) -> Result<String, Box<dyn std::error::Error>>
pub fn emacs_parse_file_org_document<P>(file_path: P) -> Result<String, Box<dyn std::error::Error>>
where
P: AsRef<Path>,
{
@@ -85,7 +85,7 @@ where
output
}
fn get_emacs_version() -> Result<String, Box<dyn std::error::Error>> {
pub fn get_emacs_version() -> Result<String, Box<dyn std::error::Error>> {
let elisp_script = r#"(progn
(message "%s" (version))
)"#;
@@ -103,7 +103,7 @@ where
Ok(String::from_utf8(out.stderr)?)
}
fn get_org_mode_version() -> Result<String, Box<dyn std::error::Error>> {
pub fn get_org_mode_version() -> Result<String, Box<dyn std::error::Error>> {
let elisp_script = r#"(progn
(org-mode)
(message "%s" (org-version nil t nil))

View File

@@ -21,7 +21,10 @@ fn get_offsets<'s, S: Source<'s>>(source: &'s str, rust_object: &'s S) -> (usize
(offset, end)
}
fn assert_name<'s>(emacs: &'s Token<'s>, name: &str) -> Result<(), Box<dyn std::error::Error>> {
pub(crate) fn assert_name<'s>(
emacs: &'s Token<'s>,
name: &str,
) -> Result<(), Box<dyn std::error::Error>> {
let children = emacs.as_list()?;
let first_child = children
.first()
@@ -37,7 +40,7 @@ fn get_offsets<'s, S: Source<'s>>(source: &'s str, rust_object: &'s S) -> (usize
Ok(())
}
fn assert_bounds<'s, S: Source<'s>>(
pub(crate) fn assert_bounds<'s, S: Source<'s>>(
source: &'s str,
emacs: &'s Token<'s>,
rust: &'s S,
@@ -146,7 +149,7 @@ fn maybe_token_to_usize(
/// Returns Ok(None) if value is nil.
///
/// Returns error if the attribute is not specified on the token at all.
fn get_property<'s, 'x>(
pub(crate) fn get_property<'s, 'x>(
emacs: &'s Token<'s>,
key: &'x str,
) -> Result<Option<&'s Token<'s>>, Box<dyn std::error::Error>> {