[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 9df9a4d 1/2: Initialize parser members in dri
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 9df9a4d 1/2: Initialize parser members in driver, not in ctor |
Date: |
Sat, 4 Feb 2017 01:13:29 +0000 (UTC) |
branch: master
commit 9df9a4d79f95560d16c3dd38c4cfe89da8f59933
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Initialize parser members in driver, not in ctor
Moved initialization of parser's private data from the ctor-initializer
to the parser driver. Clearly this initialization is intended to be
performed before each invocation of sequence().
Incidentally improved nearby documentation.
---
input_sequence.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/input_sequence.cpp b/input_sequence.cpp
index 19269b5..59814b5 100644
--- a/input_sequence.cpp
+++ b/input_sequence.cpp
@@ -66,10 +66,6 @@ SequenceParser::SequenceParser
,effective_year_ (a_effective_year)
,allowed_keywords_ (a_allowed_keywords)
,keywords_only_ (a_keywords_only)
- ,current_token_type_ (e_startup)
- ,previous_duration_scalar_mode_ (e_inception)
- ,current_duration_scalar_mode_ (e_inception)
- ,last_input_duration_ (0)
{
sequence();
}
@@ -828,9 +824,14 @@ void SequenceParser::span()
void SequenceParser::sequence()
{
- // Numbers should always be set explicitly, so we initialize
- // them to recognizable, implausible values. Set the 'insane'
- // flag: assume the sequence is insane until known otherwise.
+ current_token_type_ = e_startup;
+ previous_duration_scalar_mode_ = e_inception;
+ current_duration_scalar_mode_ = e_inception;
+ last_input_duration_ = 0;
+
+ // All ValueInterval members should be set explicitly, so
+ // initialize them now to recognizable, implausible values,
+ // such that the interval is insane until modified.
current_interval_.value_number = -999999999999.999;
current_interval_.value_keyword = "daft";
current_interval_.value_is_keyword = true;