Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-01-12 02:43:06 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-12 02:43:06 +0300
commit4dbc2c64e6b9edf32d33f6feffd79e3f2f767b42 (patch)
tree161bb8788a0e8ec6c40e036f41db68ea44b518d6 /src/ObjectModel
parentce146c5bc3437aad903a2efd1b79a70a45821456 (diff)
Bug fixes to conditional GCode
Diffstat (limited to 'src/ObjectModel')
-rw-r--r--src/ObjectModel/ObjectModel.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ObjectModel/ObjectModel.cpp b/src/ObjectModel/ObjectModel.cpp
index 860b8f24..7c497a2d 100644
--- a/src/ObjectModel/ObjectModel.cpp
+++ b/src/ObjectModel/ObjectModel.cpp
@@ -71,7 +71,12 @@ bool ObjectModel::ReportAsJson(OutputBuffer* buf, ObjectExplorationContext& cont
{
buf->cat(',');
}
- tbl->ReportAsJson(buf, context, this, GetNextElement(filter));
+ const char * nextElement = GetNextElement(filter);
+ if (*nextElement == '.')
+ {
+ ++nextElement;
+ }
+ tbl->ReportAsJson(buf, context, this, nextElement);
added = true;
}
--numEntries;
@@ -300,10 +305,6 @@ const ObjectModelTableEntry* ObjectModel::FindObjectModelTableEntry(uint8_t tabl
{
++id;
}
- if (*id == '.')
- {
- ++id;
- }
return id;
}
@@ -367,7 +368,7 @@ ExpressionValue ObjectModel::GetObjectValue(const StringParser& sp, ObjectExplor
{
if (*idString != '[')
{
- throw sp.ConstructParseException("can't use whole array");
+ throw sp.ConstructParseException("can't select whole array");
}
const char *endptr;
const long index = SafeStrtol(idString + 1, &endptr);
@@ -383,9 +384,9 @@ ExpressionValue ObjectModel::GetObjectValue(const StringParser& sp, ObjectExplor
throw sp.ConstructParseException("array index out of bounds");
}
- idString = endptr + 1; // skip past the ']'
context.AddIndex(index);
- val = GetObjectValue(sp, context, val.omadVal->GetElement(this, context), idString);
+ const ExpressionValue arrayElement = val.omadVal->GetElement(this, context);
+ val = GetObjectValue(sp, context, arrayElement, endptr + 1);
context.RemoveIndex();
return val;
}
@@ -404,7 +405,7 @@ ExpressionValue ObjectModel::GetObjectValue(const StringParser& sp, ObjectExplor
return val;
}
- throw sp.ConstructParseException("reached primive type beforee end of selector string");
+ throw sp.ConstructParseException("reached primitive type before end of selector string");
}
#endif