Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:ben-marshall/verilog-parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-marshall committed Jul 13, 2016
2 parents 3fe3bd0 + ef5efbf commit 06e4c86
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/verilog_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,7 @@ ast_port_declaration * ast_new_port_declaration(
ast_list * port_names //!< [in] The names of the ports.
){
ast_port_declaration * tr = ast_calloc(1,sizeof(ast_port_declaration));

tr -> direction = direction ;
tr -> net_type = net_type ;
tr -> net_signed = net_signed ;
Expand Down Expand Up @@ -2141,9 +2141,12 @@ ast_identifier ast_new_identifier(
unsigned int from_line
){
ast_identifier tr = ast_calloc(1,sizeof(struct ast_identifier_t));

size_t length = strlen(identifier);
tr -> identifier = calloc(length, sizeof(char));
strcat(tr -> identifier, identifier);

tr -> from_line = from_line;
tr -> identifier = identifier;
tr -> type = ID_UNKNOWN;
tr -> next = NULL;
tr -> range_or_idx = ID_HAS_NONE;
Expand Down
1 change: 0 additions & 1 deletion src/verilog_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ as well as an easy way to change the input stream.
#include "stdio.h"

// Essential to make sure we have access to all of the yy functions.
#include "verilog_parser.tab.h"
#include "verilog_preprocessor.h"

#ifndef H_VERILOG_PARSER
Expand Down
20 changes: 15 additions & 5 deletions src/verilog_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -1146,24 +1146,34 @@ port_declarations :

port_declaration_l:
net_type_o signed_o range_o port_identifier{
ast_list * names = ast_list_new();
ast_list_append(names, $4);
$$ = ast_new_port_declaration(PORT_NONE, $1, $2,
AST_FALSE,AST_FALSE,NULL,$3);
AST_FALSE,AST_FALSE,NULL,names);
}
| signed_o range_o port_identifier{
ast_list * names = ast_list_new();
ast_list_append(names, $3);
$$ = ast_new_port_declaration(PORT_NONE, NET_TYPE_NONE, $1,
AST_FALSE,AST_FALSE,NULL,$3);
AST_FALSE,AST_FALSE,NULL,names);
}
| KW_REG signed_o range_o port_identifier eq_const_exp_o{
ast_list * names = ast_list_new();
ast_list_append(names, $4);
$$ = ast_new_port_declaration(PORT_NONE, NET_TYPE_NONE, AST_FALSE,
AST_TRUE,AST_FALSE,NULL,$4);
AST_TRUE,AST_FALSE,NULL,names);
}
| output_variable_type_o port_identifier{
ast_list * names = ast_list_new();
ast_list_append(names, $2);
$$ = ast_new_port_declaration(PORT_NONE, NET_TYPE_NONE, AST_FALSE,
AST_FALSE,AST_TRUE,NULL,$2);
AST_FALSE,AST_TRUE,NULL,names);
}
| output_variable_type port_identifier eq_const_exp_o{
ast_list * names = ast_list_new();
ast_list_append(names, $2);
$$ = ast_new_port_declaration(PORT_NONE, NET_TYPE_NONE, AST_FALSE,
AST_FALSE,AST_TRUE,NULL,$2);
AST_FALSE,AST_TRUE,NULL,names);
}
;

Expand Down

0 comments on commit 06e4c86

Please sign in to comment.