summaryrefslogtreecommitdiff
path: root/src/parse/resolve.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-03-19 17:57:31 +0100
committerLaurenz <laurmaedje@gmail.com>2021-03-19 17:57:31 +0100
commit264a7dedd42e27cd9e604037640cf0594b2ec46b (patch)
treed26feea399d54bb86bd44878f40293983bf5251d /src/parse/resolve.rs
parentca3df70e2a5069832d7d2135967674c34a155442 (diff)
Scheduled maintenance 🔨
- New naming scheme - TextNode instead of NodeText - CallExpr instead of ExprCall - ... - Less glob imports - Removes Value::Args variant - Removes prelude - Renames Layouted to Fragment - Moves font into env - Moves shaping into layout - Moves frame into separate module
Diffstat (limited to 'src/parse/resolve.rs')
-rw-r--r--src/parse/resolve.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/parse/resolve.rs b/src/parse/resolve.rs
index 88e11784..1f33198a 100644
--- a/src/parse/resolve.rs
+++ b/src/parse/resolve.rs
@@ -1,5 +1,5 @@
use super::{is_newline, Scanner};
-use crate::syntax::{Ident, NodeRaw, Pos};
+use crate::syntax::{Ident, Pos, RawNode};
/// Resolve all escape sequences in a string.
pub fn resolve_string(string: &str) -> String {
@@ -47,17 +47,17 @@ pub fn resolve_hex(sequence: &str) -> Option<char> {
}
/// Resolve the language tag and trims the raw text.
-pub fn resolve_raw(text: &str, backticks: usize, start: Pos) -> NodeRaw {
+pub fn resolve_raw(text: &str, backticks: usize, start: Pos) -> RawNode {
if backticks > 1 {
let (tag, inner) = split_at_lang_tag(text);
let (lines, had_newline) = trim_and_split_raw(inner);
- NodeRaw {
+ RawNode {
lang: Ident::new(tag, start .. start + tag.len()),
lines,
block: had_newline,
}
} else {
- NodeRaw {
+ RawNode {
lang: None,
lines: split_lines(text),
block: false,
@@ -105,7 +105,7 @@ fn trim_and_split_raw(mut raw: &str) -> (Vec<String>, bool) {
/// Split a string into a vector of lines
/// (respecting Unicode, Unix, Mac and Windows line breaks).
-pub fn split_lines(text: &str) -> Vec<String> {
+fn split_lines(text: &str) -> Vec<String> {
let mut s = Scanner::new(text);
let mut line = String::new();
let mut lines = Vec::new();
@@ -174,7 +174,7 @@ mod tests {
lines: &[&str],
block: bool,
) {
- Span::without_cmp(|| assert_eq!(resolve_raw(raw, backticks, Pos(0)), NodeRaw {
+ Span::without_cmp(|| assert_eq!(resolve_raw(raw, backticks, Pos(0)), RawNode {
lang: lang.and_then(|id| Ident::new(id, 0)),
lines: lines.iter().map(ToString::to_string).collect(),
block,