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

Update grammar for func in WIT.md #238

Merged
merged 3 commits into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ union-cases ::= ty,
| ty ',' union-cases?
```

## Item: `function`
## Item: `func`

Functions can also be defined in a `*.wit` document. Functions have a name,
parameters, and results. Functions can optionally also be declared as `async`
Expand All @@ -383,7 +383,7 @@ sleep: async func(ms: u64)
Specifically functions have the structure:

```wit
func-item ::= id ':' 'async'? 'function' '(' func-args ')' func-ret
func-item ::= id ':' 'async'? 'func' '(' func-args ')' func-ret

func-args ::= func-arg
| func-arg ',' func-args?
Expand Down
2 changes: 1 addition & 1 deletion crates/parser/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl<'a> Item<'a> {
Some((_span, Token::Id)) | Some((_span, Token::ExplicitId)) => {
Value::parse(tokens, docs).map(Item::Value)
}
other => Err(err_expected(tokens, "`type`, `resource`, or `fn`", other).into()),
other => Err(err_expected(tokens, "`type`, `resource`, or `func`", other).into()),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/wit-bindgen-demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h1>Input <code>*.wit</code></h1>
name: string,
age: u32,
}
hello: function(who: person) -&gt; string
hello: func(who: person) -&gt; string
</textarea>
</div>
<div class='area'>
Expand Down