tinyscript 0.6.1

Tiny, C-like scripting language.
Documentation
// Copyright © 2025 Stephan Kunz
//! Precedence definitions for the Pratt-[`Parser`](crate::compilation::Parser)
//!
//! Defines the different precedence levels used by the infix parsers.
//! These determine how a series of infix expressions will be grouped.
//! For example, "a + b * c - d" will be parsed as "(a + (b * c)) - d"
//! because "*" has higher precedence than "+" and "-".
//! Inn case of same precedence the source is parsed from left to right.
//! Here a bigger enum value is higher precedence.

/// Precedence levels
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum Precedence {
	None = 0,
	Assignment,
	Ternary,
	Or,
	And,
	BitOr,
	BitXor,
	BitAnd,
	Equality,
	Comparison,
	Term,
	Factor,
	Unary,
}

#[cfg(test)]
mod tests {
	use super::*;

	// check, that the auto traits are available
	const fn is_normal<T: Sized + Send + Sync>() {}

	#[test]
	const fn normal_types() {
		is_normal::<&Precedence>();
		is_normal::<Precedence>();
	}
}