Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser generates bogus process on IIP to undeclared process #1

Open
ERnsTL opened this issue Jun 3, 2017 · 0 comments
Open

Parser generates bogus process on IIP to undeclared process #1

ERnsTL opened this issue Jun 3, 2017 · 0 comments

Comments

@ERnsTL
Copy link

ERnsTL commented Jun 3, 2017

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant