Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Property in BasicBlock
Gets the index of the first instruction of the node that this block is in.
public int FirstInstructionIndex { get; set; }Property in Destination
The name of the node that this destination refers to.
public string NodeName { get; set; }Method in BasicBlock
Adds a new destination to this block, that points to a node.
public void AddDestination(string nodeName, Condition condition)string nodeName
The name of the destination node.
Class in
Inherits from
A command that will be executed.
Enumeration Member in
Field in
The string table ID of the line that will be shown to the player.
Field in
The collection of options that will be delivered to the player.
Enumeration Member in
Enumeration Member in
The Destination is reached beacuse of an explicit instruction to go to this block.
Property in
Gets all descendants (that is, destinations, and destinations of those destinations, and so on), recursively.
Cycles are detected and avoided.
Property in
Gets the name of the label that this block begins at, or null if this basic block does not begin at a labelled instruction.
Class in
Inherits from
A line of dialogue that should be shown to the player.
Property in
Gets all descendants (that is, destinations, and destinations of those destinations, and so on) that have any player-visible content, recursively.
Cycles are detected and avoided.
Field in
The text of the command.
Property in
The block that this destination refers to.
This value is only valid when is .
Property in
Gets a descriptive name for the block.
If this block begins at a labelled instruction, the name will be [NodeName].[LabelName] . Otherwise, it will be [NodeName].[FirstInstructionIndex] .
Enumeration Member in
The Destination is reached because the preceding BasicBlock reached the end of its execution, and the Destination's target is the block immediately following.
Property in
Gets the name of the node that this block is in.
Property in
Gets the collection of player-visible content that will be delivered when this block is run.
Player-visible content means lines, options and commands. When this block is run, the entire contents of this collection will be displayed to the player, in the same order as they appear in this collection.
If this collection is empty, then the block contains no visible content. This is the case for blocks that only contain logic, and do not contain any lines, options or commands.
To tell the difference between the different kinds of content, use the is operator to check the type of each item:
Property in
Gets the Instructions that form this block.
Property in
Gets the Destination's type - whether the destination is a block, or a node.
Enumeration Member in
The Destination is reached because the player made an in-game choice to go to it.
Struct in
Inherits from System.ValueType
Represents a single option that may be presented to the player.
Method in
Sets the of the .
Property in
The condition that causes this destination to be reached.
Yarn.Compiler.BasicBlock.Condition condition
The condition under which descendant will be run.
public class CommandElement : PlayerVisibleContentElementThe text of the command.
Nodepublic string LineID;public IEnumerable<Option> Options;BlockDirectJumppublic IEnumerable<BasicBlock> Descendants
{
get; }public string LabelName { get; set; }public class LineElement : PlayerVisibleContentElementThe string table ID of the line that will be shown to the player.
public IEnumerable<BasicBlock> DescendantsWithPlayerVisibleContent
{
get; }public string CommandText;public BasicBlock Block { get; set; }public string Name
{
get; }Fallthroughpublic string NodeName { get; set; }public IEnumerable<PlayerVisibleContentElement> PlayerVisibleContent
{
get; }public IEnumerable<Instruction> Instructions { get; set; };public DestinationType Type { get; set; }Optionstring sourceNodeName
The source node name to apply to the Declaration.
public Condition Condition { get; set; }Class in BasicBlock
Inherits from System.Object
An abstract class that represents some content that is shown to the player.
public abstract class PlayerVisibleContentElementThis class is used, rather than the runtime classes Yarn.Line or Yarn.OptionSet, because when the program is being analysed, no values for any substitutions are available. Instead, these classes represent the data that is available offline.
Field in CompilationJob
The File structs that represent the content to parse..
public IEnumerable<File> Files;Field in CompilationJob
The declarations for variables.
public IEnumerable<Declaration> VariableDeclarations;Field in CompilationJob
The Library that contains declarations for functions.
public Library Library;Enumeration Member in Type
The compiler will derive only the variable and function declarations, and file tags, found in the script.
DeclarationsOnlyProperty in CompilationResult
Gets a value indicating whether the compiler had to create line IDs for lines in the source code that lacked #line: tags.
public bool ContainsImplicitStringTags { get; internal set; }Every line is required to have a line ID. If a line doesn't have a line ID specified in the source code (via a #line: tag), the compiler will create one.
Implicit line IDs are guaranteed to remain the same between compilations when the source file does not change. If you want line IDs to remain the same when the source code may be modified in the future, add a #line: tag to the line. This may be done by hand, or added using the AddTagsToLines(string,ICollection<string>) method.
Property in CompilationResult
Gets the collection of DebugInfo objects for each node in Program .
public IReadOnlyDictionary<string, DebugInfo> DebugInfo { get; internal set; }Property in CompilationResult
public Dictionary<string, IEnumerable<string>> FileTags { get; internal set; }Property in CompilationResult
Gets the compiled Yarn program that the Compiler produced.
public Program Program { get; internal set; }This value will be null if there were errors in the compilation. If this is the case, Diagnostics will contain information describing the errors.
It will also be null if the CompilationJob object's CompilationType value was not FullCompilation.
Method in Compiler
public static string GetLineIDForNodeName(string name)string name
Field in LineInfo
The node name of the source that this intruction was produced from.
public string NodeName;Method in Declaration
public override bool Equals(object obj)object obj
Property in Declaration
Gets the name of this Declaration.
public string Name { get; internal set; }Property in Declaration
Gets the range of text at which this declaration occurs.
public Range Range { get; internal set; };This range refers to the declaration of the symbol itself, and not any syntax surrounding it. For example, the declaration <<declare $x = 1>> would have a Range referring to the $x symbol.
Property in BasicBlock
Get the ancestors of this block - that is, blocks that may run immediately before this block.
public IEnumerable<BasicBlock> Ancestors { get };Property in BasicBlock
Gets the destinations of this block - that is, blocks or nodes that may run immediately after this block.
public IEnumerable<Destination> Destinations { get };Destination: A destination represents a BasicBlock or node that may be run, following the execution of a BasicBlock .
Enumeration Member in Condition
The Destination is reached because an expression evaluated to true.
ExpressionIsTrueEnumeration Member in Condition
The Destination is reached because an expression evaluated to false.
ExpressionIsFalseField in Option
The destination that will be run if this option is selected by the player.
public string Destination;This will be the name of a label, or the name of a node.
Property in Declaration
Gets the line number at which this Declaration was found in the source file.
public int SourceFileLine { get };If this Declaration was not found in a Yarn source file, this will be -1.
Property in CompilationResult
Gets a dictionary mapping line IDs to StringInfo objects.
public IDictionary<string, StringInfo> StringTable { get; internal set; }The string table contains the extracted line text found in the provided source code. The keys of this dictionary are the line IDs for each line - either through explicit line tags indicated through the #line: tag, or implicitly-generated line IDs that the compiler added during compilation.
foreach (var item in block.PlayerVisibleContent) { if (item is
LineElement line) { // Do something with line } }public DeclarationBuilder WithSourceNodeName(string sourceNodeName)The destination that will be run if this option is selected by the player.
The string table ID that will be shown to the player.
public struct OptionMethod in BasicBlock
Adds a new destination to this block, that points to another block.
public void AddDestination(BasicBlock descendant, Condition condition)descendant
The new descendant node.
Class in Yarn.Compiler
Inherits from System.Object
A basic block is a run of instructions inside a Node. Basic blocks group instructions up into segments such that execution only ever begins at the start of a block (that is, a program never jumps into the middle of a block), and execution only ever leaves at the end of a block.
public class BasicBlockEnum in Destination
Inherits from System.Enum
The type of a Destination.
public enum DestinationType
{
Node,
Block
}Method in CompilationJob
Creates a new CompilationJob using the contents of a collection of files.
public static CompilationJob CreateFromFiles(params string[] paths)string[] paths
The paths to the files.
A new .
Struct in DebugInfo
Inherits from System.ValueType
Contains positional information about an instruction.
public struct LineInfoMethod in Declaration
Creates a new instance of the Declaration class, using the given name, type and default value.
public static Declaration CreateVariable(string name, Yarn.IType type, IConvertible defaultValue, string description = null)string name
A new instance of the class.
Struct in
Inherits from System.ValueType
A destination represents a or node that may be run, following the execution of a .
Destination objects represent links between blocks, or between blocks and nodes.
Method in
Creates a new using the contents of a collection of files.
Struct in
Inherits from System.ValueType
Represents the contents of a file to compile.
Method in
Creates a new using the contents of a string.
Enum in
Inherits from System.Enum
The type of compilation that the compiler will do.
Class in
Inherits from Yarn.Compiler.YarnSpinnerParserBaseListener
Compiles Yarn code.
Method in
Compiles Yarn code, as specified by a compilation job.
Method in
Flattens a tree of Antlr4.Runtime.Tree.IParseTree objects by recursively visiting their children, and converting them into a flat System.Collections.Generic.IEnumerable`1 .
Method in
Gets a object that describes the specified instruction at the index instructionNumber .
Method in
Sets the of the .
Class in
Inherits from
A collection of options that should be shown to the player.
Property in
Gets a string describing the purpose of this .
Property in
Gets the default value of this , if no value has been specified in code or is available from a 's .
Field in
The file name of the source that this intruction was produced from.
Property in
Property in
Gets the type of the variable, as represented by an object that implements .
Property in
Gets the collection of objects that describe problems in the source code.
If the compiler encounters errors while compiling source code, the it produces will have a value of null . To help figure out what the error is, users should consult the contents of this property.
Property in
Gets the name of the file in which this Declaration was found.
If this was not found in a Yarn source file, this will be .
Property in
Gets the name of the node in which this Declaration was found.
If this was not found in a Yarn source file, this will be null .
Field in
The zero-indexed line number in that contains the statement or expression that this line was produced from.
Property in
Gets the instance constructed by this .
Field in
The name of the file.
This may be a full path, or just the filename or anything in between. This is useful for diagnostics, and for attributing objects to their original source files.
Method in
Field in
The string used for if the Declaration was found outside of a Yarn source file.
The zero-indexed character number in FileName that contains the statement or expression that this line was produced from.
The file name of the source that this intruction was produced from.
The zero-indexed line number in FileName that contains the statement or expression that this line was produced from.
The node name of the source that this intruction was produced from.
The name of the new declaration.
Yarn.IType type
The type of the declaration.
System.IConvertible defaultValue
The default value of the declaration. This must be a string, a number (integer or floating-point), or boolean value.
string description
The description of the new declaration.
Yarn.Compiler.BasicBlock.Condition condition
The condition under which descendant will be run.
CompilationJob: An object that contains Yarn source code to compile, and instructions on how to compile it.
CompilationResult: The result of a compilation.
Yarn.Compiler.CompilationJob compilationJob
The compilation job to perform.
The root node to begin work from.
An System.Collections.Generic.IEnumerable`1 that contains a flattened version of the hierarchy rooted at node .
Antlr4.Runtime.Tree.IParseTree node
A LineInfo object that describes the position of the instruction.
int instructionNumber
The index of the instruction to retrieve information for.
string name
The name to apply to the Declaration.
public string Description { get; internal set; }public IConvertible DefaultValue { get; internal set; }public string FileName;public IEnumerable<Declaration> Declarations { get; internal set; }public Yarn.IType Type { get; internal set; }public IEnumerable<Diagnostic> Diagnostics { get; internal set; }public string SourceFileName { get; internal set; }public string SourceNodeName { get; internal set; }public int LineNumber;public Declaration Declaration { get; };public string FileName;public const string ExternalDeclaration = "(External)";Property in Declaration
Gets a value indicating whether get or sets a value indicating whether this Declaration was implicitly inferred from usage.
public bool IsImplicit { get; internal set; }public static CompilationResult Compile(CompilationJob compilationJob)public static IEnumerable<IParseTree> FlattenParseTree(IParseTree node)public LineInfo GetLineInfo(int instructionNumber)public DeclarationBuilder WithName(string name)Gets all descendants (that is, destinations, and destinations of those destinations, and so on) that have any player-visible content, recursively.
Gets the destinations of this block - that is, blocks or nodes that may run immediately after this block.
Gets the index of the first instruction of the node that this block is in.
Gets the Instructions that form this block.
Gets the name of the label that this block begins at, or null if this basic block does not begin at a labelled instruction.
Gets a descriptive name for the block.
Gets the name of the node that this block is in.
Gets the collection of player-visible content that will be delivered when this block is run.
A command that will be executed.
A line of dialogue that should be shown to the player.
A collection of options that should be shown to the player.
An abstract class that represents some content that is shown to the player.
The conditions under which a Destination may be reached at the end of a BasicBlock.
Adds a new destination to this block, that points to a node.
Adds a new destination to this block, that points to another block.
Get the ancestors of this block - that is, blocks that may run immediately before this block.
Gets all descendants (that is, destinations, and destinations of those destinations, and so on), recursively.
A destination represents a BasicBlock or node that may be run, following the execution of a BasicBlock .
The type of a Destination.
The block that this destination refers to.
The condition that causes this destination to be reached.
public struct Destinationlibrary
The containing functions to use for this compilation.
A new CompilationJob .
public static CompilationJob CreateFromFiles(IEnumerable<string> paths, Library library = null)System.Collections.Generic.IEnumerable<string> paths
The paths to the files.
The name of the file.
The source code of this file.
public struct Filestring source
The text to compile.
library
Library of function definitions to use during compilation.
A new CompilationJob .
public static CompilationJob CreateFromString(string fileName, string source, Library library = null)string fileName
The name to assign to the compiled file.
The compiler will derive only the variable and function declarations, and file tags, found in the script.
The compiler will do a full compilation, and generate a , function declaration set, and string table.
The compiler will generate a string table only.
public enum Type
{
FullCompilation,
DeclarationsOnly,
StringsOnly
}Compiles Yarn code, as specified by a compilation job.
Flattens a tree of Antlr4.Runtime.Tree.IParseTree objects by recursively visiting their children, and converting them into a flat System.Collections.Generic.IEnumerable`1 .
Gets the text of the documentation comments that either immediately precede context , or are on the same line as context .
public class Compiler : YarnSpinnerParserBaseListenerRepresents a single option that may be presented to the player.
public class OptionsElement : PlayerVisibleContentElementThe collection of options that will be delivered to the player.
public static DeferredTypeDiagnostic CreateDeferredTypeDiagnostic(string name, Diagnostic diagnostic)string name
diagnostic
Struct in Yarn.Compiler
Inherits from System.ValueType
The result of a compilation.
public struct CompilationResultInstances of this struct are produced as a result of supplying a CompilationJob to Compile(CompilationJob) .
Enum in BasicBlock
Inherits from System.Enum
The conditions under which a Destination may be reached at the end of a BasicBlock.
public enum Condition
{
Fallthrough,
DirectJump,
ExpressionIsTrue,
ExpressionIsFalse,
Option
}Contains classes for compiling Yarn code.
A basic block is a run of instructions inside a Node. Basic blocks group instructions up into segments such that execution only ever begins at the start of a block (that is, a program never jumps into the middle of a block), and execution only ever leaves at the end of a block.
Method in DeclarationBuilder
Sets the IsImplicit of the Declaration .
public DeclarationBuilder WithImplicit(bool isImplicit)bool isImplicit
The is-implicit value to apply to the Declaration.
The instance that received this method call.
Method in Compiler
Gets the text of the documentation comments that either immediately precede context , or are on the same line as context .
public static string GetDocumentComments(CommonTokenStream tokens, ParserRuleContext context, bool allowCommentsAfter = true)Documentation comments begin with a triple-slash ( /// ), and are used to describe variable declarations. If documentation comments precede a declaration (that is, they're not on the same line as the declaration), then they may span multiple lines, as long as each line begins with a triple-slash.
The text of the documentation comments.
Class in Yarn.Compiler
Inherits from System.Object
Contains debug information for a node in a Yarn file.
public class DebugInfoMethod in DeclarationBuilder
Sets the Range of the Declaration .
public DeclarationBuilder WithRange(Yarn.Compiler.Range range)range
The range to apply to the Declaration.
The instance that received this method call.
Class in Yarn.Compiler
Inherits from System.Object
public class DeferredTypeDiagnosticMethod in DeclarationBuilder
Sets the Type of the Declaration .
public DeclarationBuilder WithType(IType type)type
The type to apply to the Declaration.
The instance that received this method call.
Method in DeclarationBuilder
Sets the DefaultValue of the Declaration .
public DeclarationBuilder WithDefaultValue(System.IConvertible defaultValue)System.IConvertible defaultValue
The default value to apply to the Declaration.
The instance that received this method call.
Method in DeclarationBuilder
Sets the SourceFileName of the Declaration .
public DeclarationBuilder WithSourceFileName(string sourceFileName)string sourceFileName
The source file name to apply to the Declaration.
The instance that received this method call.
Method in DeclarationBuilder
Sets the Description of the Declaration .
public DeclarationBuilder WithDescription(string description)string description
The description to apply to the Declaration.
The instance that received this method call.
The Destination is reached beacuse of an explicit instruction to go to this block.
The Destination is reached because an expression evaluated to false.
The Destination is reached because an expression evaluated to true.
The Destination is reached because the preceding BasicBlock reached the end of its execution, and the Destination's target is the block immediately following.
The Destination is reached because the player made an in-game choice to go to it.
Antlr4.Runtime.CommonTokenStream tokens
The token stream to search.
Antlr4.Runtime.ParserRuleContext context
The parser rule context to get documentation comments for.
bool allowCommentsAfter
If true, this method will search for documentation comments that come after context 's last token and are on the same line.
Gets a LineInfo object that describes the specified instruction at the index instructionNumber .
Contains positional information about an instruction.
The name of the node that this destination refers to.
Gets the Destination's type - whether the destination is a block, or a node.
Gets the compiled Yarn program that the produced.
Gets a dictionary mapping line IDs to StringInfo objects.
Gets a value indicating whether the compiler had to create line IDs for lines in the source code that lacked #line: tags.
Gets the collection of Diagnostic objects that describe problems in the source code.
Contains the result of parsing a single file of source code.
Information about a string. Stored inside a string table, which is produced from the Compiler.
Compiles Yarn code.
Contains debug information for a node in a Yarn file.
Provides methods for constructing Declaration objects.
A diagnostic message that describes an error, warning or informational message that the user can take action on.
Provides methods for constructing FunctionType objects.
A Lexer subclass that detects newlines and generates indent and dedent tokens accordingly.
Contains extension methods for producing BasicBlock objects from a Node.
Represents a position in a multi-line string.
Represents a range of text in a multi-line string.
Utility methods for working with line tags.
Contains classes for upgrading Yarn code to more recent versions of the language.
An object that contains Yarn source code to compile, and instructions on how to compile it.
The result of a compilation.
Struct in Yarn.Compiler
Inherits from System.ValueType
An object that contains Yarn source code to compile, and instructions on how to compile it.
public struct CompilationJobInstances of this struct are used with Compile(CompilationJob) to produce CompilationResult objects.
Class in
Inherits from System.Object
Provides methods for constructing objects.
To use this class, create an instance of it, and call the With -prefixed methods to set properties. When you're done, access the property to get the final, constructed .
Class in
Inherits from System.Object
The that contains declarations for functions.
The declarations for variables.
Creates a new using the contents of a string.
The type of compilation that the compiler will do.
The type of compilation to perform.
The File structs that represent the content to parse..
Creates a new CompilationJob using the contents of a collection of files.
Creates a new CompilationJob using the contents of a collection of files.
Represents the contents of a file to compile.
Sets the of the .
Sets the of the .
Sets the of the .
Sets the of the .
Gets the instance constructed by this .
public class DeclarationBuilderCreates a new instance of the class, using the given name, type and default value.
Gets the default value of this , if no value has been specified in code or is available from a 's .
Gets a string describing the purpose of this .
public class DeclarationThe string used for SourceFileName if the Declaration was found outside of a Yarn source file.
Sets the of the .
Sets the of the .
Sets the of the .
Sets the of the .
Gets a value indicating whether get or sets a value indicating whether this Declaration was implicitly inferred from usage.
Gets the name of this Declaration.
Gets the range of text at which this declaration occurs.
Gets the line number at which this Declaration was found in the source file.
Gets the name of the file in which this Declaration was found.
Gets the name of the node in which this Declaration was found.
Gets the type of the variable, as represented by an object that implements .