Skip to content

Commit

Permalink
Switch inports and outports to objects keyed by the public port, refs n…
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed Feb 18, 2014
1 parent 79bc495 commit 2d1a62f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
8 changes: 4 additions & 4 deletions grammar/fbp.peg
Expand Up @@ -58,15 +58,15 @@
}
parser.registerInports = function (node, port, pub) {
if (!parser.inports) {
parser.inports = [];
parser.inports = {};
}
parser.inports.push({process:node, port:port.toLowerCase(), public:pub.toLowerCase()})
parser.inports[pub.toLowerCase()] = {process:node, port:port.toLowerCase()}
}
parser.registerOutports = function (node, port, pub) {
if (!parser.outports) {
parser.outports = [];
parser.outports = {};
}
parser.outports.push({process:node, port:port.toLowerCase(), public:pub.toLowerCase()})
parser.outports[pub.toLowerCase()] = {process:node, port:port.toLowerCase()}
}

parser.registerEdges = function (edges) {
Expand Down
8 changes: 4 additions & 4 deletions lib/fbp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 5 additions & 10 deletions spec/fbp.coffee
Expand Up @@ -225,23 +225,18 @@ describe 'FBP parser', ->
process: 'Display'
port: 'in'
it 'should contain two inports', ->
chai.expect(graphData.inports).to.be.an 'array'
chai.expect(graphData.inports.length).to.equal 2
chai.expect(graphData.inports[0]).to.eql
chai.expect(graphData.inports).to.be.an 'object'
chai.expect(graphData.inports.filename).to.eql
process: 'Read'
port: 'in'
public: 'filename'
chai.expect(graphData.inports[1]).to.eql
chai.expect(graphData.inports.options).to.eql
process: 'Display'
port: 'options'
public: 'options'
it 'should contain an outport', ->
chai.expect(graphData.outports).to.be.an 'array'
chai.expect(graphData.outports.length).to.equal 1
chai.expect(graphData.outports[0]).to.eql
chai.expect(graphData.outports).to.be.an 'object'
chai.expect(graphData.outports.out).to.eql
process: 'Display'
port: 'out'
public: 'out'

describe 'with FBP string with legacy EXPORTs', ->
fbpData = """
Expand Down

0 comments on commit 2d1a62f

Please sign in to comment.