@@ -765,7 +765,7 @@ static std::pair<int, int> process_instance_string(pugi::xml_node Locations,
765
765
const pugiutil::loc_data& loc_data) {
766
766
Tokens tokens (pin_loc_string);
767
767
768
- int token_index = 0 ;
768
+ size_t token_index = 0 ;
769
769
t_token token = tokens[token_index];
770
770
771
771
if (token.type != e_token_type::STRING || std::string (token.data ) != sub_tile.name ) {
@@ -858,14 +858,14 @@ static std::pair<int, int> process_pin_string(pugi::xml_node Locations,
858
858
}
859
859
860
860
token_index++;
861
- token = tokens[token_index];
861
+ t_token token = tokens[token_index];
862
862
863
863
// If the string contains index for capacity range, e.g., io[3:3].in[0:5], we skip the capacity range here.
864
- if (token.type == TOKEN_OPEN_SQUARE_BRACKET ) {
865
- while (token.type != TOKEN_CLOSE_SQUARE_BRACKET ) {
864
+ if (token.type == e_token_type::OPEN_SQUARE_BRACKET ) {
865
+ while (token.type != e_token_type::CLOSE_SQUARE_BRACKET ) {
866
866
token_index++;
867
867
token = tokens[token_index];
868
- if (token_index == num_tokens ) {
868
+ if (token_index == tokens. size () ) {
869
869
archfpga_throw (loc_data.filename_c_str (), loc_data.line (Locations),
870
870
vtr::string_fmt (" Found an open '[' but miss close ']' of the port: %s\n " , pin_loc_string).c_str ());
871
871
}
@@ -874,15 +874,15 @@ static std::pair<int, int> process_pin_string(pugi::xml_node Locations,
874
874
token = tokens[token_index];
875
875
}
876
876
877
- if (token.type != TOKEN_DOT ) {
877
+ if (token.type != e_token_type::DOT ) {
878
878
archfpga_throw (loc_data.filename_c_str (), loc_data.line (Locations),
879
879
vtr::string_fmt (" No dot is present to separate type name and port name: %s\n " , pin_loc_string).c_str ());
880
880
}
881
881
882
882
token_index++;
883
883
token = tokens[token_index];
884
884
885
- if (token.type != TOKEN_STRING ) {
885
+ if (token.type != e_token_type::STRING ) {
886
886
archfpga_throw (loc_data.filename_c_str (), loc_data.line (Locations),
887
887
vtr::string_fmt (" No port name is present: %s\n " , pin_loc_string).c_str ());
888
888
}
@@ -900,22 +900,21 @@ static std::pair<int, int> process_pin_string(pugi::xml_node Locations,
900
900
token_index++;
901
901
902
902
// All the pins of the port are taken or the port has a single pin
903
- if (token_index == num_tokens) {
904
- free_tokens (tokens, num_tokens);
903
+ if (token_index == tokens.size ()) {
905
904
return std::make_pair (abs_first_pin_idx, abs_first_pin_idx + port->num_pins );
906
905
}
907
906
908
907
token = tokens[token_index];
909
908
910
- if (token.type != TOKEN_OPEN_SQUARE_BRACKET ) {
909
+ if (token.type != e_token_type::OPEN_SQUARE_BRACKET ) {
911
910
archfpga_throw (loc_data.filename_c_str (), loc_data.line (Locations),
912
911
vtr::string_fmt (" No open square bracket present: %s\n " , pin_loc_string).c_str ());
913
912
}
914
913
915
914
token_index++;
916
915
token = tokens[token_index];
917
916
918
- if (token.type != TOKEN_INT ) {
917
+ if (token.type != e_token_type::INT ) {
919
918
archfpga_throw (loc_data.filename_c_str (), loc_data.line (Locations),
920
919
vtr::string_fmt (" No integer to indicate least significant pin index: %s\n " , pin_loc_string).c_str ());
921
920
}
0 commit comments