Skip to content

Parser generates bogus process on IIP to undeclared process #1

Description

@ERnsTL

Greetings,

The parser generates a wrong entry for an undeclared process, if an IIP is being sent to that name.

Minimal test program:

package main

import (
	"github.com/oleksandr/fbp"
	"fmt"
)

func main() {
	var graph string = `
		'5s' -> INTERVAL Ticker(core/ticker) OUT -> IN Forward(core/passthru)
		Forward OUT -> IN Log(core/console)
		'some IIP data' -> CONF Nonexistant`

	parser := &fbp.Fbp{Buffer: graph}
	parser.Init()
	err := parser.Parse()
	if err != nil {
		fmt.Println("ERROR:", err)
		return
	}
	parser.Execute()
	if err = parser.Validate(); err != nil {
		fmt.Println("ERROR:", err)
		return
	}
	fmt.Println("Processes:", parser.Processes)
}

Note that the component Nonexistant was never declared, but an IIP sent to it.

Compile and run with, for example:

GOPATH=`pwd` go build parsertestiip.go && ./parsertestiip

Current output:

Processes: [Ticker(core/ticker) Forward(core/passthru) Log(core/console) Nonexistant(core/console)]

The component path core/console for component Nonexistant is wrong IMO, because that process was never declared and that component path never given.

Expected output:

Processes: [Ticker(core/ticker) Forward(core/passthru) Log(core/console) Nonexistant()]

= for example, the process component should be empty - or some other way to detect / know that the process Nonexistant was never declared. Then I check if fbp.Process.Component = component binary path is empty, and if it is, display an error message, e.g. "IIP to undeclared process X".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions