#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <regex>
using namespace std;
class Parser {
protected:
// regex: containers
static const regex rxProc("procedure\s+([\w]+)\s*{");
}
I am getting an error for the "procedure\s+([\w]+)\s*{" part. Expected a type specifier. I must be doing something wrong?
Look at the other answers here to understand what are you actually asking the compiler. If you are trying to make a constant inside your class – I provide a solution here.
Using static members in C++ is fun, but only for POD (plain-old-data) members. For more complex members things get ugly. Even for
char*this does not scale up. Using good old C#defines is sometimes a good idea – even in C++;Something like this will fix your compilation problem. Play with the
#if 0to trigger your old code, and compile usingg++ -std=gnu++0x -c test1.cpp(not even getting into the issue of using regex to define a syntax tree… or parsing a Pascal file… which is just bad idea and will break oh, so, many times… just don’t)