parser: rename main function to __rayoko_main
This commit is contained in:
parent
f00741deca
commit
88e505b524
4 changed files with 11 additions and 2 deletions
|
@ -30,5 +30,5 @@ fn add(a: i32, b: i32) i32 {
|
|||
}
|
||||
|
||||
fn main() i32 {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
BIN
hello
BIN
hello
Binary file not shown.
3
src/entry.c
Normal file
3
src/entry.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
int main(void) {
|
||||
__rayoko_main();
|
||||
}
|
|
@ -464,7 +464,13 @@ pub const Parser = struct {
|
|||
method = try self.parsePreMethod();
|
||||
}
|
||||
|
||||
const name = try self.consumeSingle(.Identifier);
|
||||
const orig_name = try self.consumeSingle(.Identifier);
|
||||
|
||||
const name = if (std.mem.eql(u8, orig_name.lexeme, "main")) blk: {
|
||||
break :blk try self.mkToken(.Identifier, "__rayoko_main", orig_name.line);
|
||||
} else blk: {
|
||||
break :blk orig_name;
|
||||
};
|
||||
|
||||
self.setErrContext("function {}", name.lexeme);
|
||||
|
||||
|
|
Loading…
Reference in a new issue