]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Replace usages of Location with location_t in the lexer, AST, and HIR
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 10 Jul 2023 20:13:59 +0000 (16:13 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:55:59 +0000 (18:55 +0100)
gcc/rust/ChangeLog:

* ast/rust-ast-builder.h: Replace Location with location_t.
* ast/rust-ast.h: Likewise.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* lex/rust-lex.cc: Likewise.
* lex/rust-lex.h: Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
12 files changed:
gcc/rust/ast/rust-ast-builder.h
gcc/rust/ast/rust-ast.h
gcc/rust/ast/rust-expr.h
gcc/rust/ast/rust-item.h
gcc/rust/ast/rust-macro.h
gcc/rust/ast/rust-path.h
gcc/rust/hir/tree/rust-hir-expr.h
gcc/rust/hir/tree/rust-hir-item.h
gcc/rust/hir/tree/rust-hir-path.h
gcc/rust/hir/tree/rust-hir.h
gcc/rust/lex/rust-lex.cc
gcc/rust/lex/rust-lex.h

index 524b3905bbda79719fd442e879ea2002c647535c..0ee36ff44fb9e478629fdbfe942a2ca06359fcd8 100644 (file)
@@ -31,7 +31,7 @@ namespace AST {
 class AstBuilder
 {
 public:
-  AstBuilder (Location loc) : loc (loc) {}
+  AstBuilder (location_t loc) : loc (loc) {}
 
   /* Create an identifier expression (`variable`) */
   std::unique_ptr<Expr> identifier (std::string name);
@@ -107,7 +107,7 @@ private:
   /**
    * Location of the generated AST nodes
    */
-  Location loc;
+  location_t loc;
 };
 
 } // namespace AST
index f46925a2f22a7b2f2538662cb935f2acec97ef4e..3f154ef436238eb339a1955a89d893eed1f92a44 100644 (file)
@@ -41,7 +41,7 @@ public:
       loc (UNDEF_LOCATION)
   {}
   // Create identifier with dummy location
-  Identifier (std::string ident, Location loc = UNDEF_LOCATION)
+  Identifier (std::string ident, location_t loc = UNDEF_LOCATION)
     : ident (ident), node_id (Analysis::Mappings::get ()->get_next_node_id ()),
       loc (loc)
   {}
@@ -66,7 +66,7 @@ public:
 private:
   std::string ident;
   NodeId node_id;
-  Location loc;
+  location_t loc;
 };
 
 std::ostream &
@@ -157,7 +157,7 @@ public:
   virtual ~MacroMatch () {}
 
   virtual std::string as_string () const = 0;
-  virtual Location get_match_locus () const = 0;
+  virtual location_t get_match_locus () const = 0;
 
   // Unique pointer custom clone function
   std::unique_ptr<MacroMatch> clone_macro_match () const
@@ -264,7 +264,10 @@ public:
   }
 
   std::string as_string () const override;
-  Location get_match_locus () const override { return tok_ref->get_locus (); };
+  location_t get_match_locus () const override
+  {
+    return tok_ref->get_locus ();
+  };
 
   void accept_vis (ASTVisitor &vis) override;
 
index b3aa41726c4423bd3f4e6728f25b71e993a97672..69937bf3fda4da0fd155e58d7a292ea3e62bcd4a 100644 (file)
@@ -2396,8 +2396,8 @@ class BlockExpr : public ExprWithBlock
   std::vector<Attribute> inner_attrs;
   std::vector<std::unique_ptr<Stmt> > statements;
   std::unique_ptr<Expr> expr;
-  Location start_locus;
-  Location end_locus;
+  location_t start_locus;
+  location_t end_locus;
   bool marked_for_strip = false;
 
 public:
@@ -2412,8 +2412,8 @@ public:
   BlockExpr (std::vector<std::unique_ptr<Stmt> > block_statements,
             std::unique_ptr<Expr> block_expr,
             std::vector<Attribute> inner_attribs,
-            std::vector<Attribute> outer_attribs, Location start_locus,
-            Location end_locus)
+            std::vector<Attribute> outer_attribs, location_t start_locus,
+            location_t end_locus)
     : outer_attrs (std::move (outer_attribs)),
       inner_attrs (std::move (inner_attribs)),
       statements (std::move (block_statements)), expr (std::move (block_expr)),
