<commit_before>// Package evaler implements a simple fp arithmetic expression evaluator.
//
// Evaler uses Dijkstra's Shunting Yard algorithm [1] to convert an infix
// expression to postfix/RPN format [2], then evaluates the RPN expression.
//
// The operators supported are: + - * / and parentheses ().
//
// [1] http://en.wikipedia.org/wiki/Shunting-yard_algorithm
// [2] http://en.wikipedia.org/wiki/Reverse_Polish_notation

package evaler

import (
	"fmt"
	"github.com/soniah/evaler/stack"
	"math"
	"regexp"
	"strconv"
	"strings"
)

var whitespace_rx = regexp.MustCompile(`\s+`)
var fp_rx = regexp.MustCompile(`(\d+(?:\.\d)?)`) // simple fp number
var operators = "-+**/"

// prec returns the operator's precedence
func prec(op string) int {
	result := 0<commit_msg>update doco - supports ** exponent<commit_after>// Package evaler implements a simple fp arithmetic expression evaluator.
//
// Evaler uses Dijkstra's Shunting Yard algorithm [1] to convert an infix
// expression to postfix/RPN format [2], then evaluates the RPN expression.
//
// The operators supported are: + - * / ** and parentheses ().
//
// [1] http://en.wikipedia.org/wiki/Shunting-yard_algorithm
// [2] http://en.wikipedia.org/wiki/Reverse_Polish_notation

package evaler

import (
	"fmt"
	"github.com/soniah/evaler/stack"
	"math"
	"regexp"
	"strconv"
	"strings"
)

var whitespace_rx = regexp.MustCompile(`\s+`)
var fp_rx = regexp.MustCompile(`(\d+(?:\.\d)?)`) // simple fp number
var operators = "-+**/"

// prec returns the operator's precedence
func prec(op string) int {
	result := 0
{'fraction_non_alphanumeric': 0.15517241379310345, 'fraction_numerical': 0.006385696040868455, 'mean_word_length': 3.8067484662576687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '438344', 'n_tokens_mistral': 542, 'n_tokens_neox': 513, 'n_words': 146}