Skip to content

Commit

Permalink
Clean-up inlines that didn't make sense
Browse files Browse the repository at this point in the history
  • Loading branch information
certainty committed Sep 6, 2021
1 parent 1af4721 commit c92e30f
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 29 deletions.
1 change: 0 additions & 1 deletion src/compiler/backend/code_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ impl<'a> CodeGenerator<'a> {
}

/// we want to track a new binding, so we need to make it known to the generator
#[inline]
fn declare_binding(&mut self, id: &Identifier) -> Result<()> {
// if we're at the top-level we don't need to track anything
// as during runtime the VM will just resolve this identifier, using the `TopLevel`
Expand Down
1 change: 0 additions & 1 deletion src/compiler/backend/variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ impl VariablesRef {
}
}

#[inline]
pub fn add_local(&mut self, name: Identifier) -> Result<usize> {
let scope_depth = self.inner.borrow().scope_depth;
self.inner.borrow_mut().locals.add(name, scope_depth)?;
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/frontend/reader/datum/abbreviation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use nom::sequence::pair;
// abbreviation
////////////////////////////

#[inline]
pub fn parse(input: Input) -> ParseResult<Datum> {
let abbrev = pair(parse_abbrev_prefix, parse_datum);

Expand All @@ -19,7 +18,6 @@ pub fn parse(input: Input) -> ParseResult<Datum> {
})(input)
}

