bitwise/inc/shunting-yard.h
Ramon Fried 5bb7d300b3 Fix divide by zero crash
Issue #61

Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
2023-05-14 23:54:33 +03:00

28 lines
668 B
C

// Copyright 2011 - 2012, 2014 Brian Marshall. All rights reserved.
//
// Use of this source code is governed by the BSD 2-Clause License that can be
// found in the LICENSE file.
#include <stdint.h>
#ifndef SHUNTING_YARD_H
#define SHUNTING_YARD_H
typedef enum {
STATUS_OK,
ERROR_SYNTAX,
ERROR_OPEN_PARENTHESIS,
ERROR_CLOSE_PARENTHESIS,
ERROR_UNRECOGNIZED,
ERROR_NO_INPUT,
ERROR_UNDEFINED_FUNCTION,
ERROR_FUNCTION_ARGUMENTS,
ERROR_UNDEFINED_CONSTANT,
ERROR_WRONG_ARGUMENTS,
ERROR_DIVIDE_BY_ZERO,
} Status;
// Calculates the result of a mathematical expression.
Status shunting_yard(const char *expression, uint64_t *result);
#endif // SHUNTING_YARD_H