diff --git a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/editor/Editor.java index c242bcc..2c45b8d 100644 --- a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/editor/Editor.java @@ -171,9 +171,9 @@ if(extension.contains(".model")) { openModel(file); } else { - ParserDTRAM parserDTRAM = new ParserDTRAM(); + ParserDTRAM parserDTRAM = new ParserDTRAM(new BufferedReader(new FileReader(file))); try { - model = parserDTRAM.doParseModel(new BufferedReader(new FileReader(file))); + model = parserDTRAM.doParseModel(); graph = constructGraph(model); parserDTRAM.doParseGeometry(graph); curFilePath = file.getAbsolutePath(); @@ -197,10 +197,10 @@ public DataFlowModel openModel(File file) { try { - Parser parser = new Parser(); + Parser parser = new Parser(new BufferedReader(new FileReader(file))); try { - model = parser.doParse(new BufferedReader(new FileReader(file))); + model = parser.doParse(); curFilePath = file.getAbsolutePath(); curFileName = file.getName(); if (!UpdateConflictCheck.run(model)) return null; @@ -590,14 +590,14 @@ public void setChannelCode(DataflowChannelGenerator ch, String code) { ch.setSourceText(code); - Parser parser = new Parser(); - TokenStream stream = parser.new TokenStream(); - + TokenStream stream = new Parser.TokenStream(); + Parser parser = new Parser(stream); + for (String line: code.split("\n")) { stream.addLine(line); } try { - DataflowChannelGenerator ch2 = parser.parseChannel(stream, getModel()); + DataflowChannelGenerator ch2 = parser.parseChannel(getModel()); for (ChannelMember chm2: ch2.getInputChannelMembers()) { for (ChannelMember chm: ch.getInputChannelMembers()) { if (chm2.getIdentifierTemplate() == chm.getIdentifierTemplate()) {