MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / te_compile

Function te_compile

extern/tinyexpr/tinyexpr.c:589–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587
588
589te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, int *error) {
590 state s;
591 s.start = s.next = expression;
592 s.lookup = variables;
593 s.lookup_len = var_count;
594
595 next_token(&s);
596 te_expr *root = list(&s);
597
598 if (s.type != TOK_END) {
599 te_free(root);
600 if (error) {
601 *error = (s.next - s.start);
602 if (*error == 0) *error = 1;
603 }
604 return 0;
605 } else {
606 optimize(root);
607 if (error) *error = 0;
608 return root;
609 }
610}
611
612
613double te_interp(const char *expression, int *error) {

Callers 2

te_interpFunction · 0.85
stepMethod · 0.85

Calls 4

next_tokenFunction · 0.85
te_freeFunction · 0.85
optimizeFunction · 0.85
listFunction · 0.70

Tested by

no test coverage detected