Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommentPart ¶
func Parse ¶
func Parse(parser *TypeParser, doc string) (res []CommentPart)
Parse returns parsed doc comment with interesting parts (ones that start "* @")
type ExprKind ¶ added in v0.3.0
type ExprKind uint8
const ( // ExprInvalid represents "failed to parse" type expression. ExprInvalid ExprKind = iota // ExprUnknown is a garbage-prefixed type expression. // Examples: `-int` `@@\Foo[]` // Args[0] - a valid expression that follows invalid prefix ExprUnknown // ExprName is a type that is identified by its name. // Examples: `int` `\Foo\Bar` `$this` ExprName // ExprKeyword is a special name-like type node. // Examples: `*` `...` ExprSpecialName // ExprInt is a digit-only type expression. // Examples: `0` `10` ExprInt // ExprKeyVal is `key:val` type. // Examples: `name: string` `id:int` // Args[0] - key expression (left) // Args[1] - val expression (right) ExprKeyVal // ExprMemberType is access to member. // Examples: `\Foo::SOME_CONSTANT` `\Foo::$a` // Args[0] - class type expression (left) // Args[1] - member name expression (right) ExprMemberType // ExprArray is `elem[]` or `[]elem` type. // Examples: `int[]` `(int|float)[]` `int[` // Args[0] - array element type // ShapeArrayPrefix: `[]T` // // Note: may miss second `]`. ExprArray // ExprParen is `(expr)` type. // Examples: `(int)` `(\Foo\Bar[])` `(int` // Args[0] - enclosed type // // Note: may miss closing `)`. ExprParen // ExprNullable is `?expr` type. // Examples: `?int` `?\Foo` // Args[0] - nullable element type ExprNullable // ExprOptional is `expr?` type. // Examples: `k?: int` // Args[0] - optional element type ExprOptional // ExprNot is `!expr` type. // Examples: `!int` `!(int|float)` // Args[0] - negated element type // // Note: only valid for phpgrep type filters. ExprNot // ExprUnion is `x|y` type. // Examples: `T1|T2` `int|float[]|false` // Args - type variants ExprUnion // ExprInter is `x&y` type. // Examples: `T1&T2` `I1&I2&I3` ExprInter // ExprGeneric is a parametrized `expr<T,...>` type. // Examples: `\Collection<T>` `Either<int[], false>` `Bad<int` // Args[0] - parametrized type // Args[1:] - type parameters // ShapeGenericParen: `T(X,Y)` // ShapeGenericBrace: `T{X,Y}` // // Note: may miss closing `>`. ExprGeneric // ExprTypedCallable is a parametrized `callable(A,...):B` type. // Examples: `callable():void` `callable(int, int) : float` // Args[0] - return type // Args[1:] - argument types ExprTypedCallable )
type RawCommentPart ¶ added in v0.3.0
type RawCommentPart struct {
Params []string // {"something", "bla-bla-bla"} in example above
ParamsText string // "something bla-bla-bla" in example above
// contains filtered or unexported fields
}
func (*RawCommentPart) Line ¶ added in v0.3.0
func (c *RawCommentPart) Line() int
func (*RawCommentPart) Name ¶ added in v0.3.0
func (c *RawCommentPart) Name() string
type TypeCommentPart ¶ added in v0.3.0
func (*TypeCommentPart) Line ¶ added in v0.3.0
func (c *TypeCommentPart) Line() int
func (*TypeCommentPart) Name ¶ added in v0.3.0
func (c *TypeCommentPart) Name() string
type TypeExpr ¶ added in v0.2.0
type TypeParser ¶ added in v0.2.0
type TypeParser struct {
// contains filtered or unexported fields
}
func NewTypeParser ¶ added in v0.3.0
func NewTypeParser() *TypeParser
func (*TypeParser) Parse ¶ added in v0.3.0
func (p *TypeParser) Parse(s string) Type
type TypeVarCommentPart ¶ added in v0.3.0
type TypeVarCommentPart struct {
VarIsFirst bool
Var string
Type Type
Rest string
// contains filtered or unexported fields
}
func (*TypeVarCommentPart) Line ¶ added in v0.3.0
func (c *TypeVarCommentPart) Line() int
func (*TypeVarCommentPart) Name ¶ added in v0.3.0
func (c *TypeVarCommentPart) Name() string
Click to show internal directories.
Click to hide internal directories.