func (parser *SpecParser) CreateSpecification(tokens []*Token, conceptDictionary *gauge.ConceptDictionary, specFile string) (*gauge.Specification, *ParseResult, error) {
	parser.conceptDictionary = conceptDictionary
	specification, finalResult := parser.createSpecification(tokens, specFile)
	if err := specification.ProcessConceptStepsFrom(conceptDictionary); err != nil {
		return nil, nil, err
	}
	err := parser.validateSpec(specification)
	if err != nil {
		finalResult.Ok = false
		finalResult.ParseErrors = append([]ParseError{err.(ParseError)}, finalResult.ParseErrors...)
	}
	return specification, finalResult, nil
}
CreateSpecification creates specification from the given set of tokens.
package parser
import (
	"bufio"
	"strings"
	"github.com/getgauge/gauge/gauge"
)
type SpecParser struct {
	scanner           *bufio.Scanner
	lineNo            int
	tokens            []*Token
	currentState      int
	processors        map[gauge.TokenKind]func(*SpecParser, *Token) ([]error, bool)
	conceptDictionary *gauge.ConceptDictionary
}
func (parser *SpecParser) Parse(specText string, conceptDictionary *gauge.ConceptDictionary, specFile string) (*gauge.Specification, *ParseResult, error) {
	tokens, errs := parser.GenerateTokens(specText, specFile)
	spec, res, err := parser.CreateSpecification(tokens, conceptDictionary, specFile)
	if err != nil {
		return nil, nil, err
	}
	res.FileName = specFile
	if len(errs) > 0 {
		res.Ok = false
	}
	res.ParseErrors = append(errs, res.ParseErrors...)
	return spec, res, nil
}
func (parser *SpecParser) ParseSpecText(specText string, specFile string) (*gauge.Specification, *ParseResult) {
	tokens, errs := parser.GenerateTokens(specText, specFile)
	spec, res := parser.createSpecification(tokens, specFile)
	res.FileName = specFile
	if len(errs) > 0 {
		res.Ok = false
	}
	res.ParseErrors = append(errs, res.ParseErrors...)
	return spec, res
}