github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/asm/internal/lex/stack.go (about) 1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package lex 6 7 import ( 8 "github.com/shogo82148/std/cmd/internal/src" 9 ) 10 11 // A Stack is a stack of TokenReaders. As the top TokenReader hits EOF, 12 // it resumes reading the next one down. 13 type Stack struct { 14 tr []TokenReader 15 } 16 17 // Push adds tr to the top (end) of the input stack. (Popping happens automatically.) 18 func (s *Stack) Push(tr TokenReader) 19 20 func (s *Stack) Next() ScanToken 21 22 func (s *Stack) Text() string 23 24 func (s *Stack) File() string 25 26 func (s *Stack) Base() *src.PosBase 27 28 func (s *Stack) SetBase(base *src.PosBase) 29 30 func (s *Stack) Line() int 31 32 func (s *Stack) Col() int 33 34 func (s *Stack) Close()