Permalink
Browse files

Switch inports and outports to objects keyed by the public port, refs n…

  • Loading branch information...
1 parent 79bc495 commit 2d1a62f169def4e9a7c0a2982b99782bd1e2396d @bergie bergie committed Feb 18, 2014
Showing with 13 additions and 18 deletions.
  1. +4 −4 grammar/fbp.peg
  2. +4 −4 lib/fbp.js
  3. +5 −10 spec/fbp.coffee
View
@@ -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) {
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -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 = """

0 comments on commit 2d1a62f

Please sign in to comment.