#[inline]
fn parse_abbrev_prefix(input: Input) -> ParseResult<Datum> {
let abbrev = alt((
value("quote", char('\'')),
Expand Down
7 changes: 2 additions & 5 deletions src/compiler/frontend/reader/datum/character.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ fn parse_hex_char_literal(input: Input) -> ParseResult<char> {
preceded(char('x'), parse_hex_literal)(input)
}

#[inline]
fn parse_named_char_literal(input: Input) -> ParseResult<char> {
alt((
value(' ', tag("space")),
Expand All @@ -40,7 +39,6 @@ fn parse_named_char_literal(input: Input) -> ParseResult<char> {
}

// parse a sequence of 3 bytes hex encoded
#[inline]
fn parse_hex_literal<'a>(input: Input<'a>) -> ParseResult<'a, char> {
let parse_hex = take_while_m_n(1, 6, |c: char| c.is_ascii_hexdigit());
let parse_u32 = map_res(parse_hex, move |hex: Input<'a>| {
Expand All @@ -51,15 +49,14 @@ fn parse_hex_literal<'a>(input: Input<'a>) -> ParseResult<'a, char> {
}

// shared for strings and symbols
#[inline]
pub fn parse_inline_hex_escape<'a>(input: Input<'a>) -> ParseResult<'a, char> {
pub fn parse_inline_hex_escape(input: Input) -> ParseResult<char> {
context(
"inline hex escape",
delimited(tag("\\x"), parse_hex_literal, char(';')),
)(input)
}

pub fn parse_mnemonic_escape<'a>(input: Input<'a>) -> ParseResult<'a, char> {
pub fn parse_mnemonic_escape(input: Input) -> ParseResult<char> {
context(
"mnemonic escape",
preceded(
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/frontend/reader/datum/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::compiler::frontend::reader::datum::Datum;
/// <list> -> (<datum>*) | (<datum>+ . <datum>)
/// ```

#[inline]
pub fn parse_proper_list(input: Input) -> ParseResult<Datum> {
let list_elements = delimited(
parse_inter_token_space,
Expand All @@ -31,7 +30,6 @@ pub fn parse_proper_list(input: Input) -> ParseResult<Datum> {
/// <list> -> (<datum>*) | (<datum>+ . <datum>)
/// ```

#[inline]
pub fn parse_improper_list(input: Input) -> ParseResult<Datum> {
let improper_head = many1(delimited(
parse_inter_token_space,
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/frontend/reader/datum/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn parse_compound_datum(input: Input) -> ParseResult<Datum> {
context(
"compound datum",
alt((
context("vector", vector::parse_vector),
context("vector", vector::parse),
context("improper list", list::parse_improper_list),
context("list", list::parse_proper_list),
context("abbreviation", abbreviation::parse),
Expand Down
6 changes: 2 additions & 4 deletions src/compiler/frontend/reader/datum/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn parse_string_element(input: Input) -> ParseResult<StringElement> {
))(input)
}

fn parse_string_escape<'a>(input: Input<'a>) -> ParseResult<'a, char> {
fn parse_string_escape(input: Input) -> ParseResult<char> {
context(
"escaped character",
preceded(
Expand All @@ -64,8 +64,7 @@ fn parse_string_escape<'a>(input: Input<'a>) -> ParseResult<'a, char> {
)(input)
}

#[inline]
fn parse_string_continuation<'a>(input: Input<'a>) -> ParseResult<'a, ()> {
fn parse_string_continuation(input: Input) -> ParseResult<()> {
let line_continuation = terminated(
terminated(many0(parse_intra_line_ws), consume_line_ending),
parse_intra_line_ws,
Expand All @@ -75,7 +74,6 @@ fn parse_string_continuation<'a>(input: Input<'a>) -> ParseResult<'a, ()> {
Ok((s, ()))
}

#[inline]
fn parse_string_literal(input: Input) -> ParseResult<&str> {
let (s, v) = is_not("\\\"")(input)?;

Expand Down
9 changes: 0 additions & 9 deletions src/compiler/frontend/reader/datum/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub fn parse(input: Input) -> ParseResult<Datum> {
with_location(symbol_literal, Datum::symbol)(input)
}

#[inline]
fn parse_peculiar_identifier(input: Input) -> ParseResult<String> {
let explicit_sign_str = map(parse_explicit_sign, String::from);

Expand All @@ -44,7 +43,6 @@ fn parse_peculiar_identifier(input: Input) -> ParseResult<String> {
))(input)
}

#[inline]
fn parse_peculiar_with_sign(input: Input) -> ParseResult<String> {
let (s, (sign, sign_sub, subseq)) = tuple((
parse_explicit_sign,
Expand All @@ -59,7 +57,6 @@ fn parse_peculiar_with_sign(input: Input) -> ParseResult<String> {
Ok((s, symbol))
}

#[inline]
fn parse_peculiar_with_dot(input: Input) -> ParseResult<String> {
let (s, (dot, dot_subseq, subseq)) =
tuple((char('.'), parse_dot_subsequent, many0(parse_subsequent)))(input)?;
Expand All @@ -71,7 +68,6 @@ fn parse_peculiar_with_dot(input: Input) -> ParseResult<String> {
Ok((s, symbol))
}

#[inline]
fn parse_peculiar_with_sign_dot(input: Input) -> ParseResult<String> {
let (s, (sign, sign_sub, dot_subseq)) =
tuple((parse_explicit_sign, char('.'), parse_dot_subsequent))(input)?;
Expand All @@ -93,7 +89,6 @@ fn parse_sign_subsequent(input: Input) -> ParseResult<char> {
alt((parse_initial, parse_explicit_sign, char('@')))(input)
}

#[inline]
fn parse_delimited_identifier(input: Input) -> ParseResult<String> {
let symbol_elements = fold_many0(
parse_symbol_element,
Expand All @@ -110,7 +105,6 @@ fn parse_delimited_identifier(input: Input) -> ParseResult<String> {
delimited(char('|'), symbol_elements, char('|'))(input)
}

#[inline]
fn parse_symbol_element(input: Input) -> ParseResult<SymbolElement> {
let parse_symbol_escape = value('|', tag("\\|"));

Expand All @@ -122,7 +116,6 @@ fn parse_symbol_element(input: Input) -> ParseResult<SymbolElement> {
))(input)
}

#[inline]
fn parse_symbol_literal(input: Input) -> ParseResult<&str> {
let (s, v) = is_not("|\\")(input)?;

Expand All @@ -141,15 +134,13 @@ fn parse_identifier(input: Input) -> ParseResult<String> {

pub const SYMBOL_SPECIAL_INITIAL: &str = "!$%&*/:<=>?^_~";

#[inline]
fn parse_initial(input: Input) -> ParseResult<char> {
let letter = verify(anychar, |c| c.is_alphabetic());
let special_initial = one_of(SYMBOL_SPECIAL_INITIAL);

alt((letter, special_initial))(input)
}

#[inline]
fn parse_subsequent(input: Input) -> ParseResult<char> {
let digit = verify(anychar, |c| c.is_digit(10));
let special_subsequent = alt((parse_explicit_sign, char('.'), char('@')));
Expand Down
3 changes: 1 addition & 2 deletions src/compiler/frontend/reader/datum/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use nom::sequence::delimited;
/// <vector> -> #(<datum>*)
/// ```

#[inline]
pub fn parse_vector(input: Input) -> ParseResult<Datum> {
pub fn parse(input: Input) -> ParseResult<Datum> {
let list_elements = delimited(
parse_inter_token_space,
parse_datum,
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/frontend/reader/datum/whitespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub fn parse_intra_line_ws(input: Input) -> ParseResult<()> {
unit(alt((char(' '), char('\t'))))(input)
}

#[inline]
pub fn parse_inter_token_space(input: Input) -> ParseResult<()> {
let atmosphere = alt((parse_white_space, parse_comment, parse_directive));
unit(many0(atmosphere))(input)
Expand All @@ -42,7 +41,6 @@ pub fn parse_comment(input: Input) -> ParseResult<()> {
)(input)
}

#[inline]
fn parse_nested_comment(input: Input) -> ParseResult<()> {
let comment_text = many0(anychar);
let nested_comment = delimited(tag("#|"), comment_text, tag("|#"));
Expand Down

0 comments on commit c92e30f

Please sign in to comment.