@@ -43,7 +43,7 @@ func newScanner(r io.Reader) *scanner {
4343// scan returns the next token and position from the underlying reader.
4444// Also returns the literal text read for strings, numbers, and duration tokens
4545// since these token types can have different literal representations.
46- func (s * scanner ) scan () (tok token , pos int , lit string ) {
46+ func (s * scanner ) scan () (tok Token , pos int , lit string ) {
4747 // Read next code point.
4848 ch0 , pos := s .r .read ()
4949
@@ -124,7 +124,7 @@ func (s *scanner) scan() (tok token, pos int, lit string) {
124124}
125125
126126// scanWhitespace consumes the current rune and all contiguous whitespace.
127- func (s * scanner ) scanWhitespace () (tok token , pos int , lit string ) {
127+ func (s * scanner ) scanWhitespace () (tok Token , pos int , lit string ) {
128128 // Create a buffer and read the current character into it.
129129 var buf bytes.Buffer
130130 ch , pos := s .r .curr ()
@@ -147,7 +147,7 @@ func (s *scanner) scanWhitespace() (tok token, pos int, lit string) {
147147 return WS , pos , buf .String ()
148148}
149149
150- func (s * scanner ) scanIdent () (tok token , pos int , lit string ) {
150+ func (s * scanner ) scanIdent () (tok Token , pos int , lit string ) {
151151 // Save the starting position of the identifier.
152152 _ , pos = s .r .read ()
153153 s .r .unread ()
@@ -180,7 +180,7 @@ func (s *scanner) scanIdent() (tok token, pos int, lit string) {
180180}
181181
182182// scanNumber consumes anything that looks like the start of a number.
183- func (s * scanner ) scanNumber () (tok token , pos int , lit string ) {
183+ func (s * scanner ) scanNumber () (tok Token , pos int , lit string ) {
184184 var buf bytes.Buffer
185185
186186 // Check if the initial rune is a ".".
@@ -322,7 +322,7 @@ func scanBareIdent(r io.RuneScanner) string {
322322
323323// scanString consumes a contiguous string of non-quote characters.
324324// Quote characters can be consumed if they're first escaped with a backslash.
325- func (s * scanner ) scanString () (tok token , pos int , lit string ) {
325+ func (s * scanner ) scanString () (tok Token , pos int , lit string ) {
326326 s .r .unread ()
327327 _ , pos = s .r .curr ()
328328
@@ -384,7 +384,7 @@ type bufScanner struct {
384384 i int // buffer index
385385 n int // buffer size
386386 buf [3 ]struct {
387- tok token
387+ tok Token
388388 pos int
389389 lit string
390390 }
@@ -396,12 +396,12 @@ func newBufScanner(r io.Reader) *bufScanner {
396396}
397397
398398// scan reads the next token from the scanner.
399- func (s * bufScanner ) scan () (tok token , pos int , lit string ) {
399+ func (s * bufScanner ) scan () (tok Token , pos int , lit string ) {
400400 return s .scanFunc (s .s .scan )
401401}
402402
403403// scanFunc uses the provided function to scan the next token.
404- func (s * bufScanner ) scanFunc (scan func () (token , int , string )) (tok token , pos int , lit string ) {
404+ func (s * bufScanner ) scanFunc (scan func () (Token , int , string )) (tok Token , pos int , lit string ) {
405405 // If we have unread tokens then read them off the buffer first.
406406 if s .n > 0 {
407407 s .n --
@@ -420,7 +420,7 @@ func (s *bufScanner) scanFunc(scan func() (token, int, string)) (tok token, pos
420420func (s * bufScanner ) unscan () { s .n ++ }
421421
422422// curr returns the last read token.
423- func (s * bufScanner ) curr () (tok token , pos int , lit string ) {
423+ func (s * bufScanner ) curr () (tok Token , pos int , lit string ) {
424424 buf := & s .buf [(s .i - s .n + len (s .buf ))% len (s .buf )]
425425 return buf .tok , buf .pos , buf .lit
426426}
0 commit comments