MCPcopy Create free account
hub / github.com/crownengine/crown / te_compile

Function te_compile

3rdparty/tinyexpr/tinyexpr.c:665–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663
664
665te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, int *error) {
666 state s;
667 s.start = s.next = expression;
668 s.lookup = variables;
669 s.lookup_len = var_count;
670
671 next_token(&s);
672 te_expr *root = list(&s);
673 if (root == NULL) {
674 if (error) *error = -1;
675 return NULL;
676 }
677
678 if (s.type != TOK_END) {
679 te_free(root);
680 if (error) {
681 *error = (s.next - s.start);
682 if (*error == 0) *error = 1;
683 }
684 return 0;
685 } else {
686 optimize(root);
687 if (error) *error = 0;
688 return root;
689 }
690}
691
692
693double te_interp(const char *expression, int *error) {

Callers 1

te_interpFunction · 0.85

Calls 4

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

Tested by

no test coverage detected