diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-03-02 18:09:34 +0100 |
---|---|---|
committer | Andreas Stöckel <andreas@somweyr.de> | 2015-03-02 18:09:34 +0100 |
commit | e31968c9e073c64cf718fbcaebbc83ee2bee48c8 (patch) | |
tree | d93e1fe22f5be33e1c5ec9dd5936479c87e5edc8 /src/core | |
parent | 6f85642ed2a76701dc1811aaa0616180ac01a9fa (diff) |
Added additional constructor to Token
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/common/Token.hpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/core/common/Token.hpp b/src/core/common/Token.hpp index f37151f..4b56f1a 100644 --- a/src/core/common/Token.hpp +++ b/src/core/common/Token.hpp @@ -134,7 +134,9 @@ struct Token { * @param location is the location of the extracted string content in the * source file. */ - Token(SourceLocation location) : id(Tokens::Data), location(location) {} + Token(const SourceLocation &location) : id(Tokens::Data), location(location) + { + } /** * Constructor of the Token struct. @@ -144,12 +146,26 @@ struct Token { * @param location is the location of the extracted string content in the * source file. */ - Token(TokenId id, const std::string &content, SourceLocation location) + Token(TokenId id, const std::string &content, + const SourceLocation &location) : id(id), content(content), location(location) { } /** + * Constructor of the a "data" Token with the given string data and + * location. + * + * @param content is the string content that should be stored in the token. + * @param location is the location of the content within the source file. + */ + Token(const std::string &content, + const SourceLocation &location = SourceLocation{}) + : id(Tokens::Data), content(content), location(location) + { + } + + /** * Constructor of the Token struct, only initializes the token id * * @param id is the id corresponding to the id of the token. @@ -172,7 +188,6 @@ struct Token { */ const SourceLocation &getLocation() const { return location; } }; - } -#endif /* _OUSIA_TOKENS_HPP_ */
\ No newline at end of file +#endif /* _OUSIA_TOKENS_HPP_ */ |