summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/error.rs b/src/error.rs
index a2b6d96..a2349ee 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -11,15 +11,22 @@ pub struct CrimError {
11} 11}
12 12
13impl CrimError { 13impl CrimError {
14 pub fn new( position: Position, what: String ) -> Self { 14 pub fn parse( position: Position, what: String ) -> Self {
15 CrimError { 15 Self {
16 position, 16 position,
17 what, 17 what,
18 } 18 }
19 } 19 }
20 20
21 pub fn other(what: String) -> Self {
22 Self {
23 position: Position::none(),
24 what,
25 }
26 }
27
21 pub fn eos( context: &str ) -> Self { 28 pub fn eos( context: &str ) -> Self {
22 CrimError { 29 Self {
23 position: Position::none(), 30 position: Position::none(),
24 what: format!("Premature end of stream while looking for {}", context), 31 what: format!("Premature end of stream while looking for {}", context),
25 } 32 }