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

Errors related to parenthesis matching? #13

Closed
vanderaalle opened this issue Jul 22, 2014 · 4 comments
Closed

Errors related to parenthesis matching? #13

vanderaalle opened this issue Jul 22, 2014 · 4 comments

Comments

@vanderaalle
Copy link

Hi Chris, I'm evaluating the following func from a project I wrote.
The func is syntactically correct and gets interpreted in standard IDE.
When I evaluate it in Atom I get a syntax error: expecting '}'

~readAndRaw = {|sourceName|

var bpm = 60 ;
var grid, maxDur ;
// 1: read and filter
var sourceFile = File(sourceName, "r") ;

var score = sourceFile.readAllString.split($\n)
.collect{|i| i.split($ )}
.select{|i| i.size > 1} ;
sourceFile.close ;
score = score
// comments, any not instr is rejected
.reject{|i| ~instr.includes(i[0].asSymbol).not}
.flop;
// 2: convert data
score = [
score[0].collect{|i|
~instr.indexOf(
i.asSymbol
)}, // names, already clean
score[1].collect{|i|
if (i.includes($/)) {i.interpret.asFloat_4_(60/bpm)}
{i.asFloat}
},
score[2].collect{|i|
if (i.includes($/)) {i.interpret.asFloat_4_(60/bpm)}
{i.asFloat}
},
score[3].asFloat, score[4].asFloat
].flop ;

}

@crucialfelix
Copy link
Owner

I think it has to do with stripping newlines out. I have a solution to
try. It would encode the newlines instead of stripping them. Or maybe send
the string and evaluate that instead of trying to feed stdin directly.
On Jul 23, 2014 1:08 AM, "vanderaalle" notifications@github.com wrote:

Hi Chris, I'm evaluating the following func from a project I wrote.
The func is syntactically correct and gets interpreted in standard IDE.
When I evaluate it in Atom I get a syntax error: expecting '}'

~readAndRaw = {|sourceName|

var bpm = 60 ;
var grid, maxDur ;
// 1: read and filter
var sourceFile = File(sourceName, "r") ;

var score = sourceFile.readAllString.split($\n)
.collect{|i| i.split($ )}
.select{|i| i.size > 1} ;
sourceFile.close ;
score = score
// comments, any not instr is rejected
.reject{|i| ~instr.includes(i[0].asSymbol).not}
.flop;
// 2: convert data
score = [
score[0].collect{|i|
~instr.indexOf(
i.asSymbol
)}, // names, already clean
score[1].collect{|i|
if (i.includes($/)) {i.interpret.asFloat_4_(60/bpm)}
{i.asFloat}
},
score[2].collect{|i|
if (i.includes($/)) {i.interpret.asFloat_4_(60/bpm)}
{i.asFloat}
},
score[3].asFloat, score[4].asFloat
].flop ;

}


Reply to this email directly or view it on GitHub
#13.

@crucialfelix
Copy link
Owner

yes, it was the
// comment lines
that broke it.

now I am escaping the newlines and unescaping them before interpreting them

@crucialfelix
Copy link
Owner

update your package to check

@vanderaalle
Copy link
Author

Thanks Chris, works

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

2 participants