mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-10-16 16:18:20 +03:00
apply suggestions from @acoglio
This commit is contained in:
parent
d6d23f938b
commit
056905c5d0
@ -67,7 +67,7 @@ impl Deref for ArrayDimensions {
|
||||
}
|
||||
|
||||
impl ArrayDimensions {
|
||||
/// Construct a single-dimensional array-dimension.
|
||||
/// Returns a single-dimensional array dimension.
|
||||
pub fn single(dim: Dimension) -> Self {
|
||||
Self(smallvec![dim])
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ pub struct ArrayInitExpression {
|
||||
/// The dimensions of the array.
|
||||
///
|
||||
/// This could be a multi-dimensional array,
|
||||
/// e.g., `[42; (2, 2)]`, giving you a matrix `[[2, 2], [2, 2]]`.
|
||||
/// e.g., `[42; (2, 2)]`, giving you a matrix `[[42, 42], [42, 42]]`.
|
||||
pub dimensions: ArrayDimensions,
|
||||
/// The span of the entire expression from `[` to `]`.
|
||||
pub span: Span,
|
||||
|
@ -47,11 +47,11 @@ pub enum BinaryOperation {
|
||||
Le,
|
||||
/// Lesser-than relation, i.e. `<`.
|
||||
Lt,
|
||||
/// Bitwise-or, i.e., `|`.
|
||||
/// Bitwise-or inclusive, i.e., `|`.
|
||||
BitOr,
|
||||
/// Bitwise-and, i.e., `&`.
|
||||
BitAnd,
|
||||
/// Bitwise-or, i.e., `^`.
|
||||
/// Bitwise-or exclusive, i.e., `^`.
|
||||
BitXor,
|
||||
/// Shift-right, i.e `>>`.
|
||||
Shr,
|
||||
|
@ -16,15 +16,15 @@
|
||||
|
||||
use super::*;
|
||||
|
||||
/// The unary operator for an unary expression.
|
||||
/// A unary operator for a unary expression.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum UnaryOperation {
|
||||
/// The logical not operator, i.e., `!`.
|
||||
/// The logical negation operator, i.e., `!`.
|
||||
/// For example, it transforms `true` to `false`.
|
||||
Not,
|
||||
/// The negation operator, i.e., `-`.
|
||||
/// The arithmetic negation operator, i.e., `-`.
|
||||
Negate,
|
||||
/// The bitwise not operator, i.e., `~`.
|
||||
/// The bitwise negation operator, i.e., `~`.
|
||||
/// For example, it transforms `1010` to `0101`.
|
||||
BitNot,
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ pub enum ValueExpression {
|
||||
/// A char literal, e.g., `'a'`, representing a single unicode code point.
|
||||
Char(CharValue),
|
||||
/// A field literal, e.g., `42field`.
|
||||
/// That is, an unsigned number followed by the keyword `field`.
|
||||
/// That is, a signed number followed by the keyword `field`.
|
||||
Field(
|
||||
#[serde(with = "leo_span::tendril_json")] StrTendril,
|
||||
#[serde(with = "leo_span::span_json")] Span,
|
||||
),
|
||||
/// A group literal, either single or tuple.
|
||||
/// A group literal, either product or affine.
|
||||
/// For example, `42group` or `(12, 52)group`.
|
||||
Group(Box<GroupValue>),
|
||||
/// A negated non-integer literal, e.g., `-4.2`.
|
||||
|
@ -31,7 +31,7 @@ pub struct Function {
|
||||
pub identifier: Identifier,
|
||||
/// The function's parameters.
|
||||
pub input: Vec<FunctionInput>,
|
||||
/// WHether the function is `const`.
|
||||
/// The function returns a constant value.
|
||||
pub const_: bool,
|
||||
/// The function return type, if explicitly specified, or `()` if not.
|
||||
pub output: Option<Type>,
|
||||
|
@ -24,7 +24,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
use tendril::StrTendril;
|
||||
|
||||
/// A coordinate in a tuple group literal.
|
||||
/// A coordinate in a affine group literal.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum GroupCoordinate {
|
||||
/// A number, e.g., `42`.
|
||||
|
@ -27,12 +27,12 @@ use tendril::StrTendril;
|
||||
/// A group literal.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum GroupValue {
|
||||
/// Single group literal, e.g., `42group`.
|
||||
/// Product group literal, e.g., `42group`.
|
||||
Single(
|
||||
#[serde(with = "leo_span::tendril_json")] StrTendril,
|
||||
#[serde(with = "leo_span::span_json")] Span,
|
||||
),
|
||||
/// A tuple group literal with (x, y) coordinates.
|
||||
/// An affine group literal with (x, y) coordinates.
|
||||
Tuple(GroupTuple),
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ impl fmt::Display for GroupValue {
|
||||
}
|
||||
}
|
||||
|
||||
/// A group tuple literal, e.g., `(42, 24)group`.
|
||||
/// An affine group literal, e.g., `(42, 24)group`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct GroupTuple {
|
||||
/// The left component of the type, e.g., `42` in the case above.
|
||||
|
@ -31,7 +31,7 @@ pub struct Program {
|
||||
/// The name of the program.
|
||||
/// Empty after parsing.
|
||||
pub name: String,
|
||||
/// Expected function inputs.
|
||||
/// Expected main function inputs.
|
||||
/// Empty after parsing.
|
||||
pub expected_input: Vec<FunctionInput>,
|
||||
/// The collected import statements.
|
||||
|
@ -29,15 +29,15 @@ pub use assignee::*;
|
||||
pub enum AssignOperation {
|
||||
/// Plain assignment, `=`.
|
||||
Assign,
|
||||
/// Add-assignment, `+=`.
|
||||
/// Adding assignment, `+=`.
|
||||
Add,
|
||||
/// Subtracting assignment, `-=`.
|
||||
Sub,
|
||||
/// Multiplicating assignment, `*=`.
|
||||
/// Multiplying assignment, `*=`.
|
||||
Mul,
|
||||
/// Divising-assignment, `/=`.
|
||||
/// Dividing-assignment, `/=`.
|
||||
Div,
|
||||
/// Exponentating assignment `**=`.
|
||||
/// Exponentiating assignment `**=`.
|
||||
Pow,
|
||||
/// Logical or assignment.
|
||||
Or,
|
||||
|
@ -28,13 +28,13 @@ pub enum Type {
|
||||
// Data types
|
||||
/// The `address` type.
|
||||
Address,
|
||||
/// The boolean `bool` type.
|
||||
/// The `bool` type.
|
||||
Boolean,
|
||||
/// The `char` type.
|
||||
Char,
|
||||
/// The `field` type.
|
||||
Field,
|
||||
/// The `group` type for expressions like `(42, 24)group`.
|
||||
/// The `group` type.
|
||||
Group,
|
||||
/// An integer type.
|
||||
IntegerType(IntegerType),
|
||||
|
Loading…
Reference in New Issue
Block a user