@@ -2470,8 +2470,8 @@ public:
 
   location_t get_locus () const override final { return start_locus; }
 
-  Location get_start_locus () const { return start_locus; }
-  Location get_end_locus () const { return end_locus; }
+  location_t get_start_locus () const { return start_locus; }
+  location_t get_end_locus () const { return end_locus; }
 
   void accept_vis (ASTVisitor &vis) override;
 
@@ -4596,7 +4596,7 @@ struct TupleClobber
 {
   // as gccrs still doesen't contain a symbol class I have put them as strings
   std::string symbol;
-  Location loc;
+  location_t loc;
 };
 
 struct TupleTemplateStr
@@ -4604,7 +4604,7 @@ struct TupleTemplateStr
   // as gccrs still doesen't contain a symbol class I have put them as strings
   std::string symbol;
   std::string optional_symbol;
-  Location loc;
+  location_t loc;
 };
 
 // Inline Assembly Node
@@ -4616,7 +4616,7 @@ public:
   std::vector<InlineAsmOperand> operands;
   TupleClobber clobber_abi;
   InlineAsmOptions options;
-  std::vector<Location> line_spans;
+  std::vector<location_t> line_spans;
 };
 
 } // namespace AST
index 365b20b903a8ab9db446ce8c442d2d2f7338b3bf..dad20c7108c08c394b20dcebd65231fb94efdfdb 100644 (file)
@@ -667,14 +667,14 @@ public:
 
   // Creates a public visibility with no further features/arguments.
   // empty?
-  static Visibility create_public (Location pub_vis_location)
+  static Visibility create_public (location_t pub_vis_location)
   {
     return Visibility (PUB, SimplePath::create_empty (), pub_vis_location);
   }
 
   // Creates a public visibility with crate-relative paths
