-
Notifications
You must be signed in to change notification settings - Fork 1
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
"Closure Parameters"(?) #2
Comments
Commit 73b2da2 has handling for this, at least in the first case described above, in which a "closure parameter" has its own The def parse_param_statement(self) -> Union[ast.ParamDecls, ast.FunctionDef]:
"""
Parse a `.param` statement, which defines one of:
* (a) A set of parameter-declaration `ParamDecl`s, or
* (b) A *single* "parameter function" `FunctionDef`.
Netlist syntax mixing the two, e.g.
```
.param a=5 b=6 func(x,y) 'x*a +y*b'
```
is not supported.
"""
self.expect(Tokens.PARAM)
# Parse the first key-name, so we can see what follows
_ = self.parse_ident()
if self.nxt and self.nxt.tp == Tokens.LPAREN:
# This is a function definition.
returnfunc = self.parse_function_def
else: # Otherwise, parse a set of parameter-declarations
returnfunc = lambda: ast.ParamDecls(self.parse_param_declarations())
# Either way, push the first ident back on before calling `returnfunc`
self.rewind()
# And call the parsing function for either the `ParamDecls` or `FunctionDef`
return returnfunc() As noted in that function signature, mixing "value parameters" and "closure parameters" (both made-up names) in the same
is not supported. |
In breaking news to me, parameters of the form of
closure_param
below:I don't know if they give such a thing a name. Here I will call it a "closure parameter", since it looks very much like a function-call which also captures some of its environment.
It is not yet clear whether nesting these among "regular parameters" like so is supported:
The text was updated successfully, but these errors were encountered: