aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--progs/tests/simple.sy12
-rw-r--r--src/compiler.rs12
-rw-r--r--src/error.rs5
-rw-r--r--src/tokenizer.rs5
4 files changed, 32 insertions, 2 deletions
diff --git a/progs/tests/simple.sy b/progs/tests/simple.sy
index 48394d7..a82471b 100644
--- a/progs/tests/simple.sy
+++ b/progs/tests/simple.sy
@@ -1,2 +1,10 @@
-print test(3.0)
-print test(3.0, 4.0)
+<<<<<<< HEAD
+print extern_test(4.0)
+<<<<<<< HEAD
+print extern_test(4.0)
+=======
+print extern_test(5.0)
+>>>>>>> 2
+=======
+print extern_test(5.0)
+>>>>>>> 2
diff --git a/src/compiler.rs b/src/compiler.rs
index cd4ffda..124606e 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -473,6 +473,18 @@ impl Compiler {
fn eat(&mut self) -> Token {
let t = self.peek();
self.curr += 1;
+ match t {
+ Token::GitConflictBegin => {
+ self.curr -= 1;
+ let start = self.line();
+ self.curr += 1;
+ while !matches!(self.eat(), Token::GitConflictEnd) {}
+ self.panic = false;
+ self.error_on_line(ErrorKind::GitConflictError(start, self.line()), start, None);
+ self.panic = true;
+ }
+ _ => {}
+ }
t
}
diff --git a/src/error.rs b/src/error.rs
index 74f5af3..9aca985 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -32,6 +32,8 @@ pub enum ErrorKind {
/// (line, token)
SyntaxError(usize, Token),
+ /// (start, end)
+ GitConflictError(usize, usize),
}
#[derive(Debug, Clone)]
@@ -103,6 +105,9 @@ impl fmt::Display for ErrorKind {
ErrorKind::SyntaxError(line, token) => {
write!(f, "Syntax Error on line {} at token {:?}", line, token)
}
+ ErrorKind::GitConflictError(start_line, end_line) => {
+ write!(f, "Git conflict markers found between lines {} and {}",
+ start_line, end_line)
}
}
}
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index b54e194..2c8e5e8 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -127,6 +127,11 @@ pub enum Token {
#[token("\n")]
Newline,
+ #[token("<<<<<<<")]
+ GitConflictBegin,
+ #[token(">>>>>>>")]
+ GitConflictEnd,
+
#[regex(r"//[^\n]*", logos::skip)]
Comment,