CreateSpecification creates specification from the given set of tokens.
(tokens []*Token, conceptDictionary *gauge.ConceptDictionary, specFile string)
| 53 | |
| 54 | // CreateSpecification creates specification from the given set of tokens. |
| 55 | func (parser *SpecParser) CreateSpecification(tokens []*Token, conceptDictionary *gauge.ConceptDictionary, specFile string) (*gauge.Specification, *ParseResult, error) { |
| 56 | parser.conceptDictionary = conceptDictionary |
| 57 | specification, finalResult := parser.createSpecification(tokens, specFile) |
| 58 | if err := specification.ProcessConceptStepsFrom(conceptDictionary); err != nil { |
| 59 | return nil, nil, err |
| 60 | } |
| 61 | err := parser.validateSpec(specification) |
| 62 | if err != nil { |
| 63 | finalResult.Ok = false |
| 64 | finalResult.ParseErrors = append([]ParseError{err.(ParseError)}, finalResult.ParseErrors...) |
| 65 | } |
| 66 | return specification, finalResult, nil |
| 67 | } |
| 68 | |
| 69 | func (parser *SpecParser) createSpecification(tokens []*Token, specFile string) (*gauge.Specification, *ParseResult) { |
| 70 | finalResult := &ParseResult{ParseErrors: make([]ParseError, 0), Ok: true} |