diff --git a/src/instruction/if_else.rs b/src/instruction/if_else.rs index 1391c0d8..3cf847c7 100644 --- a/src/instruction/if_else.rs +++ b/src/instruction/if_else.rs @@ -1,7 +1,7 @@ //! `IfElse`s are used to represent an if/else statement in the source code. They have //! a condition, a body and an optional else body. //! -//! ``` +//! ```ignore //! if condition { //! condition_evaluates_to_true(); //! } else { @@ -11,7 +11,7 @@ //! //! They can be used to return values, just like you would with any block. //! -//! ``` +//! ```ignore //! x = if condition { 12 } else { 13 }; //! ``` diff --git a/src/instruction/jk_return.rs b/src/instruction/jk_return.rs index ce876143..cd27e759 100644 --- a/src/instruction/jk_return.rs +++ b/src/instruction/jk_return.rs @@ -1,11 +1,11 @@ //! Return construct is used to return early from a function -//! ``` +//! ```ignore //! return //! ``` //! //! It can be used to return values //! -//! ``` +//! ```ignore //! return 42 //! ``` diff --git a/src/instruction/rename.rs b/src/instruction/rename.rs index cdef8d44..55d373a4 100644 --- a/src/instruction/rename.rs +++ b/src/instruction/rename.rs @@ -15,7 +15,7 @@ //! //! For some simple constructs, this simply means renaming self's name, such as a TypeDec: //! -//! ``` +//! ```ignore //! // some_type.jk //! type SomeType(...); //! @@ -28,7 +28,7 @@ //! ``` //! //! Other instructions also have owernship of other instructions, such as blocks: -//! ``` +//! ```ignore //! // source.jk //! { // block enter //! type InBlock(...); diff --git a/src/parser/constructs.rs b/src/parser/constructs.rs index f775193a..0819ecc2 100644 --- a/src/parser/constructs.rs +++ b/src/parser/constructs.rs @@ -124,7 +124,7 @@ impl Construct { /// Parse a function call /// When a function is called in the source code. /// - /// ``` + /// ```ignore /// fn(); // Function call /// fn() // Call the function `fn` and use the return result as an instruction /// x = fn(); // Assign the result of the function call to the variable x @@ -169,14 +169,14 @@ impl Construct { /// When a variable is assigned a value. Ideally, a variable cannot be assigned the /// `void` type. /// - /// ``` + /// ```ignore /// x = 12; // Store 12 into the variable `x` /// x = 456; // Forbidden, `x` is immutable /// ``` /// /// A variable assignment is a Statement. It cannot be used as an Expression /// - /// ``` + /// ```ignore /// { /// x = 12; // Block returns void /// } @@ -346,7 +346,7 @@ impl Construct { /// When a type is instantiated in the source code. /// - /// ``` + /// ```ignore /// type A(n: int); // Declare type A /// val = A(1); // Instantiate a new A type variable /// ``` @@ -373,14 +373,14 @@ impl Construct { /// When a variable is assigned a value. Ideally, a variable cannot be assigned the /// `void` type. /// - /// ``` + /// ```ignore /// mut n = 12; // Store 12 into `n`, a mutable variable /// n = 1586; // Allowed /// ``` /// /// A variable assignment is a Statement. It cannot be used as an Expression /// - /// ``` + /// ```ignore /// { /// x = 12; // Block returns void /// } @@ -464,7 +464,7 @@ impl Construct { /// A block of code is a new inner scope that contains instructions. You can use /// them in If/Else blocks, in function declarations, or just as is. /// - /// ``` + /// ```ignore /// func return_nothing() { /// compute_stuff(); /// } // Block returns void, so does the function @@ -610,7 +610,7 @@ impl Construct { /// Parse a function declaration. This includes the function's signature and the /// associated code block /// - /// ``` + /// ```ignore /// func fn_name(arg0: int) -> int { /// do_something(arg0); /// @@ -635,7 +635,7 @@ impl Construct { /// invoke them. Therefore, naming the test the same as the tested function is fine /// and is not any form of overloading whatsoever. /// - /// ``` + /// ```ignore /// test add() { /// assert_eq(12 + 2, add(12, 2)); /// } @@ -665,8 +665,7 @@ impl Construct { /// Parse a mock declaration. This returns a FunctionDec as well, but of /// kind `FunctionDec::Mock`. /// - /// - /// ``` + /// ```ignore /// mock add(lhs: int, rhs: int) -> int { /// mock_stuff() /// } @@ -838,7 +837,7 @@ impl Construct { /// /// ` ` /// - /// ``` + /// ```ignore /// x + y; // Add x and y together /// a << 2; // Shift a by 2 bits /// a > 2; // Is a greater than 2? diff --git a/src/value/mod.rs b/src/value/mod.rs index f122e191..04faaf51 100644 --- a/src/value/mod.rs +++ b/src/value/mod.rs @@ -25,22 +25,6 @@ pub trait Value: Instruction { /// of a valid type. You cannot add multiple types together, except in one case: /// Adding a floating point number and an integer together. Doing that will /// return a new JkFloat. - /// - /// ``` - /// let ctx = Context::new(); - /// - /// let a = JkInt::from(126); - /// let b = JkInt::from(4); - /// - /// let res = a.do_op(b, Operator::Add); // JkInt(130) - /// assert_eq!(res.ty(), ctx.get_type("int")); - /// - /// let f = JkFloat::from(4.0); - /// - /// let res = a.do_op(f, Operator::Add); // JkFloat(130.0) - /// assert_eq!(res.ty(), ctx.get_type("float")); - /// ``` - // FIXME: Implement behavior defined here ^ fn do_op(&self, other: &Self, op: Operator) -> Result { self.no_op(other, op) }