From 15ae9026cf270d898cad16678032a5460e77404c Mon Sep 17 00:00:00 2001
From: Aleksey Kladov <aleksey.kladov@gmail.com>
Date: Thu, 11 Jan 2018 23:25:14 +0300
Subject: Encapsulate position

---
 src/parser/event_parser/parser.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/parser/event_parser')

diff --git a/src/parser/event_parser/parser.rs b/src/parser/event_parser/parser.rs
index d7d24fa27..8bc382b12 100644
--- a/src/parser/event_parser/parser.rs
+++ b/src/parser/event_parser/parser.rs
@@ -19,6 +19,9 @@ pub(crate) struct Parser<'t> {
     curly_limit: Option<i32>,
 }
 
+#[derive(Debug, Clone, Copy,PartialEq, Eq)]
+pub(crate) struct Pos(u32);
+
 impl<'t> Parser<'t> {
     pub(crate) fn new(text: &'t str, raw_tokens: &'t [Token]) -> Parser<'t> {
         let mut tokens = Vec::new();
@@ -44,8 +47,8 @@ impl<'t> Parser<'t> {
         }
     }
 
-    pub(crate) fn pos(&self) -> usize {
-        self.pos
+    pub(crate) fn pos(&self) -> Pos {
+        Pos(self.pos as u32)
     }
 
     pub(crate) fn into_events(self) -> Vec<Event> {
-- 
cgit v1.2.3