0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TokenizerTools.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
27 
28 #ifndef Common_ClusterDefinition_TokenizerTools_h
29 #define Common_ClusterDefinition_TokenizerTools_h
30 
31 #include <map>
32 #include <string>
33 
34 namespace Hypertable {
35 
36  namespace ClusterDefinitionFile {
37 
38  using namespace std;
39 
42 
44  namespace TokenizerTools {
45 
52  extern bool is_identifier_start_character(char c);
53 
60  extern bool is_identifier_character(char c);
61 
70  extern bool is_valid_identifier(const string &name);
71 
78  extern bool is_number(const string &str);
79 
93  extern bool find_token(const string &token, const char *base,
94  const char *end, size_t *offsetp);
95 
109  extern bool find_next_token(const char *base, size_t *offsetp,
110  size_t *lengthp);
111 
127  extern bool find_end_char(const char *base, const char **endp,
128  size_t *linep=nullptr);
129 
148  extern bool skip_control_flow_statement(const char **basep);
149 
156  extern size_t count_newlines(const char *base, const char *end);
157 
165  extern bool skip_to_newline(const char **endp);
166 
180  extern bool substitute_variables(const string &input, string &output,
181  map<string, string> &vmap);
182 
183  }
184 
186  }
187 }
188 
189 #endif // Common_ClusterDefinition_TokenizerTools_h
bool find_token(const string &token, const char *base, const char *end, size_t *offsetp)
Finds a string token in a block of code.
bool skip_to_newline(const char **endp)
Skips to next newline character in text.
bool skip_control_flow_statement(const char **basep)
Skips over bash control flow statement.
bool substitute_variables(const string &input, string &output, map< string, string > &vmap)
Does variable sustitution in a block of text.
Po::typed_value< String > * str(String *v=0)
Definition: Properties.h:166
STL namespace.
bool find_end_char(const char *base, const char **endp, size_t *linep)
Skips to end of block or quoted string in code.
size_t count_newlines(const char *base, const char *end)
Counts number of newlines in text.
bool is_valid_identifier(const string &name)
Checks if name is a valid bash identifier.
bool find_next_token(const char *base, size_t *offsetp, size_t *lengthp)
Finds next bash identifier token in a block of text.
Hypertable definitions
bool is_number(const string &str)
Checks if string is an ASCII number.
bool is_identifier_character(char c)
Checks if character is valid bash identifier character.
bool is_identifier_start_character(char c)
Checks if character is valid bash identifier start character.