===========
Single knot
===========

=== teäst ===

--------------------------------------------------------------------------------

(program
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))))

===========
Next knot
===========

=== test ===
=== test ===

--------------------------------------------------------------------------------

(program
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))))

=================
Knot and stitches
=================

=== test ===
=== test ===
 = test
asd
 = test
asd

--------------------------------------------------------------------------------

(program
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))
    (stitch
      (stitch_header
        (stitch_start)
        (identifier)
        (line_end))
      (weave_body
        (weave_body_line
          (line_start)
          (dialog_text
            (text
              (vocabulary)))
          (line_end))))
    (stitch
      (stitch_header
        (stitch_start)
        (identifier)
        (line_end))
      (weave_body
        (weave_body_line
          (line_start)
          (dialog_text
            (text
              (vocabulary)))
          (line_end))))))

=====================
Knot with simple body
=====================

=== test ===
body
=== test ===

--------------------------------------------------------------------------------

(program
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))
    (weave_body
      (weave_body_line
        (line_start)
        (dialog_text
          (text
            (vocabulary)))
        (line_end))))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))))

======
Divert
======

asdf-sdf -> test
=== test ===
test -> test.bla

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary))
        (divert_or_thread
          (divert_chain
            (divert
              (arrow)
              (identifier_path
                (identifier))))))
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))
    (weave_body
      (weave_body_line
        (line_start)
        (dialog_text
          (text
            (vocabulary))
          (divert_or_thread
            (divert_chain
              (divert
                (arrow)
                (identifier_path
                  (identifier)
                  (dot)
                  (identifier))))))
        (line_end)))))

================
Illegal divert 1
================

asdsdf -> test.bla asdf
=== huhu ===

--------------------------------------------------------------------------------

    (program
      (weave_body
        (weave_body_line
          (line_start)
          (dialog_text
            (text
              (vocabulary))
            (divert_or_thread
              (divert_chain
                (divert
                  (arrow)
                  (identifier_path
                    (identifier)
                    (dot)
                    (ERROR
                      (identifier))
                    (identifier))))))
          (line_end)))
      (knot
        (knot_header
          (knot_start)
          (identifier)
          (line_end))))

================
Illegal divert 2
================

asdsdf ->
=== huhu ===

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)))
      (ERROR
        (arrow))
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))))

===========
End newline
===========

=== teet ===


--------------------------------------------------------------------------------

(program
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))))

=========
End space
=========

=== teet ===
 

--------------------------------------------------------------------------------

(program
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))
    (weave_body)))

==========
Empty line
==========

=== teet ===
a

b

--------------------------------------------------------------------------------

(program
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))
    (weave_body
      (weave_body_line
        (line_start)
        (dialog_text
          (text
            (vocabulary)))
        (line_end))
      (weave_body_line
        (line_start)
        (dialog_text
          (text
            (vocabulary)))
        (line_end)))))

=============
Spaces at end
=============
a 

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)))
      (line_end))))

========
Function
========

=== function asd() ===
a


a

--------------------------------------------------------------------------------

(program
  (function
    (function_header
      (function_start)
      (identifier)
      (line_end))
    (weave_body
      (weave_body_line
        (line_start)
        (dialog_text
          (text
            (vocabulary)))
        (line_end))
      (weave_body_line
        (line_start)
        (dialog_text
          (text
            (vocabulary)))
        (line_end)))))

===============
Function spaces
===============

=== function asd ( asd , sd ) ===
a

--------------------------------------------------------------------------------

(program
  (function
    (function_header
      (function_start)
      (identifier)
      (arguments
        (argument
          (identifier))
        (argument
          (identifier)))
      (line_end))
    (weave_body
      (weave_body_line
        (line_start)
        (dialog_text
          (text
            (vocabulary)))
        (line_end)))))

=====================
Function space at end
=====================

=== function asd ( asd , sd ) 
a
--------------------------------------------------------------------------------

(program
  (function
    (function_header
      (function_start)
      (identifier)
      (arguments
        (argument
          (identifier))
        (argument
          (identifier)))
      (line_end))
    (weave_body
      (weave_body_line
        (line_start)
        (dialog_text
          (text
            (vocabulary)))
        (line_end)))))

=======
Numbers
=======

11
1
=== 1sadf ===

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)))
      (line_end))
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)))
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))))

======
Colons
======

1:
=== test ====
- 1:

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)
          (other)))
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))
    (weave_body
      (weave_body_line
        (line_start)
        (gather_text
          (gather_mark)
          (dialog_text
            (text
              (vocabulary)
              (other))))
        (line_end)))))

