Skip to content

Commit

Permalink
doc: Ignore doc tests that contain jinko code
Browse files Browse the repository at this point in the history
  • Loading branch information
CohenArthur committed Nov 11, 2021
1 parent 5e9d248 commit 5c880e9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/instruction/if_else.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 };
//! ```
Expand Down
4 changes: 2 additions & 2 deletions src/instruction/jk_return.rs
Original file line number Diff line number Diff line change
@@ -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
//! ```
Expand Down
4 changes: 2 additions & 2 deletions src/instruction/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(...);
//!
Expand All @@ -28,7 +28,7 @@
//! ```
//!
//! Other instructions also have owernship of other instructions, such as blocks:
//! ```
//! ```ignore
//! // source.jk
//! { // block enter
//! type InBlock(...);
Expand Down
23 changes: 11 additions & 12 deletions src/parser/constructs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
/// }
Expand Down Expand Up @@ -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
/// ```
Expand All @@ -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
/// }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
///
Expand All @@ -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));
/// }
Expand Down Expand Up @@ -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()
/// }
Expand Down Expand Up @@ -838,7 +837,7 @@ impl Construct {
///
/// `<expr> <op> <expr>`
///
/// ```
/// ```ignore
/// x + y; // Add x and y together
/// a << 2; // Shift a by 2 bits
/// a > 2; // Is a greater than 2?
Expand Down
16 changes: 0 additions & 16 deletions src/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ObjectInstance, Error> {
self.no_op(other, op)
}
Expand Down

0 comments on commit 5c880e9

Please sign in to comment.