-  static Visibility create_crate (Location crate_tok_location,
-                                 Location crate_vis_location)
+  static Visibility create_crate (location_t crate_tok_location,
+                                 location_t crate_vis_location)
   {
     return Visibility (PUB_CRATE,
                       SimplePath::from_str ("crate", crate_tok_location),
@@ -682,8 +682,8 @@ public:
   }
 
   // Creates a public visibility with self-relative paths
-  static Visibility create_self (Location self_tok_location,
-                                Location self_vis_location)
+  static Visibility create_self (location_t self_tok_location,
+                                location_t self_vis_location)
   {
     return Visibility (PUB_SELF,
                       SimplePath::from_str ("self", self_tok_location),
@@ -691,8 +691,8 @@ public:
   }
 
   // Creates a public visibility with parent module-relative paths
-  static Visibility create_super (Location super_tok_location,
-                                 Location super_vis_location)
+  static Visibility create_super (location_t super_tok_location,
+                                 location_t super_vis_location)
   {
     return Visibility (PUB_SUPER,
                       SimplePath::from_str ("super", super_tok_location),
@@ -707,7 +707,7 @@ public:
 
   // Creates a public visibility with a given path or whatever.
   static Visibility create_in_path (SimplePath in_path,
-                                   Location in_path_vis_location)
+                                   location_t in_path_vis_location)
   {
     return Visibility (PUB_IN_PATH, std::move (in_path), in_path_vis_location);
   }
index 78941f883bea2921000d5b47b13cf2b3f00b29b7..a9d5b95fda608f777b36cc662c7506a6e7fda8b3 100644 (file)
@@ -190,7 +190,7 @@ public:
   }
 
   std::string as_string () const override;
-  Location get_match_locus () const override { return locus; };
+  location_t get_match_locus () const override { return locus; };
 
   void accept_vis (ASTVisitor &vis) override;
 
@@ -281,7 +281,7 @@ public:
   MacroMatchRepetition &operator= (MacroMatchRepetition &&other) = default;
 
   std::string as_string () const override;
-  Location get_match_locus () const override { return locus; };
+  location_t get_match_locus () const override { return locus; };
 
   void accept_vis (ASTVisitor &vis) override;
 
@@ -359,7 +359,7 @@ public:
 
   // Returns whether MacroMatcher is in an error state.
   bool is_error () const { return is_invalid; }
-  Location get_match_locus () const override { return locus; }
+  location_t get_match_locus () const override { return locus; }
 
   std::string as_string () const override;
 
@@ -468,7 +468,7 @@ private:
   std::vector<MacroRule> rules; // inlined form
   location_t locus;
 
-  std::function<Fragment (Location, MacroInvocData &)> associated_transcriber;
+  std::function<Fragment (location_t, MacroInvocData &)> associated_transcriber;
   // Since we can't compare std::functions, we need to use an extra boolean
   bool is_builtin_rule;
   MacroKind kind;
@@ -480,7 +480,7 @@ private:
    * should make use of the actual rules. If the macro is builtin, then another
    * associated transcriber should be used
    */
-  static Fragment dummy_builtin (Location, MacroInvocData &)
+  static Fragment dummy_builtin (location_t, MacroInvocData &)
   {
     rust_unreachable ();
     return Fragment::create_error ();
@@ -502,10 +502,10 @@ private:
       kind (kind)
   {}
 
-  MacroRulesDefinition (
-    Identifier builtin_name, DelimType delim_type,
-    std::function<Fragment (Location, MacroInvocData &)> associated_transcriber,
-    MacroKind kind, Visibility vis)
+  MacroRulesDefinition (Identifier builtin_name, DelimType delim_type,
+                       std::function<Fragment (location_t, MacroInvocData &)>
+                         associated_transcriber,
+                       MacroKind kind, Visibility vis)
     : VisItem (std::move (vis), std::vector<Attribute> ()),
       outer_attrs (std::vector<Attribute> ()), rule_name (builtin_name),
       delim_type (delim_type), rules (std::vector<MacroRule> ()),
@@ -560,14 +560,14 @@ public:
   const std::vector<MacroRule> &get_rules () const { return rules; }
 
   bool is_builtin () const { return is_builtin_rule; }
-  const std::function<Fragment (Location, MacroInvocData &)> &
+  const std::function<Fragment (location_t, MacroInvocData &)> &
   get_builtin_transcriber () const
   {
     rust_assert (is_builtin ());
     return associated_transcriber;
   }
   void set_builtin_transcriber (
-    std::function<Fragment (Location, MacroInvocData &)> transcriber)
+    std::function<Fragment (location_t, MacroInvocData &)> transcriber)
   {
     associated_transcriber = transcriber;
     is_builtin_rule = true;
@@ -926,10 +926,10 @@ protected:
 class MetaWord : public MetaItem
 {
   Identifier ident;
-  Location ident_locus;
+  location_t ident_locus;
 
 public:
-  MetaWord (Identifier ident, Location ident_locus)
+  MetaWord (Identifier ident, location_t ident_locus)
     : ident (std::move (ident)), ident_locus (ident_locus)
   {}
 
@@ -962,15 +962,15 @@ protected:
 class MetaNameValueStr : public MetaItem
 {
   Identifier ident;
-  Location ident_locus;
+  location_t ident_locus;
 
   // NOTE: str stored without quotes
   std::string str;
-  Location str_locus;
+  location_t str_locus;
 
 public:
-  MetaNameValueStr (Identifier ident, Location ident_locus, std::string str,
-                   Location str_locus)
+  MetaNameValueStr (Identifier ident, location_t ident_locus, std::string str,
+                   location_t str_locus)
     : ident (std::move (ident)), ident_locus (ident_locus),
       str (std::move (str)), str_locus (str_locus)
   {}
@@ -1019,11 +1019,11 @@ protected:
 class MetaListPaths : public MetaItem
 {
   Identifier ident;
-  Location ident_locus;
+  location_t ident_locus;
   std::vector<SimplePath> paths;
 
 public:
-  MetaListPaths (Identifier ident, Location ident_locus,
+  MetaListPaths (Identifier ident, location_t ident_locus,
                 std::vector<SimplePath> paths)
     : ident (std::move (ident)), ident_locus (ident_locus),
       paths (std::move (paths))
@@ -1064,11 +1064,11 @@ protected:
 class MetaListNameValueStr : public MetaItem
 {
   Identifier ident;
-  Location ident_locus;
+  location_t ident_locus;
   std::vector<MetaNameValueStr> strs;
 
 public:
-  MetaListNameValueStr (Identifier ident, Location ident_locus,
+  MetaListNameValueStr (Identifier ident, location_t ident_locus,
                        std::vector<MetaNameValueStr> strs)
     : ident (std::move (ident)), ident_locus (ident_locus),
       strs (std::move (strs))
index 12326a3a0ee1b3396c263ef1c846db0ffefe9e55..14524c7624c289300f79cdd7363f754b4218ad72 100644 (file)
@@ -209,7 +209,7 @@ public:
   bool is_error () const { return kind == Kind::Error; }
 
   Kind get_kind () const { return kind; }
-  const Location &get_locus () const { return locus; }
+  location_t get_locus () const { return locus; }
 
   void accept_vis (AST::ASTVisitor &visitor)
   {
index e180d6c1a11267e4a5b8a552f2929aec77bb69bb..f0e9a36282e43754743b557284fb62ff5b540286 100644 (file)
@@ -2121,8 +2121,8 @@ public:
   std::vector<std::unique_ptr<Stmt> > statements;
   std::unique_ptr<Expr> expr;
   bool tail_reachable;
-  Location start_locus;
-  Location end_locus;
+  location_t start_locus;
+  location_t end_locus;
 
   std::string as_string () const override;
 
@@ -2140,7 +2140,7 @@ public:
             std::vector<std::unique_ptr<Stmt> > block_statements,
             std::unique_ptr<Expr> block_expr, bool tail_reachable,
             AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
-            Location start_locus, Location end_locus)
+            location_t start_locus, location_t end_locus)
     : ExprWithBlock (std::move (mappings), std::move (outer_attribs)),
       WithInnerAttrs (std::move (inner_attribs)),
       statements (std::move (block_statements)), expr (std::move (block_expr)),
@@ -2193,9 +2193,9 @@ public:
 
   location_t get_locus () const override final { return start_locus; }
 
-  Location get_start_locus () const { return start_locus; }
+  location_t get_start_locus () const { return start_locus; }
 
-  Location get_end_locus () const { return end_locus; }
+  location_t get_end_locus () const { return end_locus; }
 
   void accept_vis (HIRFullVisitor &vis) override;
   void accept_vis (HIRExpressionVisitor &vis) override;
@@ -3935,7 +3935,7 @@ public:
   std::vector<AST::TupleTemplateStr> template_strs;
   std::vector<AST::InlineAsmOperand> operands;
   AST::InlineAsmOptions options;
-  std::vector<Location> line_spans;
+  std::vector<location_t> line_spans;
 };
 } // namespace HIR
 } // namespace Rust
index cb0dc1339f5db4a9c181f243a964b301f2f70498..75e02e98c5ce83f6baab9c285d3c2598169cb877 100644 (file)
@@ -2406,7 +2406,7 @@ public:
     return outer_attrs;
   }
 
-  Location get_trait_locus () const override { return get_locus (); }
+  location_t get_trait_locus () const override { return get_locus (); }
 
 protected:
   // Clone function implementation as (not pure) virtual method
@@ -2493,7 +2493,7 @@ public:
     return outer_attrs;
   }
 
-  Location get_trait_locus () const override { return get_locus (); }
+  location_t get_trait_locus () const override { return get_locus (); }
 
 protected:
   // Clone function implementation as (not pure) virtual method
@@ -2585,7 +2585,7 @@ public:
     return outer_attrs;
   }
 
-  Location get_trait_locus () const override { return get_locus (); }
+  location_t get_trait_locus () const override { return get_locus (); }
 
 protected:
   // Clone function implementation as (not pure) virtual method
index 80456e818a459a88f264dc8ebf24a8c7c057d37a..b7644b81aaa7857989eb4375d63380c29cb4d7ab 100644 (file)
@@ -1001,7 +1001,7 @@ public:
   bool is_error () const { return segments.empty (); }
 
   const Analysis::NodeMapping &get_mappings () const { return mappings; }
-  const Location &get_locus () const { return locus; }
+  location_t get_locus () const { return locus; }
 };
 
 } // namespace HIR
