Skip to content

Conversation

@NTTVy03
Copy link
Collaborator

@NTTVy03 NTTVy03 commented Jan 6, 2025

  1. fix error parse out[k] * (out[k] - 1) === 0
  2. re-arrange token kinds
  3. extract tuple expression, tuple identifier and list identifier

Update crates/lsp/src/global_state.rs

Co-authored-by: Vu Vo <vu.voth@gmail.com>
Comment on lines 56 to 84
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
Copy link
Owner

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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let _ = array(p);
array(p);

expression(p);

// there are no expressions remaining
if p.eat(Comma) == false {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if p.eat(Comma) == false {
if !p.eat(Comma) {

}

/**
* grammar: "[iden1, iden2,..., idenn]"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* grammar: "[iden1, iden2,..., idenn]"
* grammar: "[iden1, iden2,..., idenn]"
Only use in main component.

log()
log(<pattern1>, <pattern2>, ... <patternn>)
*/
fn log_statement(p: &mut Parser) {
Copy link
Owner

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!

@NTTVy03 NTTVy03 merged commit 27a2d8c into master Feb 9, 2025
1 check passed
NTTVy03 added a commit that referenced this pull request Feb 9, 2025
@NTTVy03 NTTVy03 deleted the fix-expression branch May 18, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants