-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix expression #66
base: master
Are you sure you want to change the base?
fix expression #66
Conversation
// "signal input" --> Some(true) | ||
// "signal output" --> Some(false) | ||
// [N][M-1] | ||
fn array(p: &mut Parser) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we should rename this to array_query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we should rename this to array_query?
I don't understand the meaning of "array_query".
This function's use case is parsing [N][M-1] from a (multi-dimensional) array input[N][M-1]
.
fn array(p: &mut Parser) -> bool { | ||
let is_array = p.at(LBracket); | ||
|
||
while p.at(LBracket) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use why here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use why here?
For multi-dimensional array
|
||
let res = if p.at(InputKw) { | ||
Some(true) | ||
} else if p.at(OutputKw) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we use match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we use match?
You mean:
let result = match p.current() {
InputKw => Some(true),
OutputKw => Some(false),
_ => None
};
It is also another way (replace .at()
with .current()
). I will change it if you prefer.
p.close(m, SignalHeader); | ||
res | ||
} | ||
|
||
pub(crate) fn var_init(p: &mut Parser) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give example here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give example here?
// eg: tmp = 10;
|
||
p.expect(RParen); | ||
|
||
// p.close(m, ExpressionList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we don't create AST not for those function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we don't create AST not for those function?
Can you explain your comment?
Update crates/lsp/src/global_state.rs Co-authored-by: Vu Vo <[email protected]>
c6dcb66
to
783f2a7
Compare
out[k] * (out[k] - 1) === 0