module Novika::Form
Overview
Form is an umbrella for words and blocks. Since some words (like numbers, quotes) are just too different from words as we know them, they have their own types directly subordinate to Form.
Make sure to override self.typedesc
to avoid weird unrelated
Crystal errors. Crystal breaks at class-level inheritance.
Included Modules
Direct including types
- Novika::Block
- Novika::Boolean
- Novika::Builtin
- Novika::Byteslice
- Novika::Color
- Novika::Decimal
- Novika::Error
- Novika::ForeignFunction
- Novika::Hole
- Novika::Library
- Novika::Quote
- Novika::QuotedWord
- Novika::StructLayoutForm
- Novika::StructViewForm
- Novika::Word
Defined in:
novika/forms/form.crInstance Method Summary
-
#a(type : T.class) : T forall T
Asserts that this form is of the given type.
-
#desc(io : IO)
Appends a string description of this form to io.
-
#desc : String
Returns a string description of this form.
-
#die(details : String)
Raises an
Error
providing details. -
#effect(io)
Generates and returns a description for the stack effect of this form.
-
#effect
Generates and returns a description for the stack effect of this form.
-
#on_open(engine : Engine) : self
Reacts to this form being opened with engine.
-
#on_parent_open(engine : Engine) : self
Reacts to this form's enclosing block being opened with engine.
-
#onto(block : Block) : self
Adds this form to block.
-
#sel(a, b)
Selects either a or b.
-
#to_quote : Quote
Returns this form's quote representation.
Instance methods inherited from module Novika::Schedulable
schedule(engine : Engine, stack : Block)
schedule,
schedule!(engine : Engine, stack : Block)
schedule!
Instance Method Detail
Asserts that this form is of the given type. Dies if it's not.
Generates and returns a description for the stack effect of this form.
For blocks and builtins, tries to extract a ( ... -- ... )
(but see EFFECT_PATTERN
) from their corresponding
comment. If could not extract or no comment, returns
'a block' for blocks and 'native code' for builtins.
Generates and returns a description for the stack effect of this form.
For blocks and builtins, tries to extract a ( ... -- ... )
(but see EFFECT_PATTERN
) from their corresponding
comment. If could not extract or no comment, returns
'a block' for blocks and 'native code' for builtins.
Reacts to this form's enclosing block being opened with engine.