Style changes as requested

This commit is contained in:
Jan Martin Mikkelsen 2017-08-05 13:46:24 +10:00
parent 7d36c5f6b8
commit e70e41282c
4 changed files with 9 additions and 9 deletions

View File

@ -7,6 +7,7 @@
#include <algorithm>
#include <assert.h>
#include <atomic>
#include <codecvt>
#include <chrono>
#include <fstream>

View File

@ -88,14 +88,14 @@ misc::IntervalSet ATN::nextTokens(ATNState *s, RuleContext *ctx) const {
}
misc::IntervalSet const& ATN::nextTokens(ATNState *s) const {
if (!s->nextTokenUpdated) {
if (!s->_nextTokenUpdated) {
std::unique_lock<std::mutex> lock { _mutex };
if (!s->nextTokenUpdated) {
s->nextTokenWithinRule = nextTokens(s, nullptr);
s->nextTokenUpdated = true;
if (!s->_nextTokenUpdated) {
s->_nextTokenWithinRule = nextTokens(s, nullptr);
s->_nextTokenUpdated = true;
}
}
return s->nextTokenWithinRule;
return s->_nextTokenWithinRule;
}
void ATN::addState(ATNState *state) {

View File

@ -6,7 +6,6 @@
#pragma once
#include "misc/IntervalSet.h"
#include <atomic>
namespace antlr4 {
namespace atn {
@ -124,8 +123,8 @@ namespace atn {
private:
/// Used to cache lookahead during parsing, not used during construction.
misc::IntervalSet nextTokenWithinRule;
std::atomic<bool> nextTokenUpdated { false };
misc::IntervalSet _nextTokenWithinRule;
std::atomic<bool> _nextTokenUpdated { false };
friend class ATN;
};

View File

@ -24,7 +24,7 @@ IntervalSet::IntervalSet() : _intervals() {
IntervalSet::IntervalSet(const IntervalSet &set) : _intervals(set._intervals) {
}
IntervalSet::IntervalSet(IntervalSet&& set) : _intervals(std::move(set._intervals)) {
IntervalSet::IntervalSet(IntervalSet&& set) : IntervalSet(std::move(set._intervals)) {
}
IntervalSet::IntervalSet(std::vector<Interval>&& intervals) : _intervals(std::move(intervals)) {