Commit 937d6b41 authored by Tony Mancill's avatar Tony Mancill

Imported Upstream version 2.09.04

parent a1647030
#define VERSION "2.09.03"
#define YEARS "2005-2011"
#define VERSION "2.09.04"
#define YEARS "2005-2012"
bisonc++ (2.09.04)
* Replaced many for_each calls and lamda functions by range-based for-loops
* Used g++-4.7
-- Frank B. Brokken <f.b.brokken@rug.nl> Wed, 04 Jan 2012 12:26:01 +0100
bisonc++ (2.09.03)
* Replaced all FnWrap* calls by lambda function calls
* Replaced all FnWrap* calls by lambda function calls
* `build' script now recognizes CXXFLAGS and LDFLAGS for, resp. g++ and ld
flags. Default values are set in INSTALL.im, as before.
* `build' script now recognizes CXXFLAGS and LDFLAGS for, resp. g++ and ld
flags. Default values are set in INSTALL.im, as before.
-- Frank B. Brokken <f.b.brokken@rug.nl> Thu, 23 Jun 2011 10:06:02 +0200
bisonc++ (2.09.02)
* Repaired flaws that emerged with g++ 4.6
* Repaired flaws that emerged with g++ 4.6
-- Frank B. Brokken <f.b.brokken@rug.nl> Mon, 02 May 2011 16:30:43 +0200
......
......@@ -18,7 +18,7 @@ class Parser: public ParserBase
private:
void error(char const *msg)
{
std::cerr << msg << '\n';
std::cerr << msg << std::endl;
}
// $insert lex
......
......@@ -7,14 +7,8 @@ void Generator::actionCases(ostream &out) const
vector<Production const *> const &productions = d_rules.productions();
for_each
(
productions.begin(), productions.end(),
[&, d_indent](Production const *prod)
{
Production::insertAction(prod, out, d_parser.lines(), d_indent);
}
);
for (auto prod: productions)
Production::insertAction(prod, out, d_parser.lines(), d_indent);
}
......
#include "generator.h"
#include <algorithm>
#include <sstream>
#include <ostream>
#include <iomanip>
......
......@@ -4,15 +4,9 @@ void Generator::tokens(ostream &out) const
{
Terminal::ConstVector tokens;
for_each
(
d_rules.terminals().begin(), d_rules.terminals().end(),
[&](Terminal const *terminal)
{
selectSymbolic(terminal, tokens);
}
);
for (auto terminal: d_rules.terminals())
selectSymbolic(terminal, tokens);
key(out);
if (!tokens.size())
......@@ -29,8 +23,3 @@ void Generator::tokens(ostream &out) const
#!/bin/bash
../tmp/bin/bisonc++ --construction -S /usr/share/bisonc++ grammar || exit 1
svn diff parse.cc
svn diff parserbase.h
pause
svn revert parse.cc parserbase.h
......@@ -2,12 +2,6 @@
void RRConflict::removeConflicts(StateItem::Vector &itemVector)
{
for_each
(
d_rmReduction.begin(), d_rmReduction.end(),
[&](RRData const &rm)
{
StateItem::removeRRConflict(rm, itemVector);
}
);
for (auto &rm: d_rmReduction)
StateItem::removeRRConflict(rm, itemVector);
}
#include "rrconflict.h"
#include <algorithm>
using namespace std;
......@@ -4,13 +4,8 @@ void Rules::termToNonterm(Symbol *term, Symbol *nonTerm)
{
d_terminal.erase(find(d_terminal.begin(), d_terminal.end(), term));
for_each(
d_production.begin(), d_production.end(),
[=](Production *pPtr)
{
Production::termToNonterm(pPtr, term, nonTerm);
}
);
for (auto pPtr: d_production)
Production::termToNonterm(pPtr, term, nonTerm);
delete term;
}
......@@ -7,11 +7,6 @@
void Rules::updatePrecedences()
{
for_each(
d_production.begin(), d_production.end(),
[&](Production *production)
{
updatePrecedence(production, d_terminal);
}
);
for (auto production: d_production)
updatePrecedence(production, d_terminal);
}
......@@ -7,13 +7,8 @@
void SRConflict::inspect()
{
for_each(
d_reducible.begin(), d_reducible.end(),
[this](size_t idx)
{
this->visitReduction(idx);
}
);
for (auto idx: d_reducible)
visitReduction(idx);
}
......@@ -3,11 +3,6 @@
void SRConflict::processShiftReduceConflict(Next::ConstIter const &next,
size_t reducibleItemIdx)
{
for_each(
next->kernel().begin(), next->kernel().end(),
[&, reducibleItemIdx](size_t shiftableItemIdx)
{
handleSRconflict(shiftableItemIdx, next, reducibleItemIdx);
}
);
for (auto shiftableItemIdx: next->kernel())
handleSRconflict(shiftableItemIdx, next, reducibleItemIdx);
}
......@@ -2,12 +2,6 @@
void SRConflict::removeReductions(StateItem::Vector &itemVector)
{
for_each
(
d_rmReduction.begin(), d_rmReduction.end(),
[&](RmReduction const &rm)
{
StateItem::removeReduction(rm, itemVector);
}
);
for (auto &rm: d_rmReduction)
StateItem::removeReduction(rm, itemVector);
}
......@@ -4,13 +4,8 @@ size_t SRConflict::removeShifts(Next::Vector &nextVector)
{
size_t nRemoved = 0;
for_each(
d_rmShift.begin(), d_rmShift.end(),
[&](RmShift const &rmShift)
{
Next::removeShift(rmShift, nextVector, &nRemoved);
}
);
for (auto &rmShift: d_rmShift)
Next::removeShift(rmShift, nextVector, &nRemoved);
return nRemoved;
}
#include "srconflict.h"
#include <algorithm>
#include "../enumsolution/enumsolution.h"
using namespace std;
......
......@@ -17,13 +17,8 @@ void State::addProductions(Symbol const *symbol, size_t idx)
Production::Vector const &productions =
NonTerminal::downcast(symbol)->productions();
for_each(
productions.begin(), productions.end(),
[&, idx](Production const *production)
{
StateItem::addProduction(production, d_itemVector, idx);
}
);
for (auto production: productions)
StateItem::addProduction(production, d_itemVector, idx);
}
......
......@@ -4,13 +4,8 @@ void State::addState(Item::Vector const &kernel)
{
State &state = newState();
for_each(
kernel.begin(), kernel.end(),
[&](Item const &item)
{
state.addKernelItem(StateItem(item));
}
);
for (auto &item: kernel)
state.addKernelItem(StateItem(item));
}
......
......@@ -4,11 +4,6 @@ void State::construct()
{
setItems();
for_each(
d_nextVector.begin(), d_nextVector.end(),
[this](Next &next)
{
this->nextState(next);
}
);
for (auto &next: d_nextVector)
nextState(next);
}
......@@ -152,13 +152,8 @@ void State::define()
// reaching this state and its type is NORMAL: ACCEPT. Pondering...
s_acceptState->d_stateType.setType(StateType::REQ_TOKEN);
for_each(
s_state.begin(), s_state.end(),
[](State *state)
{
state->checkConflicts();
}
);
for (auto state: s_state)
state->checkConflicts();
if
(
......@@ -176,13 +171,8 @@ void State::define()
" Reduce/Reduce conflict(s)" << endl;
}
for_each(
s_state.begin(), s_state.end(),
[](State *state)
{
state->summarizeActions();
}
);
for (auto state: s_state)
state->summarizeActions();
}
......
......@@ -8,13 +8,8 @@ void State::distributeLA(Next &next, LookaheadContext &context)
context.visitChildState = false;
// visit all kernel items of the child state
for_each(
next.kernel().begin(), next.kernel().end(),
[&](size_t itemIdx)
{
updateLA(itemIdx, context);
}
);
for (size_t itemIdx: next.kernel())
updateLA(itemIdx, context);
// if the child's state has its LA changed, make sure it's visited
if (context.visitChildState)
......
......@@ -11,7 +11,7 @@ bool State::hasKernel(Item::Vector const &searchKernel) const
count_if
(
searchKernel.begin(), searchKernel.end(),
[&, d_nKernelItems](Item const &searchItem)
[&](Item const &searchItem)
{
return StateItem::containsKernelItem(searchItem,
d_nKernelItems, d_itemVector);
......
......@@ -34,21 +34,11 @@ void State::propagateLA()
// remaining fields managed by distributeLA
};
for_each(
d_nextVector.begin(), d_nextVector.end(),
[&](Next &next)
{
distributeLA(next, context);
}
);
for_each(
context.child.begin(), context.child.end(),
[](State *state)
{
state->propagateLA();
}
);
for (auto &next: d_nextVector)
distributeLA(next, context);
for (auto state: context.child)
state->propagateLA();
}
......
......@@ -23,13 +23,8 @@ bool StateItem::propagateLA(StateItem &stateItem, Vector &vector)
if (stateItem.d_item.firstBeyondDot(&proposedLA.firstSet()))
proposedLA += stateItem.d_LA;
for_each(
stateItem.d_child.begin(), stateItem.d_child.end(),
[&](size_t idx)
{
propagate(idx, vector, proposedLA);
}
);
for (auto idx: stateItem.d_child)
propagate(idx, vector, proposedLA);
return true;
}
......
......@@ -2,7 +2,6 @@
#include <ostream>
#include <iterator>
#include <algorithm>
using namespace std;
......@@ -9,13 +9,8 @@ void Writer::insert(Terminal::ConstVector const &tokens) const
size_t lastTokenValue = 0;
for_each(
tokens.begin(), tokens.end(),
[&, d_out](Terminal const *token)
{
insertToken(token, lastTokenValue, *d_out);
}
);
for (auto token: tokens)
insertToken(token, lastTokenValue, *d_out);
*d_out << " };\n"
"\n";
......
......@@ -10,13 +10,8 @@ void Writer::productions() const
"{\n"
" {0, 0}, // not used: reduction values are negative\n";
for_each(
prods.begin(), prods.end(),
[=](Production const *production)
{
productionInfo(production, *d_out);
}
);
for (auto production: prods)
productionInfo(production, *d_out);
*d_out << "};\n";
}
......
......@@ -4,13 +4,8 @@ void Writer::reduction(Table &table, StateItem const &stateItem)
{
size_t ruleNr = stateItem.nr();
for_each(
stateItem.lookaheadSet().begin(), stateItem.lookaheadSet().end(),
[&, ruleNr](Element const *sym)
{
reductionSymbol(sym, ruleNr, table);
}
);
for (auto sym: stateItem.lookaheadSet())
reductionSymbol(sym, ruleNr, table);
if (stateItem.lookaheadSet().hasEOF())
reductionSymbol(Rules::eofTerminal(), ruleNr, table);
......
......@@ -18,7 +18,7 @@ void Writer::srTables() const
for_each(
State::begin(), State::end(),
[&, d_out](State const *state)
[&](State const *state)
{
srTable(state, d_baseclass, table, *d_out);
}
......
......@@ -14,21 +14,11 @@ void Writer::symbolicNames() const
" SMapVal(256, \"_error_\"),\n"
"\n";
for_each(
d_rules.terminals().begin(), d_rules.terminals().end(),
[=](Terminal const *terminal)
{
terminalSymbol(terminal, *d_out);
}
);
for (auto terminal: d_rules.terminals())
terminalSymbol(terminal, *d_out);
for_each(
d_rules.nonTerminals().begin(), d_rules.nonTerminals().end(),
[=](NonTerminal const *nonTerminal)
{
nonTerminalSymbol(nonTerminal, *d_out);
}
);
for (auto nonTerminal: d_rules.nonTerminals())
nonTerminalSymbol(nonTerminal, *d_out);
*d_out << "};\n"
"\n"
......
......@@ -2,11 +2,6 @@
void Writer::transitions(Table &table, Next::Vector const &next)
{
for_each(
next.begin(), next.end(),
[&](Next const &next)
{
transition(next, table);
}
);
for (auto &element: next)
transition(element, table);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment