get rid of the special keyword syntax
This commit is contained in:
parent
f7d5e53a01
commit
2afafd2bf9
|
@ -9,7 +9,7 @@
|
|||
## Syntax
|
||||
|
||||
```
|
||||
[@pub] [@final] name ["{" args... "}"] = [@cfe] {
|
||||
[pub] [final] name ["{" args... "}"] = [cfe] {
|
||||
content;
|
||||
content;
|
||||
etc;
|
||||
|
@ -19,8 +19,8 @@
|
|||
|
||||
## Attributes of Code Objects
|
||||
|
||||
- `@final` prevents overwriting and basically marks a root
|
||||
- `@cfe` allows an object to access the continuation and omits the default return
|
||||
- `final` prevents overwriting and basically marks a root
|
||||
- `cfe` allows an object to access the continuation and omits the default return
|
||||
|
||||
## Early vs late binding
|
||||
|
||||
|
@ -60,7 +60,7 @@ with package-lock files or such. Packages (packaged module trees) would then be
|
|||
```
|
||||
# 1.
|
||||
|
||||
@final main { args env } = {
|
||||
final main { args env } = {
|
||||
std.io.writeln "Hello World!";
|
||||
0
|
||||
};
|
||||
|
|
|
@ -131,21 +131,6 @@ impl<'a> Iterator for Lexer<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
'@' => {
|
||||
// keyword
|
||||
let ident = self.select_text(1, |i| !i.is_alphanumeric());
|
||||
return Some((
|
||||
loc,
|
||||
match &ident[1..] {
|
||||
"cfe" => Token::CtrlFlowEdit,
|
||||
"defer" => Token::Defer,
|
||||
"final" => Token::Final,
|
||||
"module" => Token::Module,
|
||||
"pub" => Token::Public,
|
||||
_ => Token::Unknown(ident),
|
||||
},
|
||||
));
|
||||
}
|
||||
'0'..='9' => {
|
||||
// integer, unknown base up to 36
|
||||
let start = self.s;
|
||||
|
@ -191,7 +176,14 @@ impl<'a> Iterator for Lexer<'a> {
|
|||
}
|
||||
_ if unicode_ident::is_xid_start(x) => {
|
||||
let ident = self.select_text(0, |i| !unicode_ident::is_xid_continue(i));
|
||||
return Some((loc, Token::Identifier(ident)));
|
||||
return Some((loc, match ident {
|
||||
"cfe" => Token::CtrlFlowEdit,
|
||||
"defer" => Token::Defer,
|
||||
"final" => Token::Final,
|
||||
"module" => Token::Module,
|
||||
"pub" => Token::Public,
|
||||
_ => Token::Identifier(ident),
|
||||
}));
|
||||
}
|
||||
_ if x.is_whitespace() => {
|
||||
self.eat(x.len_utf8());
|
||||
|
|
Loading…
Reference in New Issue