MCPcopy Create free account
hub / github.com/TASEmulators/fceux / InfixOperator

Function InfixOperator

src/conddebug.cpp:75–114  ·  view source on GitHub ↗

Generic function to handle all infix operators but the last one in the precedence hierarchy. : '(' E ')'

Source from the content-addressed store, hash-verified

73
74// Generic function to handle all infix operators but the last one in the precedence hierarchy. : '(' E ')'
75static Condition* InfixOperator(const char** str, Condition(*nextPart(const char**)), int(*operators)(const char**))
76{
77 Condition* t = nextPart(str);
78 Condition* t1;
79 Condition* mid;
80 int op;
81
82 if (t == nullptr)
83 {
84 return nullptr;
85 }
86 while ((op = operators(str)))
87 {
88 scan(str);
89
90 t1 = nextPart(str);
91
92 if (t1 == nullptr)
93 {
94 delete t;
95 return 0;
96 }
97
98 mid = new Condition();
99 if (mid == nullptr)
100 {
101 delete t;
102 delete t1;
103 return nullptr;
104 }
105
106 mid->lhs = t;
107 mid->rhs = t1;
108 mid->op = op;
109
110 t = mid;
111 }
112
113 return t;
114}
115
116// Generic handler for two-character operators
117static int TwoCharOperator(const char** str, char c1, char c2, int op)

Callers 3

SumFunction · 0.85
CompareFunction · 0.85
ConnectFunction · 0.85

Calls 1

scanFunction · 0.85

Tested by

no test coverage detected