Update coma example ⬆️
This commit is contained in:
parent
ed81049ddc
commit
927341d93a
@ -91,7 +91,7 @@ fn node(p: &mut Parser, at_start: &mut bool) -> Option<Node> {
|
||||
// Block.
|
||||
Token::LeftBrace => {
|
||||
*at_start = false;
|
||||
return Some(Node::Expr(block(p, false)?));
|
||||
return Some(Node::Expr(block(p, false)));
|
||||
}
|
||||
|
||||
// Template.
|
||||
@ -194,7 +194,7 @@ fn primary(p: &mut Parser) -> Option<Expr> {
|
||||
Some(Token::For) => expr_for(p),
|
||||
|
||||
// Structures.
|
||||
Some(Token::LeftBrace) => block(p, true),
|
||||
Some(Token::LeftBrace) => Some(block(p, true)),
|
||||
Some(Token::LeftBracket) => Some(template(p)),
|
||||
Some(Token::LeftParen) => Some(parenthesized(p)),
|
||||
|
||||
@ -238,7 +238,7 @@ fn template(p: &mut Parser) -> Expr {
|
||||
}
|
||||
|
||||
/// Parse a block expression: `{...}`.
|
||||
fn block(p: &mut Parser, scopes: bool) -> Option<Expr> {
|
||||
fn block(p: &mut Parser, scopes: bool) -> Expr {
|
||||
p.start_group(Group::Brace, TokenMode::Code);
|
||||
let mut exprs = vec![];
|
||||
while !p.eof() {
|
||||
@ -253,7 +253,7 @@ fn block(p: &mut Parser, scopes: bool) -> Option<Expr> {
|
||||
p.skip_white();
|
||||
}
|
||||
let span = p.end_group();
|
||||
Some(Expr::Block(ExprBlock { span, exprs, scoping: scopes }))
|
||||
Expr::Block(ExprBlock { span, exprs, scoping: scopes })
|
||||
}
|
||||
|
||||
/// Parse an expression.
|
||||
@ -434,7 +434,7 @@ fn ident(p: &mut Parser) -> Option<Ident> {
|
||||
fn body(p: &mut Parser) -> Option<Expr> {
|
||||
match p.peek() {
|
||||
Some(Token::LeftBracket) => Some(template(p)),
|
||||
Some(Token::LeftBrace) => block(p, true),
|
||||
Some(Token::LeftBrace) => Some(block(p, true)),
|
||||
_ => {
|
||||
p.expected_at("body", p.end());
|
||||
None
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 60 KiB |
@ -1,17 +1,36 @@
|
||||
#page(width: 450pt, height: 300pt, margins: 1cm)
|
||||
// Configuration with `page` and `font` functions.
|
||||
#page(width: 450pt, height: 380pt, margins: 1cm)
|
||||
#font("CMU Serif")
|
||||
|
||||
// There are variables and they can take normal values like strings, ...
|
||||
#let city = "Berlin"
|
||||
|
||||
// ... but also "template" values. While these contain markup,
|
||||
// they are also values and can be summed, stored in arrays etc.
|
||||
// There are also more standard control flow structures, like #if and #for.
|
||||
#let university = [*Technische Universität {city}*]
|
||||
#let faculty = [*Fakultät II, Institut for Mathematik*]
|
||||
|
||||
// The `box` function just places content into a rectangular container. When
|
||||
// the only argument to a function is a template, the parentheses can be omitted
|
||||
// (i.e. `f[a]` is the same as `f([a])`).
|
||||
#box[
|
||||
*Technische Universität Berlin* \
|
||||
*Fakultät II, Institut for Mathematik* \
|
||||
// Backslash adds a forced line break.
|
||||
#university \
|
||||
#faculty \
|
||||
Sekretariat MA \
|
||||
Dr. Max Mustermann \
|
||||
Ola Nordmann, John Doe
|
||||
]
|
||||
#align(right, box[*WiSe 2019/2020* \ Woche 3])
|
||||
#align(right, box([*WiSe 2019/2020* \ Woche 3]))
|
||||
|
||||
// Adds vertical spacing.
|
||||
#v(6mm)
|
||||
|
||||
// If the last argument to a function is a template, we can also place it behind
|
||||
// the parentheses.
|
||||
#align(center)[
|
||||
// Markdown-like syntax for headings.
|
||||
==== 3. Übungsblatt Computerorientierte Mathematik II #v(2mm)
|
||||
*Abgabe: 03.05.2019* (bis 10:10 Uhr in MA 001) #v(2mm)
|
||||
*Alle Antworten sind zu beweisen.*
|
||||
@ -23,3 +42,9 @@ Ein _Binärbaum_ ist ein Wurzelbaum, in dem jeder Knoten ≤ 2 Kinder hat.
|
||||
Die Tiefe eines Knotens _v_ ist die Länge des eindeutigen Weges von der Wurzel
|
||||
zu _v_, und die Höhe von _v_ ist die Länge eines längsten (absteigenden) Weges
|
||||
von _v_ zu einem Blatt. Die Höhe des Baumes ist die Höhe der Wurzel.
|
||||
|
||||
#v(6mm)
|
||||
|
||||
// The `image` function returns a "template" value of the same type as
|
||||
// the `[...]` literals.
|
||||
#align(center, image("res/graph.png", width: 75%))
|
||||
|
BIN
tests/res/graph.png
Normal file
BIN
tests/res/graph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue
Block a user