package future

import "github.com/open-policy-agent/opa/internal/future"

Index

Functions

func FilterFutureImports

func FilterFutureImports(imps []*ast.Import) []*ast.Import

FilterFutureImports filters OUT any future imports from the passed slice of `*ast.Import`s.

func IsAllFutureKeywords

func IsAllFutureKeywords(imp *ast.Import) bool

IsAllFutureKeywords returns true if the passed *ast.Import is `future.keywords`

func IsFutureKeyword

func IsFutureKeyword(imp *ast.Import, kw string) bool

IsFutureKeyword returns true if the passed *ast.Import is `future.keywords.{kw}`

func ParserOptionsFromFutureImports

func ParserOptionsFromFutureImports(imports []*ast.Import) (ast.ParserOptions, error)

ParserOptionsFromFutureImports transforms a slice of `ast.Import`s into the `ast.ParserOptions` that can be used to parse a statement according to the included "future.keywords" and "future.keywords.xyz" imports.

func WhichFutureKeyword

func WhichFutureKeyword(imp *ast.Import) (string, bool)

Source Files

filter_imports.go parser_opts.go

Version
v1.4.2 (latest)
Published
May 2, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
6 hours ago

Tools for package owners.