Changeset 13713 for trunk/FACT++
- Timestamp:
- 05/14/12 13:41:13 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Readline.cc
r13702 r13713 1166 1166 // 1167 1167 //! Process a single line. All lines are added to the history, but only 1168 //! accepted lines are written to the command log. In this case fLine is1168 //! accepted lines are written to the command log. In this case fLine is 1169 1169 //! increased by one. 1170 //! Comment (starting with #) are removed from the command-line. A # can be 1171 //! escaped with quotation marks "#" 1170 1172 // 1171 1173 void Readline::ProcessLine(const string &str) 1172 1174 { 1173 const bool rc = PreProcess(str); 1174 1175 AddToHistory(str); 1176 1177 if (rc) 1178 return; 1179 1180 fLine++; 1175 const string cmd = Tools::Uncomment(str); 1176 1177 if (!cmd.empty()) 1178 { 1179 const bool rc = PreProcess(cmd); 1180 1181 AddToHistory(cmd); 1182 1183 if (rc) 1184 return; 1185 1186 fLine++; 1187 } 1181 1188 1182 1189 fCommandLog << str << endl; -
trunk/FACT++/src/tools.cc
r13667 r13713 192 192 return rc; 193 193 } 194 195 // -------------------------------------------------------------------------- 196 // 197 //! Returns the string with a comment (introduced by a #) stripped. The 198 //! comment mark can be escaped by either \# or "#" 199 //! 200 string Tools::Uncomment(const string &opt) 201 { 202 using namespace boost; 203 typedef escaped_list_separator<char> separator; 204 205 return *tokenizer<separator>(opt, separator('\\', '#', '\"')).begin(); 206 } -
trunk/FACT++/src/tools.h
r13667 r13713 14 14 15 15 std::map<std::string,std::string> Split(std::string &); 16 std::string Uncomment(const std::string &opt); 16 17 } 17 18
Note:
See TracChangeset
for help on using the changeset viewer.