diff options
| author | Austin Clements <austin@google.com> | 2025-08-28 21:40:57 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-10-21 14:49:10 -0700 |
| commit | 4e695dd6346e5c7f7e94f54ed177ef96249d2294 (patch) | |
| tree | 679a777b70dceb6462605c8acb7d17bac19374b8 /api | |
| parent | 06e57e60a7ff6cbc9c608278cbac4db514c7161a (diff) | |
| download | go-4e695dd6346e5c7f7e94f54ed177ef96249d2294.tar.xz | |
go/ast: add ParseDirective for parsing directive comments
This adds an ast.Directive API for parsing directive comments such as
"//go:build" and "//go:embed".
This will help tools standardize the syntax of these directive
comments. Even within the standard Go tools there's little agreement
on the finer details of the syntax of directives today.
Fixes #68021.
Change-Id: I84a988a667682c9ac70632df6e925461ac95e381
Reviewed-on: https://go-review.googlesource.com/c/go/+/704835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'api')
| -rw-r--r-- | api/next/68021.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/api/next/68021.txt b/api/next/68021.txt new file mode 100644 index 0000000000..46156e0665 --- /dev/null +++ b/api/next/68021.txt @@ -0,0 +1,13 @@ +pkg go/ast, func ParseDirective(token.Pos, string) (Directive, bool) #68021 +pkg go/ast, method (*Directive) End() token.Pos #68021 +pkg go/ast, method (*Directive) ParseArgs() ([]DirectiveArg, error) #68021 +pkg go/ast, method (*Directive) Pos() token.Pos #68021 +pkg go/ast, type Directive struct #68021 +pkg go/ast, type Directive struct, Args string #68021 +pkg go/ast, type Directive struct, ArgsPos token.Pos #68021 +pkg go/ast, type Directive struct, Name string #68021 +pkg go/ast, type Directive struct, Slash token.Pos #68021 +pkg go/ast, type Directive struct, Tool string #68021 +pkg go/ast, type DirectiveArg struct #68021 +pkg go/ast, type DirectiveArg struct, Arg string #68021 +pkg go/ast, type DirectiveArg struct, Pos token.Pos #68021 |
