Closed richq closed 9 years ago
I might add that use "_" character in variable and function names can not. This is not very convenient.
Yeah, but bish just doesn't like the and tells you so "Unhandled token character at character '', line 4". That seems like a different issue to me "let me use _ in variable and function names".
in the case of:
def f(n) {
return 8(n);
}
the problem lies in Parser.cpp Parser::factor()
IRNode *a = atom(); // a is created as integer.
if (tokenizer->peek().isa(Token::LParenType)) {
Variable *v = static_cast<Variable*>(a); // casting it to Variable, Name is not initialized!!
// The symbol will be reinserted as a Function, not a Variable.
remove_from_symbol_table(v->name);
a = funcall(v->name); // !!! CRASH IN FUNCALL
}
The checker pass has not run at this point and the types are all undefined.
@richq can you verify that it's fixed? I actually wasn't seeing a segfault on my system.
@digitalsurgeon thanks very much for tracking that down. Made fixing it trivial :-).
@eg0r With commit 9214bce underscores are now allowed.
@tdenniston Thanks!
Confirmed, no longer crashes.
Here's a messed up bit of code that causes bish to segfault:
An "invalid token type for atom" or similar error would be OK, I don't expect the code to actually work since numbers are used for argument passing in the compiled shell code.