Skip to content

Commit

Permalink
Add import export declaration #59
Browse files Browse the repository at this point in the history
  • Loading branch information
dalance committed Jan 10, 2023
1 parent c71d6d0 commit e7cefa3
Show file tree
Hide file tree
Showing 18 changed files with 16,319 additions and 14,183 deletions.
2 changes: 1 addition & 1 deletion book/theme/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),s.push(e)}
anyNumberOfTimes:d};for(const t in j)"object"==typeof j[t]&&e.exports(j[t])
;return Object.assign(t,j),t})({}),ne=Object.freeze({__proto__:null,
grmr_veryl:e=>({name:"Veryl",aliases:["vl"],case_insensitive:!1,keywords:{
keyword:"module interface function modport package enum struct parameter localparam posedge negedge async_high async_low sync_high sync_low always_ff always_comb assign return var inst logic bit tri u32 u64 i32 i64 f32 f64 input output inout ref if if_reset else for in case for in step repeat",
keyword:"module interface function modport package enum struct parameter localparam posedge negedge async_high async_low sync_high sync_low always_ff always_comb assign return var inst import export logic bit tri u32 u64 i32 i64 f32 f64 input output inout ref if if_reset else for in case for in step repeat",
literal:""},
contains:[e.QUOTE_STRING_MODE,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,{
scope:"number",contains:[e.BACKSLASH_ESCAPE],variants:[{
Expand Down
5 changes: 4 additions & 1 deletion crates/emitter/src/aligner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ impl VerylWalker for Aligner {
self.expression10(&arg.expression10);
for x in &arg.expression09_list {
self.space(1);
self.operator10(&x.operator10);
match &*x.expression09_list_group {
Expression09ListGroup::Operator10(x) => self.operator10(&x.operator10),
Expression09ListGroup::Star(x) => self.star(&x.star),
}
self.space(1);
self.expression10(&x.expression10);
}
Expand Down
34 changes: 33 additions & 1 deletion crates/emitter/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,10 @@ impl VerylWalker for Emitter {
self.expression10(&arg.expression10);
for x in &arg.expression09_list {
self.space(1);
self.operator10(&x.operator10);
match &*x.expression09_list_group {
Expression09ListGroup::Operator10(x) => self.operator10(&x.operator10),
Expression09ListGroup::Star(x) => self.star(&x.star),
}
self.space(1);
self.expression10(&x.expression10);
}
Expand Down Expand Up @@ -1225,6 +1228,35 @@ impl VerylWalker for Emitter {
self.in_function = false;
}

/// Semantic action for non-terminal 'ImportDeclaration'
fn import_declaration(&mut self, arg: &ImportDeclaration) {
self.import(&arg.import);
self.space(1);
self.identifier(&arg.identifier);
self.colon_colon(&arg.colon_colon);
match &*arg.import_declaration_group {
ImportDeclarationGroup::Identifier(x) => self.identifier(&x.identifier),
ImportDeclarationGroup::Star(x) => self.star(&x.star),
}
self.semicolon(&arg.semicolon);
}

/// Semantic action for non-terminal 'ExportDeclaration'
fn export_declaration(&mut self, arg: &ExportDeclaration) {
self.export(&arg.export);
self.space(1);
match &*arg.export_declaration_group {
ExportDeclarationGroup::Identifier(x) => self.identifier(&x.identifier),
ExportDeclarationGroup::Star(x) => self.star(&x.star),
}
self.colon_colon(&arg.colon_colon);
match &*arg.export_declaration_group0 {
ExportDeclarationGroup0::Identifier(x) => self.identifier(&x.identifier),
ExportDeclarationGroup0::Star(x) => self.star(&x.star),
}
self.semicolon(&arg.semicolon);
}

/// Semantic action for non-terminal 'ModuleDeclaration'
fn module_declaration(&mut self, arg: &ModuleDeclaration) {
self.module(&arg.module);
Expand Down
5 changes: 4 additions & 1 deletion crates/formatter/src/aligner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ impl VerylWalker for Aligner {
self.expression10(&arg.expression10);
for x in &arg.expression09_list {
self.space(1);
self.operator10(&x.operator10);
match &*x.expression09_list_group {
Expression09ListGroup::Operator10(x) => self.operator10(&x.operator10),
Expression09ListGroup::Star(x) => self.star(&x.star),
}
self.space(1);
self.expression10(&x.expression10);
}
Expand Down
34 changes: 33 additions & 1 deletion crates/formatter/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ impl VerylWalker for Formatter {
self.expression10(&arg.expression10);
for x in &arg.expression09_list {
self.space(1);
self.operator10(&x.operator10);
match &*x.expression09_list_group {
Expression09ListGroup::Operator10(x) => self.operator10(&x.operator10),
Expression09ListGroup::Star(x) => self.star(&x.star),
}
self.space(1);
self.expression10(&x.expression10);
}
Expand Down Expand Up @@ -1015,6 +1018,35 @@ impl VerylWalker for Formatter {
self.r_brace(&arg.r_brace);
}

/// Semantic action for non-terminal 'ImportDeclaration'
fn import_declaration(&mut self, arg: &ImportDeclaration) {
self.import(&arg.import);
self.space(1);
self.identifier(&arg.identifier);
self.colon_colon(&arg.colon_colon);
match &*arg.import_declaration_group {
ImportDeclarationGroup::Identifier(x) => self.identifier(&x.identifier),
ImportDeclarationGroup::Star(x) => self.star(&x.star),
}
self.semicolon(&arg.semicolon);
}

/// Semantic action for non-terminal 'ExportDeclaration'
fn export_declaration(&mut self, arg: &ExportDeclaration) {
self.export(&arg.export);
self.space(1);
match &*arg.export_declaration_group {
ExportDeclarationGroup::Identifier(x) => self.identifier(&x.identifier),
ExportDeclarationGroup::Star(x) => self.star(&x.star),
}
self.colon_colon(&arg.colon_colon);
match &*arg.export_declaration_group0 {
ExportDeclarationGroup0::Identifier(x) => self.identifier(&x.identifier),
ExportDeclarationGroup0::Star(x) => self.star(&x.star),
}
self.semicolon(&arg.semicolon);
}

/// Semantic action for non-terminal 'ModuleDeclaration'
fn module_declaration(&mut self, arg: &ModuleDeclaration) {
self.module(&arg.module);
Expand Down
Loading

0 comments on commit e7cefa3

Please # to comment.