MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / GetOperatorPrecedence

Function GetOperatorPrecedence

formatter/generic/genericformatter.cpp:112–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112static BNOperatorPrecedence GetOperatorPrecedence(const InstructionTextToken& token, size_t* ternary = nullptr)
113{
114 string trimmedText = TrimString(token.text);
115 auto i = g_operatorPrecedenceMap.find(trimmedText);
116 if (i != g_operatorPrecedenceMap.end())
117 {
118 if (i->second == TernaryOperatorPrecedence && ternary)
119 {
120 // HLIL uses ':' in additional contexts, so look for active ternary operators before
121 // treating it as part of a ternary
122 if (trimmedText == "?")
123 {
124 (*ternary)++;
125 }
126 else if (trimmedText == ":")
127 {
128 if (*ternary)
129 (*ternary)--;
130 else
131 return MemberAndFunctionOperatorPrecedence;
132 }
133 }
134 return i->second;
135 }
136 return MemberAndFunctionOperatorPrecedence;
137}
138
139
140struct Item

Callers 2

Calls 3

TrimStringFunction · 0.85
findMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected