Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __INPUTPARSER_HPP
00021 #define __INPUTPARSER_HPP
00022
00023 #include <vector>
00024 #include <string>
00025 #include <istream>
00026
00027 #include <xqilla/framework/XQillaExport.hpp>
00028
00029 class XQILLA_API InputParser
00030 {
00031 public:
00032 typedef std::vector<std::string> Args;
00033
00034 int parse(std::istream &input, Args &args);
00035
00036 private:
00037 void reset();
00038 void whitespace(Args &args);
00039 void character();
00040 void escapedCharacter();
00041 bool inQuotes();
00042 void quote(Args &args, char c);
00043 void openCurly();
00044 void closeCurly();
00045 void endOfArg(Args &args);
00046 void addArgument(Args &args, std::string::size_type start, std::string::size_type end);
00047 void nextLine(std::istream &input, Args &args);
00048
00049 std::string line_;
00050 std::string::size_type start_, pos_;
00051 char quoteChar_;
00052 int curlyBraceDepth_;
00053 bool seenNonWS_;
00054 bool stripQuotes_;
00055 };
00056
00057 #endif