Jpp  master_rocky
the software that should make you happy
Functions
JToken.cc File Reference

Example program to test JLANG::JToken class. More...

#include <iostream>
#include <iomanip>
#include <vector>
#include "JLang/JToken.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JToken class.

Author
mdejong

Definition in file JToken.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 18 of file JToken.cc.

19 {
20  using namespace std;
21 
22  typedef JLANG::JToken<';'> JToken_t;
23 
24  vector<JToken_t> buffer;
25  int debug;
26 
27  try {
28 
29  JParser<> zap("Example program to test token parsing.");
30 
31  zap['b'] = make_field(buffer) = JPARSER::initialised();
32  zap['d'] = make_field(debug) = 0;
33 
34  zap(argc, argv);
35  }
36  catch(const exception &error) {
37  FATAL(error.what() << endl);
38  }
39 
40 
41  DEBUG(argv[0] << " parse input with separator '" << JToken_t::SEPARATOR << "'" << endl);
42 
43  for (size_t i = 0; i != buffer.size(); ++i) {
44  cout << "[" << setw(2) << i << "] " << buffer[i] << endl;
45  }
46 }
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Wrapper class around string.
Definition: JToken.hh:26
Utility class to parse command line options.
Definition: JParser.hh:1698
Definition: JSTDTypes.hh:14
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:68