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
Support anonymous nodes, default ports, JSON IIPs, etc #58
Conversation
I went ahead and implemented a bunch of the other enhancements I wanted. Please let me know what I need to do to get some or all of this merged. |
@@ -136,6 +226,28 @@ describe 'FBP parser', -> | |||
chai.expect(graphData.inports).to.be.an 'undefined' | |||
chai.expect(graphData.outports).to.be.an 'undefined' | |||
|
|||
describe 'with FBP string containing a JSON IIP string', -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test for couple levels of nested object? It is the kind of thing which can easily break, in my experience
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I forgot about this. It should be fine since i'm using peg.js' own JSON grammar, which I assume has been thoroughly tested, but I can do a followup PR to add a test if you want.
Lots of good improvements here. Some quick testing on couple of .fbp heavy projects, and the changes does not seem to break anything, so think we can merge this. In the future please split up PRs a bit, as it is hard to review such big changes. And sometimes one ends up with scenarios where issues with some parts of the PR blocks inclusion of parts without issues. |
Released as Thanks @tlrobinson ! |
Sorry, I am still not clear about the arrows: are you saying that you can leave out the surrounding blanks iff the component name is specified (apparently surrounded by brackets)? Are you allowing hyphens in process names? Is there a clear spec for a) process names and b) port names, or do I have to read the regex to figure it out? Either way, are you allowing Chinese characters in process names? I assume not in port names, as per my earlier post about the discussion with Henri. Just noticed: Humberto Madeira wants hyphens in port names - will that work? |
@jonnor Thanks! I'll try to split things up more next time. @jpaulm It seems like node names can include dashes, but if that's the case you can't leave off spaces around the arrows, i.e. I think in theory you should be able to do For reference: Port name: Line 268 in d53b920
Node name: Line 240 in d53b920
Component name: Line 253 in d53b920
|
For supporting "rich" port names (anything other than
|
This PR does a bunch of things. I can try to split them up into multiple PRs but I'd rather not because some of them are interdependent.
You can now write incredibly succinct networks, e.x.
Allow sending other valid JSON types as IIPs
Resolves #10
You can now do things like:
true
,false
, andnull
don't work because they are valid node names.I'm just using the JSON grammar straight from peg.js' example directory.
Allow anonymous nodes
Resolves #11
Nodes without a name are supported. Internally they are given a unique name based on the component name and index to help debugging.
The
Output
component is internally named_output_1
.Declare components before connecting them
Resolves #12
Lets you declare a component without connecting it immediately:
Parser seems to need blanks around the arrows.
Resolves #21
You can now do
Default Ports
Resolves #32
The port name can be left off in which case it will default to "IN" or "OUT". The following are equivalent:
In certain causes this is not allowed due to ambiguity, e.x.
(A) OUT -> X Y -> (C)
Is X the inport and Y the component, or is X the component and Y the outport?