mirror of
https://github.com/allankoechke/cparse.git
synced 2026-11-30 17:11:31 +00:00
Bump to C++11. Add default functions to Scope() constructor.
This commit is contained in:
2
Makefile
2
Makefile
@@ -3,7 +3,7 @@ SRC=$(EXE).cpp shunting-yard.cpp packToken.cpp functions.cpp catch.cpp
|
||||
OBJ=$(SRC:.cpp=.o)
|
||||
|
||||
CXX=g++
|
||||
CFLAGS=-g -Wall -pedantic #-DDEBUG
|
||||
CFLAGS=-std=c++0x -g -Wall -pedantic #-DDEBUG
|
||||
all: $(EXE)
|
||||
|
||||
$(EXE): $(OBJ); $(CXX) $(CFLAGS) $(OBJ) -o $(EXE)
|
||||
|
||||
@@ -40,8 +40,8 @@ struct Scope {
|
||||
typedef std::list<TokenMap_t*> Scope_t;
|
||||
mutable Scope_t scope;
|
||||
|
||||
Scope() {}
|
||||
Scope(TokenMap_t* vars);
|
||||
Scope() : Scope(0) {}
|
||||
|
||||
packToken* find(std::string key) const;
|
||||
void asign(std::string key, TokenBase* value) const;
|
||||
|
||||
@@ -131,6 +131,8 @@ TEST_CASE("Scope management") {
|
||||
scope.pop();
|
||||
scope.pop();
|
||||
|
||||
scope.pop(); // Final pop for default functions.
|
||||
|
||||
// Test what happens when you try to drop more namespaces than possible:
|
||||
REQUIRE_THROWS(scope.pop());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user