=====================
Condition text (TODO)
=====================

 {test:
asdf
 }

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (condition_text
          (condition_block
            (condition_block_content
              (block_remainder))
            (line_end)
            (line_start)
            (condition_block_content
              (block_remainder))
            (line_end)
            (line_start))))
      (line_end))))

=========================
Condition text rem (TODO)
=========================

{test:
asdf
} rest

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (condition_text
          (condition_block
            (condition_block_content
              (block_remainder))
            (line_end)
            (line_start)
            (condition_block_content
              (block_remainder))
            (line_end)
            (line_start))
          (text
            (vocabulary))))
      (line_end))))

==========================
Condition text nest (TODO)
==========================

{test:
  - {test2:
  asdf
  }
}

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (condition_text
          (condition_block
            (condition_block_content
              (block_remainder))
            (line_end)
            (line_start)
            (condition_block_content
              (block_remainder)
              (condition_block
                (condition_block
                  (condition_block_content
                    (block_remainder))
                  (line_end)
                  (line_start)
                  (condition_block_content
                    (block_remainder))
                  (line_end)
                  (line_start))))
            (line_end)
            (line_start))))
      (line_end))))

=================================
Condition text nest inline (TODO)
=================================

{test:
  {test2:asdf}
}

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (condition_text
          (condition_block
            (condition_block_content
              (block_remainder))
            (line_end)
            (line_start)
            (condition_block_content
              (inline_block
                (block_remainder)))
            (line_end)
            (line_start))))
      (line_end))))

===========
Multidivert
===========

->a
->a->
->a->b->c.d
->a->->
->->
->a->b->c->->

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (divert_or_thread
          (divert_chain
            (divert
              (arrow)
              (identifier_path
                (identifier))))))
      (line_end))
    (weave_body_line
      (line_start)
      (dialog_text
        (divert_or_thread
          (divert_chain
            (divert
              (arrow)
              (identifier_path
                (identifier)))
            (divert_continue
              (arrow)))))
      (line_end))
    (weave_body_line
      (line_start)
      (dialog_text
        (divert_or_thread
          (divert_chain
            (divert
              (arrow)
              (identifier_path
                (identifier)))
            (divert
              (arrow)
              (identifier_path
                (identifier)))
            (divert
              (arrow)
              (identifier_path
                (identifier)
                (dot)
                (identifier))))))
      (line_end))
    (weave_body_line
      (line_start)
      (dialog_text
        (divert_or_thread
          (divert_chain
            (divert
              (arrow)
              (identifier_path
                (identifier)))
            (divert_return
              (double_arrow)))))
      (line_end))
    (weave_body_line
      (line_start)
      (dialog_text
        (divert_or_thread
          (divert_chain
            (divert_return
              (double_arrow)))))
      (line_end))
    (weave_body_line
      (line_start)
      (dialog_text
        (divert_or_thread
          (divert_chain
            (divert
              (arrow)
              (identifier_path
                (identifier)))
            (divert
              (arrow)
              (identifier_path
                (identifier)))
            (divert
              (arrow)
              (identifier_path
                (identifier)))
            (divert_return
              (double_arrow)))))
      (line_end))))

===================
Illegal multidivert
===================

->->a
->a->->b

--------------------------------------------------------------------------------

    (program
      (weave_body
        (weave_body_line
          (line_start)
          (dialog_text
            (divert_or_thread
              (divert_chain
                (divert_return
                  (double_arrow)))))
          (ERROR
            (identifier))
          (line_end))
        (weave_body_line
          (line_start)
          (dialog_text
            (divert_or_thread
              (divert_chain
                (divert
                  (arrow)
                  (identifier_path
                    (identifier)))
                (divert_return
                  (double_arrow)))))
          (ERROR
            (identifier))
          (line_end))))

===
VAR
===

VAR huhu = 1
=== huhu ===
VAR huhu = 1
= huhu
VAR huhu = 1
=== function sdf() ===
VAR huhu = 1

--------------------------------------------------------------------------------

(program
  (weave_body
    (var_line
      (var_start)
      (identifier)
      (assignment)
      (value
        (number))
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))
    (weave_body
      (var_line
        (var_start)
        (identifier)
        (assignment)
        (value
          (number))
        (line_end)))
    (stitch
      (stitch_header
        (stitch_start)
        (identifier)
        (line_end))
      (weave_body
        (var_line
          (var_start)
          (identifier)
          (assignment)
          (value
            (number))
          (line_end)))))
  (function
    (function_header
      (function_start)
      (identifier)
      (line_end))
    (weave_body
      (var_line
        (var_start)
        (identifier)
        (assignment)
        (value
          (number))
        (line_end)))))

=====
CONST
=====

