lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

commit d5404886928eab0216cccb3dc88020391b36f4a7
parent 5475f4bdc98f3d89c5eac9c449c5a4d39e022b71
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Thu, 10 Feb 2022 13:55:31 +0100

Fix code formatting in lecture 2

Diffstat:
Mcontent/advanced-logic-notes/lecture-2/index.md | 31++++++++++++++++++-------------
Rcontent/advanced-logic-notes/lecture-2/digraph.svg -> content/advanced-logic-notes/lecture-2/states.svg | 0
Msass/_base.scss | 3+++
Asyntaxes/plantuml.sublime-syntax | 143+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 164 insertions(+), 13 deletions(-)

diff --git a/content/advanced-logic-notes/lecture-2/index.md b/content/advanced-logic-notes/lecture-2/index.md @@ -45,12 +45,13 @@ A strategy for player P is subset of steps for P, and it's a winning strategy if ### Example Diagram: -![Diagram](digraph.svg) +![States](states.svg) + <details> -<summary>PlantUML/Dot code</summary> -```plantuml -@startdot -digraph example { +<summary>Dot code</summary> + +```dot +digraph states { 1 -> 2 1 -> 3 2 -> 3 @@ -59,22 +60,24 @@ digraph example { 4 -> 2 4 -> 3 } -@enddot ``` -</details> -formula ◇ p ∨ □ ◇ p, in state 2. +Generated with PlantUML, surround it with `@startdot` and `@enddot`. + +</details> -p is true in state 3. +Given: +- formula ◇ p ∨ □ ◇ p, in state 2. +- p is true in state 3. Complete game tree: ![Game tree](tree.svg) <details> -<summary>PlantUML/Dot code</summary> -```plantuml -@startdot +<summary>Dot code</summary> + +```dot digraph gametree { top [label="[V] ◇ p ∨ □ ◇ p, 2"] l11 [label="[V] ◇ p, 2"] @@ -96,8 +99,10 @@ digraph gametree { l32 -> l41 l33 -> l42 } -@enddot ``` + +Generated with PlantUML, surround it with `@startdot` and `@enddot`. + </details> ## Truth and validity diff --git a/content/advanced-logic-notes/lecture-2/digraph.svg b/content/advanced-logic-notes/lecture-2/states.svg diff --git a/sass/_base.scss b/sass/_base.scss @@ -184,3 +184,6 @@ table { text-decoration: underline; } } +details summary { + cursor: pointer; +} diff --git a/syntaxes/plantuml.sublime-syntax b/syntaxes/plantuml.sublime-syntax @@ -0,0 +1,143 @@ +%YAML 1.2 +--- +# See http://www.sublimetext.com/docs/3/syntax.html +name: DiagramEx +file_extensions: + - wsd + - uml + - puml + - plantuml +scope: source.wsd + +variables: + obj_name: '(?xi) [a-z_] [a-z_0-9]*' + color: '(?xi) \# (?: \d+ | {{obj_name}} )' + known_color: |- + (?xi) (?: + AliceBlue | AntiqueWhite | Aqua | Aquamarine | Azure | Beige | Bisque | Black | BlanchedAlmond | Blue | BlueViolet | + Brown | BurlyWood | CadetBlue | Chartreuse | Chocolate | Coral | CornflowerBlue | Cornsilk | Crimson | Cyan | DarkBlue | + DarkCyan | DarkGoldenRod | DarkGray | DarkGreen | DarkGrey | DarkKhaki | DarkMagenta | DarkOliveGreen | DarkOrchid | DarkRed | + DarkSalmon | DarkSeaGreen | DarkSlateBlue | DarkSlateGray | DarkSlateGrey | DarkTurquoise | DarkViolet | Darkorange | DeepPink | + DeepSkyBlue | DimGray | DimGrey | DodgerBlue | FireBrick | FloralWhite | ForestGreen | Fuchsia | Gainsboro | GhostWhite | Gold | + GoldenRod | Gray | Green | GreenYellow | Grey | HoneyDew | HotPink | IndianRed | Indigo | Ivory | Khaki | Lavender | LavenderBlush | + LawnGreen | LemonChiffon | LightBlue | LightCoral | LightCyan | LightGoldenRodYellow | LightGray | LightGreen | LightGrey | + LightPink | LightSalmon | LightSeaGreen | LightSkyBlue | LightSlateGray | LightSlateGrey | LightSteelBlue | LightYellow | Lime | + LimeGreen | Linen | Magenta | Maroon | MediumAquaMarine | MediumBlue | MediumOrchid | MediumPurple | MediumSeaGreen | + MediumSlateBlue | MediumSpringGreen | MediumTurquoise | MediumVioletRed | MidnightBlue | MintCream | MistyRose | Moccasin | + NavajoWhite | Navy | OldLace | Olive | OliveDrab | Orange | OrangeRed | Orchid | PaleGoldenRod | PaleGreen | PaleTurquoise | + PaleVioletRed | PapayaWhip | PeachPuff | Peru | Pink | Plum | PowderBlue | Purple | Red | RosyBrown | RoyalBlue | SaddleBrown | + Salmon | SandyBrown | SeaGreen | SeaShell | Sienna | Silver | SkyBlue | SlateBlue | SlateGray | SlateGrey | Snow | SpringGreen | + SteelBlue | Tan | Teal | Thistle | Tomato | Turquoise | Violet | Wheat | White | WhiteSmoke | Yellow | YellowGreen + ) + + +contexts: + main: + - match: (?xi) ^ \s* ( \# | ' ) (?!.*') + scope: comment.line.source.wsd + push: + - meta_scope: comment.line.source.wsd + - match: \n + pop: true + + - match: |- + (?xi) ^ \s* + \b ( + abstract | actor | artifact | class | component | database | + enum | interface | object | package | participant | state | + usecase + ) \b + scope: support.function.source.wsd + push: + - match: '(.*)(\{)' + captures: + 1: entity.name.class.wsd entity.name.struct.wsd + push: + - meta_scope: meta.block.wsd + - include: all_reamaining + - match: '\}' + pop: true + - match: '' + pop: true + + - include: all_reamaining + + # control keywords + - match: |- + (?xi) ^ \s* ( + @enduml | @startuml | activate | again | also | alt | as | autonumber | bottom | box | break | + center | create | critical | deactivate | destroy | down | else | end | endif | endwhile | footbox | + footer | fork | group | header | hide | if | is | left | link | loop | namespace | + newpage | note | of | on | opt | over | page | par | partition | ref | repeat | + return | right | rotate | show | skin | skinparam | start | stop | title | top to bottom direction | top | + up | while + )\b + scope: keyword.control.source.wsd + + - match: (?xi) \b {{obj_name}} \b + scope: variable.parameter.source.wsd + + + all_reamaining: + - match: (?xi) ^ \b title \b + scope: string.quoted.double.source.wsd + push: + - match: '\n' + scope: keyword.control.source.wsd + pop: true + + # known colors + - match: '{{known_color}}' + scope: variable.source.wsd + + - match: |- + (?xi) ^ \s* ( [\w\_\-]+ ) \s* + ( + (?:["'].*?["'])? \s* + (?: + [\<\}\*o\.\+x\^\#\ ] (?:[\-\-]|[\.\.]){2}?\*? + | \*?(?:[\-\-]|[\.\.]){2} [\{\>\*o\.\+x\^\#\ ] + + | [\<\{\*o\.\+x\^\#]\|?[-\.]? ([^\|\-\s\.]*)[\-\.] + | [\-\.]([^\|\-\s\.]*) [-\.]?\|?[\*o\.\+x\^\#\{\>] + ) + \s* (?:["'].*?["'])? \s* ( [\w\_\-]+ ) + ) + captures: + 1: entity.name.function.wsd + 2: string.quoted.double.source.wsd + 3: keyword.control.source.wsd + 4: keyword.control.source.wsd + 5: entity.name.function.wsd + push: + - meta_scope: constant.string.source.wsd + - match: ':' + scope: keyword.control.source.wsd + - match: \n + pop: true + + - match: (?xi) ^ ( {{obj_name}} ) [ \t]* (:) + captures: + 1: entity.name.function.wsd + 2: keyword.control.source.wsd + push: + - meta_scope: string.quoted.double.source.wsd + - match: \n + pop: true + + - match: \" + scope: string.quoted.double.source.wsd + push: + - meta_scope: string.quoted.double.source.wsd + - match: \" + pop: true + + - match: \' + scope: string.quoted.single.source.wsd + push: + - meta_scope: string.quoted.single.source.wsd + - match: \' + pop: true + + - match: (?xi) \b {{obj_name}} \b + scope: constant.string.source.wsd