Looks promising… nounList couldn’t be there for an action that doesn’t allow miltiDobj…
Aha!
has verbProd: true
has dobjMatch: true
dobjMatch: (singleNoun(normal))
For my PeekThrough
action, which only allows for singles!
Getting closer… need to make sure a comparison works, now.
My laptop internet connection is currently down, else I’d send you my debug print func… useful all over the place!
Problem:
local verbProd = gCommand.verbProd;
"has verbProd: <<(verbProd == nil) ? 'nil' : 'true'>>\n";
local dm = verbProd.dobjMatch;
"has dobjMatch: <<(dm == nil) ? 'nil' : 'true'>>\n";
"dobjMatch: <<dm>>\n";
"is single: <<(dm == singleNoun) ? 'true' : 'nil'>>\n";
"is multi: <<(dm == nounList) ? 'true' : 'nil'>>\n";
Output:
has verbProd: true
has dobjMatch: true
dobjMatch: (nounList(nonTerminal))
is single: nil
is multi: nil
I feel like I just did something childish. How does one perform a comparison for these?
EDIT: Swapped variables.
There are a few kinds of nounLists and singleNouns… you can see it in the libref.
Ohhh…those are classes?
Prods, yes
Heck. Tried looking it up in the libref, and it’s like a different coding language over here. I’m in the grammar section, apparently.
ValToSymbol could help here to determine what you need to compare to…
reflectionServices.t
?
EDIT: Oh, reflect.h
?
Yes…
Okay, note for future explorers:
#include "reflect.t"
is your include.
reflectionServices.valToSymbol(objDataHere)
is your execution.
Here’s my result for:
reflectionServices.valToSymbol(gCommand.verbProd.dobjMatch)
Output:
{obj:nounList(nonTerminal)}
Is that the whole object? The object is nounList(nonTerminal)
? Not used to seeing parenthesis in object references…
Try if == nounList(nonTerminal) and see what happens?
My bad… prob have to check ofKind?
Tried both. Says “nonTerminal is not a defined symbol”. I think it’s treating nounList
as a method or something, and nonTerminal
as an arg.
By the way, I really appreciate you helping me.
You could probably do this debugPrint as a function inst of macro…
Whoops, the ‘a’ after the @ is supposed to be ‘val’ and so is the argument to vts
Yeah, I didn’t think entering that would work…
You could use the valToSymbol return values for your comparisons
Vts the dobjMatch and then compare it to known values
For any future explorers, your code for the debug function is as follows:
#ifdef __DEBUG
#include "reflect.t"
#define debugPrint(val) { local str = '\n'## #@val ## ' = <<reflectionServices.valToSymbol(val)>> \n'; \
if (gTranscript) extraReport(str); else say(str); \
}
#endif