parsecond

package
Version: v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2019 License: MIT Imports: 6 Imported by: 2

Documentation

Overview

Package parsecond parses the condition from the function documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Label string

	// InitStr corresponds to initialization statement in conditions,
	// e.g., given
	// 	_, ok := someMap[3]; ok
	//
	// , the initialization is:
	//	_, ok := someMap[3]
	//
	// See https://golang.org/ref/spec#If_statements
	InitStr string

	CondStr string
	Cond    ast.Expr
}

Condition defines a pre- or a post-condition of the function's contract.

func ToCondition

func ToCondition(text string) (cond *Condition, err error)

ToCondition tries to parse the condition from text.

If no condition could be matched, cond is nil. Err is set if the text matched the bullet format, but there was an error parsing the condition.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL