unsigned slashes = 0;
while(iter!=source.end())
{
- //IO::print("%d '%c'\n", comment, *iter);
if(comment==0)
{
if(*iter=='/')
func->return_type = expect_type();
func->name = expect_identifier();
- parse_function_parameter_list(*func);
+ expect("(");
+ while(peek_token()!=")")
+ {
+ if(!func->parameters.empty())
+ expect(",");
+
+ RefPtr<VariableDeclaration> var = new VariableDeclaration;
+ var->type = expect_type();
+ var->name = expect_identifier();
+ func->parameters.push_back(var.release());
+ }
+ expect(")");
string token = peek_token();
if(token=="{")
return func.release();
}
-void ProgramParser::parse_function_parameter_list(FunctionDeclaration &func)
-{
- expect("(");
- while(peek_token()!=")")
- {
- if(!func.parameters.empty())
- expect(",");
-
- RefPtr<VariableDeclaration> var = new VariableDeclaration;
- var->type = expect_type();
- var->name = expect_identifier();
- func.parameters.push_back(var.release());
- }
- expect(")");
-}
-
InterfaceBlock *ProgramParser::parse_interface_block()
{
RefPtr<InterfaceBlock> iface = new InterfaceBlock;
{
expect("return");
RefPtr<Return> ret = new Return;
- ret->expression = parse_expression();
+ if(peek_token()!=";")
+ ret->expression = parse_expression();
expect(";");
return ret.release();
}