From 9e8610ba3bf0da564932caa5db39c0e341c60058 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Wed, 18 Feb 2015 16:01:18 +0700 Subject: [PATCH] Use byte type for enums --- lexer/lexer.go | 4 ++-- parser/context.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lexer/lexer.go b/lexer/lexer.go index c0d1393..f361e65 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -33,7 +33,7 @@ type ( } // Identifies the type of the item - Token int + Token byte // Represents the state of the scanner as a function that returns the next state stateFn func(*Lexer) stateFn @@ -86,7 +86,7 @@ func (l *Lexer) NextItem() (item Item, ok bool) { // Returns the next rune in the input func (l *Lexer) next() rune { - if int(l.pos) >= len(l.input) { + if l.pos >= len(l.input) { l.width = 0 return 0 } diff --git a/parser/context.go b/parser/context.go index ea3555b..7cc71f7 100644 --- a/parser/context.go +++ b/parser/context.go @@ -19,7 +19,7 @@ type ( } // Type of expectation: object or array - expectationType int + expectationType byte ) const (