Run rustfmt
This commit is contained in:
parent
4b0aced11f
commit
05e1555a9b
@ -190,7 +190,7 @@ pub struct ParseError {
|
|||||||
impl ParseError {
|
impl ParseError {
|
||||||
fn new_with_token<T, M>(msg: M, token: Token) -> ParseResult<T>
|
fn new_with_token<T, M>(msg: M, token: Token) -> ParseResult<T>
|
||||||
where M: Into<String> {
|
where M: Into<String> {
|
||||||
Err(ParseError { msg: msg.into(), location: Default::default(), token, })
|
Err(ParseError { msg: msg.into(), location: Default::default(), token })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,7 @@ impl Parser {
|
|||||||
Self { id_store: IdStore::new() }
|
Self { id_store: IdStore::new() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn parse(
|
pub(crate) fn parse(&mut self, input: &str) -> Result<AST, ParseError> {
|
||||||
&mut self,
|
|
||||||
input: &str,
|
|
||||||
) -> Result<AST, ParseError> {
|
|
||||||
use peg::str::LineCol;
|
use peg::str::LineCol;
|
||||||
|
|
||||||
schala_parser::program(input, self).map_err(|err: peg::error::ParseError<LineCol>| {
|
schala_parser::program(input, self).map_err(|err: peg::error::ParseError<LineCol>| {
|
||||||
@ -190,7 +187,7 @@ peg::parser! {
|
|||||||
|
|
||||||
rule type_singleton_name() -> TypeSingletonName =
|
rule type_singleton_name() -> TypeSingletonName =
|
||||||
name:identifier() params:type_params()? { TypeSingletonName {
|
name:identifier() params:type_params()? { TypeSingletonName {
|
||||||
name: rc_string(name), params: if let Some(params) = params { params } else { vec![] }
|
name: rc_string(name), params: if let Some(params) = params { params } else { vec![] }
|
||||||
} }
|
} }
|
||||||
|
|
||||||
rule type_params() -> Vec<TypeIdentifier> =
|
rule type_params() -> Vec<TypeIdentifier> =
|
||||||
|
@ -136,7 +136,6 @@ impl SourceReference {
|
|||||||
|
|
||||||
// (line_start, line_num, the string itself)
|
// (line_start, line_num, the string itself)
|
||||||
pub fn get_line(&self, line: usize) -> (usize, usize, String) {
|
pub fn get_line(&self, line: usize) -> (usize, usize, String) {
|
||||||
|
|
||||||
if self.newline_offsets.is_empty() {
|
if self.newline_offsets.is_empty() {
|
||||||
return (0, 0, self.last_source.as_ref().cloned().unwrap());
|
return (0, 0, self.last_source.as_ref().cloned().unwrap());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user