mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
all parse tests work!
This commit is contained in:
parent
e83cb0d027
commit
d284d3bb72
4 changed files with 12 additions and 25 deletions
|
@ -343,14 +343,8 @@ fn spaces<'a>(
|
||||||
state = state.advance_spaces(1)?;
|
state = state.advance_spaces(1)?;
|
||||||
}
|
}
|
||||||
'\n' => {
|
'\n' => {
|
||||||
// must check indent to not make undesired progress
|
// don't need to check the indent here since we'll reset it
|
||||||
let progress =
|
// anyway
|
||||||
Progress::from_lengths(start_bytes_len, state.bytes.len());
|
|
||||||
|
|
||||||
state =
|
|
||||||
state.check_indent(min_indent).map_err(|(fail, _)| {
|
|
||||||
(progress, fail, original_state.clone())
|
|
||||||
})?;
|
|
||||||
|
|
||||||
state = state.newline()?;
|
state = state.newline()?;
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,8 @@ use crate::header::{
|
||||||
use crate::ident::{lowercase_ident, unqualified_ident, uppercase_ident};
|
use crate::ident::{lowercase_ident, unqualified_ident, uppercase_ident};
|
||||||
use crate::parser::Progress::{self, *};
|
use crate::parser::Progress::{self, *};
|
||||||
use crate::parser::{
|
use crate::parser::{
|
||||||
self, ascii_char, ascii_string, backtrackable, end_of_file, fail_when_progress, loc, optional,
|
self, ascii_char, ascii_string, backtrackable, loc, optional, peek_utf8_char,
|
||||||
peek_utf8_char, peek_utf8_char_at, unexpected, unexpected_eof, Either, ParseResult, Parser,
|
peek_utf8_char_at, unexpected, unexpected_eof, Either, ParseResult, Parser, State,
|
||||||
State,
|
|
||||||
};
|
};
|
||||||
use crate::string_literal;
|
use crate::string_literal;
|
||||||
use crate::type_annotation;
|
use crate::type_annotation;
|
||||||
|
@ -323,8 +322,8 @@ fn provides_to<'a>() -> impl Parser<'a, ProvidesTo<'a>> {
|
||||||
map!(
|
map!(
|
||||||
and!(
|
and!(
|
||||||
and!(
|
and!(
|
||||||
skip_second!(backtrackable(space1(1)), ascii_string("provides")),
|
skip_second!(debug!(backtrackable(space1(1))), ascii_string("provides")),
|
||||||
space1(1)
|
debug!(space1(1))
|
||||||
),
|
),
|
||||||
and!(
|
and!(
|
||||||
collection!(
|
collection!(
|
||||||
|
|
|
@ -4,8 +4,8 @@ use crate::expr::{global_tag, private_tag};
|
||||||
use crate::ident::join_module_parts;
|
use crate::ident::join_module_parts;
|
||||||
use crate::keyword;
|
use crate::keyword;
|
||||||
use crate::parser::{
|
use crate::parser::{
|
||||||
allocated, ascii_char, ascii_string, backtrackable, fail_when_progress, not, optional,
|
allocated, ascii_char, ascii_string, not, optional, peek_utf8_char, unexpected, Either, Fail,
|
||||||
peek_utf8_char, unexpected, Either, Fail, FailReason, ParseResult, Parser,
|
FailReason, ParseResult, Parser,
|
||||||
Progress::{self, *},
|
Progress::{self, *},
|
||||||
State,
|
State,
|
||||||
};
|
};
|
||||||
|
|
|
@ -2501,21 +2501,15 @@ mod test_parse {
|
||||||
after_to: &[],
|
after_to: &[],
|
||||||
};
|
};
|
||||||
|
|
||||||
// let src = indoc!(
|
|
||||||
// r#"
|
|
||||||
// app "quicksort"
|
|
||||||
// packages { base: "./platform" }
|
|
||||||
// imports [ foo.Bar.Baz ]
|
|
||||||
// provides [ quicksort ] to base
|
|
||||||
// "#
|
|
||||||
// );
|
|
||||||
|
|
||||||
let src = indoc!(
|
let src = indoc!(
|
||||||
r#"
|
r#"
|
||||||
app "quicksort"
|
app "quicksort"
|
||||||
|
packages { base: "./platform" }
|
||||||
|
imports [ foo.Bar.Baz ]
|
||||||
provides [ quicksort ] to base
|
provides [ quicksort ] to base
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
|
|
||||||
let actual = app_header()
|
let actual = app_header()
|
||||||
.parse(&arena, State::new(src.as_bytes(), Attempting::Module))
|
.parse(&arena, State::new(src.as_bytes(), Attempting::Module))
|
||||||
.map(|tuple| tuple.1);
|
.map(|tuple| tuple.1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue