mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 15:16:33 -08:00
29 lines
413 B
Go
29 lines
413 B
Go
package parser
|
|
|
|
import (
|
|
"github.com/aquasecurity/trivy/pkg/licensing/expression/token"
|
|
)
|
|
|
|
type Pair struct {
|
|
root *LicenseExpression
|
|
cursor *LicenseExpression
|
|
bracket token.TokenType
|
|
}
|
|
|
|
type Stack []Pair
|
|
|
|
func (s *Stack) Push(x Pair) {
|
|
*s = append(*s, x)
|
|
}
|
|
|
|
func (s *Stack) Pop() Pair {
|
|
l := len(*s)
|
|
x := (*s)[l-1]
|
|
*s = (*s)[:l-1]
|
|
return x
|
|
}
|
|
|
|
func (s *Stack) IsEmpty() bool {
|
|
return len(*s) == 0
|
|
}
|