-
Notifications
You must be signed in to change notification settings - Fork 2
fix expression #66
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
Conversation
Update crates/lsp/src/global_state.rs Co-authored-by: Vu Vo <vu.voth@gmail.com>
c6dcb66 to
783f2a7
Compare
| pub(crate) fn var_init(p: &mut Parser) { | ||
| let var_identifier_open_marker = p.open(); | ||
|
|
||
| // name of variable | ||
| p.expect(Identifier); | ||
| // eg: [N - 1][M] | ||
| array(p); | ||
|
|
||
| p.close(var_identifier_open_marker, VarIdentifier); | ||
|
|
||
| // assign for variable | ||
| // eg: = 10 | ||
| if p.at_var_assign() { | ||
| p.advance(); | ||
| expression(p); | ||
| } | ||
| } | ||
|
|
||
| // eg: in[N - 1] <== c.in; | ||
| pub(crate) fn signal_init(p: &mut Parser, assign_able: bool) { | ||
| let signal_identifier_open_marker = p.open(); | ||
| // name of signal | ||
| p.expect(Identifier); | ||
| // eg: [N][M-1] | ||
| array(p); | ||
| p.close(signal_identifier_open_marker, SignalIdentifier); | ||
|
|
||
| // assign for intermediate and outputs signals | ||
| // eg: <== Multiplier2().out |
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.
Duplicate logic. We can make it simple.
|
|
||
| // support array component | ||
| // eg: comp[N - 1][10] | ||
| let _ = array(p); |
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.
| let _ = array(p); | |
| array(p); | |
crates/parser/src/grammar/list.rs
Outdated
| expression(p); | ||
|
|
||
| // there are no expressions remaining | ||
| if p.eat(Comma) == false { |
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.
| if p.eat(Comma) == false { | |
| if !p.eat(Comma) { | |
| } | ||
|
|
||
| /** | ||
| * grammar: "[iden1, iden2,..., idenn]" |
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.
| * grammar: "[iden1, iden2,..., idenn]" | |
| * grammar: "[iden1, iden2,..., idenn]" | |
| Only use in main component. |
| log() | ||
| log(<pattern1>, <pattern2>, ... <patternn>) | ||
| */ | ||
| fn log_statement(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.
Add tests for this one!
out[k] * (out[k] - 1) === 0