NAlternative

NodeAstNodeloreline.NAlternative (Class)

Represents an alternative block (sequence, cycle, once, pick, shuffle).

Instance Members

The alternative mode (sequence, cycle, once, pick, shuffle).


items: Array<NBlock>

Array of item blocks. Each item is a block of statements.


The block style (indented or braces).


separatorComments: Null<Array<Array<Comment>>>

Comments that appear before separator tokens.


type(): String
Returns
String

each(handleNode: Function): Void
Name Type
handleNode Function

toJson(): Dynamic

Converts the alternative block to a JSON representation.

Returns Description
Dynamic Dynamic object containing alternative data

new(id: NodeId, pos: Position, mode: AlternativeMode, items: Array<NBlock>, ?leadingComments: Array<Comment>, ?trailingComments: Array<Comment>): Void

Creates a new alternative block node.

Name Type Default Description
id NodeId The node ID
pos Position Position in source where this alternative appears
mode AlternativeMode The alternative mode
items Array<NBlock> Array of item blocks
leadingComments Array<Comment> (optional) Optional comments before the alternative
trailingComments Array<Comment> (optional) Optional comments after the alternative