index aac4b2dac62c9148565fddcce3adddc6679375e8..76b6c73b627c03aedc682c8daf0ef578135061e4 100644 (file)
@@ -814,7 +814,7 @@ public:
 
   const Analysis::NodeMapping &get_mappings () const { return mappings; }
 
-  virtual Location get_trait_locus () const = 0;
+  virtual location_t get_trait_locus () const = 0;
 
   virtual TraitItemKind get_item_kind () const = 0;
 
index ee91d027977fe6ee1980dfda87df2a675875518a..8c575a7cc1c4070cb94dadafaff3e88c267986ee 100644 (file)
@@ -173,7 +173,7 @@ Lexer::input_source_is_valid_utf8 ()
   return raw_input_source->is_valid ();
 }
 
-Location
+location_t
 Lexer::get_current_location ()
 {
   if (line_map)
@@ -230,7 +230,7 @@ Lexer::dump_and_skip (int n)
          tok = peek_token ();
          found_eof |= tok->get_id () == Rust::END_OF_FILE;
 
-         Location loc = tok->get_locus ();
+         location_t loc = tok->get_locus ();
 
          out << "<id=";
          out << tok->token_id_to_str ();
@@ -302,7 +302,7 @@ Lexer::build_token ()
   // loop to go through multiple characters to build a single token
   while (true)
     {
-      Location loc = get_current_location ();
+      location_t loc = get_current_location ();
 
       current_char = peek_input ();
       skip_input ();
@@ -1699,7 +1699,7 @@ Lexer::parse_partial_unicode_escape ()
 
 // Parses a byte character.
 TokenPtr
-Lexer::parse_byte_char (Location loc)
+Lexer::parse_byte_char (location_t loc)
 {
   skip_input ();
   current_column++;
@@ -1767,7 +1767,7 @@ Lexer::parse_byte_char (Location loc)
 
 // Parses a byte string.
 TokenPtr
-Lexer::parse_byte_string (Location loc)
+Lexer::parse_byte_string (location_t loc)
 {
   // byte string
 
@@ -1833,7 +1833,7 @@ Lexer::parse_byte_string (Location loc)
 
 // Parses a raw byte string.
 TokenPtr
-Lexer::parse_raw_byte_string (Location loc)
+Lexer::parse_raw_byte_string (location_t loc)
 {
   // raw byte string literals
   std::string str;
@@ -1916,7 +1916,7 @@ Lexer::parse_raw_byte_string (Location loc)
 
 // Parses a raw identifier.
 TokenPtr
-Lexer::parse_raw_identifier (Location loc)
+Lexer::parse_raw_identifier (location_t loc)
 {
   // raw identifier
   std::string str;
@@ -1998,7 +1998,7 @@ Lexer::skip_broken_string_input (Codepoint current_char)
 
 // Parses a string.
 TokenPtr
-Lexer::parse_string (Location loc)
+Lexer::parse_string (location_t loc)
 {
   std::string str;
   str.reserve (16); // some sensible default
@@ -2063,7 +2063,7 @@ Lexer::parse_string (Location loc)
 
 // Parses an identifier or keyword.
 TokenPtr
-Lexer::parse_identifier_or_keyword (Location loc)
+Lexer::parse_identifier_or_keyword (location_t loc)
 {
   std::string str;
   str.reserve (16); // default
@@ -2104,7 +2104,7 @@ Lexer::parse_identifier_or_keyword (Location loc)
 
 // Possibly returns a raw string token if it exists - otherwise returns null.
 TokenPtr
-Lexer::maybe_parse_raw_string (Location loc)
+Lexer::maybe_parse_raw_string (location_t loc)
 {
   int peek_index = 0;
   while (peek_input (peek_index) == '#')
@@ -2118,7 +2118,7 @@ Lexer::maybe_parse_raw_string (Location loc)
 
 // Returns a raw string token.
 TokenPtr
-Lexer::parse_raw_string (Location loc, int initial_hash_count)
+Lexer::parse_raw_string (location_t loc, int initial_hash_count)
 {
   // raw string literals
   std::string str;
@@ -2181,7 +2181,7 @@ Lexer::parse_raw_string (Location loc, int initial_hash_count)
 
 template <typename IsDigitFunc>
 TokenPtr
-Lexer::parse_non_decimal_int_literal (Location loc, IsDigitFunc is_digit_func,
+Lexer::parse_non_decimal_int_literal (location_t loc, IsDigitFunc is_digit_func,
                                      std::string existent_str, int base)
 {
   int length = 1;
@@ -2245,7 +2245,7 @@ Lexer::parse_non_decimal_int_literal (Location loc, IsDigitFunc is_digit_func,
 
 // Parses a hex, binary or octal int literal.
 TokenPtr
-Lexer::parse_non_decimal_int_literals (Location loc)
+Lexer::parse_non_decimal_int_literals (location_t loc)
 {
   std::string str;
   str.reserve (16); // some sensible default
@@ -2278,7 +2278,7 @@ Lexer::parse_non_decimal_int_literals (Location loc)
 
 // Parses a decimal-based int literal or float literal.
 TokenPtr
-Lexer::parse_decimal_int_or_float (Location loc)
+Lexer::parse_decimal_int_or_float (location_t loc)
 {
   std::string str;
   str.reserve (16); // some sensible default
@@ -2417,7 +2417,7 @@ Lexer::parse_decimal_int_or_float (Location loc)
 }
 
 TokenPtr
-Lexer::parse_char_or_lifetime (Location loc)
+Lexer::parse_char_or_lifetime (location_t loc)
 {
   int length = 1;
 
@@ -2511,7 +2511,7 @@ Lexer::split_current_token (TokenId new_left, TokenId new_right)
 {
   /* TODO: assert that this TokenId is a "simple token" like punctuation and not
    * like "IDENTIFIER"? */
-  Location current_loc = peek_token ()->get_locus ();
+  location_t current_loc = peek_token ()->get_locus ();
   TokenPtr new_left_tok = Token::make (new_left, current_loc);
   TokenPtr new_right_tok = Token::make (new_right, current_loc + 1);
 
index 1bb35ae64ca15ab3ee34ec7c24f7255f5e974e29..e85b5629a6218df50a5dfc5e104f6ba2a93a74d0 100644 (file)
@@ -112,7 +112,7 @@ class Lexer
 {
 private:
   // Request new Location for current column in line_table
-  Location get_current_location ();
+  location_t get_current_location ();
 
   // Skips the current input char.
   void skip_input ();
@@ -138,20 +138,20 @@ private:
 
   void skip_broken_string_input (Codepoint current_char);
 
-  TokenPtr parse_byte_char (Location loc);
-  TokenPtr parse_byte_string (Location loc);
-  TokenPtr parse_raw_byte_string (Location loc);
-  TokenPtr parse_raw_identifier (Location loc);
-  TokenPtr parse_string (Location loc);
-  TokenPtr maybe_parse_raw_string (Location loc);
-  TokenPtr parse_raw_string (Location loc, int initial_hash_count);
-  TokenPtr parse_non_decimal_int_literals (Location loc);
-  TokenPtr parse_decimal_int_or_float (Location loc);
-  TokenPtr parse_char_or_lifetime (Location loc);
-  TokenPtr parse_identifier_or_keyword (Location loc);
+  TokenPtr parse_byte_char (location_t loc);
+  TokenPtr parse_byte_string (location_t loc);
+  TokenPtr parse_raw_byte_string (location_t loc);
+  TokenPtr parse_raw_identifier (location_t loc);
+  TokenPtr parse_string (location_t loc);
+  TokenPtr maybe_parse_raw_string (location_t loc);
+  TokenPtr parse_raw_string (location_t loc, int initial_hash_count);
+  TokenPtr parse_non_decimal_int_literals (location_t loc);
+  TokenPtr parse_decimal_int_or_float (location_t loc);
+  TokenPtr parse_char_or_lifetime (location_t loc);
+  TokenPtr parse_identifier_or_keyword (location_t loc);
 
   template <typename IsDigitFunc>
-  TokenPtr parse_non_decimal_int_literal (Location loc,
+  TokenPtr parse_non_decimal_int_literal (location_t loc,
                                          IsDigitFunc is_digit_func,
                                          std::string existent_str, int base);