CONST huhu = 1
=== huhu ===
CONST huhu = 1
= huhu
CONST huhu = 1
=== function sdf() ===
CONST huhu = 1

--------------------------------------------------------------------------------

(program
  (weave_body
    (const_line
      (const_start)
      (identifier)
      (assignment)
      (value
        (number))
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (identifier)
      (line_end))
    (weave_body
      (const_line
        (const_start)
        (identifier)
        (assignment)
        (value
          (number))
        (line_end)))
    (stitch
      (stitch_header
        (stitch_start)
        (identifier)
        (line_end))
      (weave_body
        (const_line
          (const_start)
          (identifier)
          (assignment)
          (value
            (number))
          (line_end)))))
  (function
    (function_header
      (function_start)
      (identifier)
      (line_end))
    (weave_body
      (const_line
        (const_start)
        (identifier)
        (assignment)
        (value
          (number))
        (line_end)))))

==============
Block commment
==============

test /* asdf */ bla
=== /** other* */ hello ===

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)
          (block_comment
            (block_comment_start)
            (block_comment_end))
          (vocabulary)))
      (line_end)))
  (knot
    (knot_header
      (knot_start)
      (block_comment
        (block_comment_start)
        (block_comment_end))
      (identifier)
      (line_end))))

===================
Block commment nest
===================

test /* asdf /* test */ */ bla

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)
          (block_comment
            (block_comment_start)
            (block_comment
              (block_comment_start)
              (block_comment_end))
            (block_comment_end))
          (vocabulary)))
      (line_end))))

============
Line comment
============

asdf // asdf
CONST test = 1

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)))
      (line_comment)
      (line_end))
    (const_line
      (const_start)
      (identifier)
      (assignment)
      (value
        (number))
      (line_end))))

====
LIST
====

LIST HuHu = HuHa, (HuHe)
--------------------------------------------------------------------------------

(program
  (weave_body
    (list_line
      (list_start)
      (identifier)
      (assignment)
      (list
        (marked_identifier
          (identifier))
        (marked_identifier
          (mark_start)
          (identifier)
          (mark_end)))
      (line_end))))

============
Inline block
============

asdf {teer} asdf

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)
          (inline_block
            (block_remainder))
          (vocabulary)))
      (line_end))))

===================
Inline block nested
===================

asdf {teer:{test:asdf|asdf}|asd} asdf

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)
          (inline_block
            (block_remainder)
            (inline_block
              (block_remainder))
            (block_remainder))
          (vocabulary)))
      (line_end))))

====
Hide
====

* [Hide] me

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (option_text
        (option_mark)
        (option_words
          (words
            (hide_start)
            (vocabulary)
            (hide_end)
            (vocabulary))))
      (line_end))))

============
Hide problem
============

+ [<b>◉</b> Beschreibung] ->e->Schau->Basis

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (option_text
        (option_mark)
        (option_words
          (words
            (hide_start)
            (word_other)
            (vocabulary)
            (word_other)
            (vocabulary)
            (word_other)
            (vocabulary)
            (hide_end))
          (divert_or_thread
            (divert_chain
              (divert
                (arrow)
                (identifier_path
                  (identifier)))
              (divert
                (arrow)
                (identifier_path
                  (identifier)))
              (divert
                (arrow)
                (identifier_path
                  (identifier)))))))
      (line_end))))

==============
Default option
==============

* ->
* asdf ->

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (option_text
        (option_mark)
        (option_words
          (default_option_mark
            (arrow))))
      (line_end))
    (weave_body_line
      (line_start)
      (option_text
        (option_mark)
        (option_words
          (words
            (vocabulary))
          (default_option_mark
            (arrow))))
      (line_end))))

==========
Option bug
==========

** huhu
* * huhu

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (option_text
        (option_mark)
        (option_mark)
        (option_words
          (words
            (vocabulary))))
      (line_end))
    (weave_body_line
      (line_start)
      (option_text
        (option_mark)
        (option_mark)
        (option_words
          (words
            (vocabulary))))
      (line_end))))

====
Tags
====

#tag: text

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (tag
          (identifier)
          (tag_delimiter)
          (tag_remainder)))
      (line_end))))

====
Glue
====

<> asdf
asdf <> asdf
* asdf <> asd

--------------------------------------------------------------------------------

(program
  (weave_body
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (glue)
          (vocabulary)))
      (line_end))
    (weave_body_line
      (line_start)
      (dialog_text
        (text
          (vocabulary)
          (glue)
          (vocabulary)))
      (line_end))
    (weave_body_line
      (line_start)
      (option_text
        (option_mark)
        (option_words
          (words
            (vocabulary)
            (glue)
            (vocabulary))))
      (line_end))))
