> For the complete documentation index, see [llms.txt](https://docs.yarnspinner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarnspinner.dev/3.1/api/csharp/yarn.compiler/yarn.compiler.utility.md).

# Utility

Class in [Yarn.Compiler](/3.1/api/csharp/yarn.compiler.md)

Inherits from `System.Object`

## Summary

Utility methods for working with line tags.

```csharp
public static class Utility
```

## Methods

| Name                                                                                                                                                                                                                                         | Description                                                                                                                               |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| [AddTagsToLines(string,ICollection?)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.addtagstolines.md)                                                                                                           | Given Yarn source code, adds line tags to the ends of all lines that need one and do not already have one.                                |
| [DetermineNodeConnections(string\[\])](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.determinenodeconnections.md)                                                                                                | Finds and collates every jump in every node.                                                                                              |
| [ExtractStringBlocks(IEnumerable,ProjectDebugInfo)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.extractstringblocks.md)                                                                                        | Gets the collection of contiguous runs of lines in the provided nodes. Each run of lines is guaranteed to run to completion once entered. |
| [GenerateYarnFileWithDeclarations(IEnumerable\<Yarn.Compiler.Declaration>,string,IEnumerable?,IDictionary\<string, string>?)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.generateyarnfilewithdeclarations.md) | Generates a Yarn script that contains a node that declares variables.                                                                     |
| [GetCompiledCodeAsString(Program,Library?,CompilationResult?)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.getcompiledcodeasstring.md)                                                                         | Gets a string containing a representation of the compiled bytecode for a [Program](/3.1/api/csharp/yarn/yarn.program.md) .                |
| [GetRange(ParserRuleContext)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.getrange.md)                                                                                                                         | Gets the range covered by a `Antlr4.Runtime.ParserRuleContext` in the source code.                                                        |
| [GetYarnValue(IConvertible)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.getyarnvalue.md)                                                                                                                      | Returns an [IYarnValue](/3.1/api/csharp/yarn/yarn.iyarnvalue.md) representation of the provided value.                                    |
| [ParseSource(string)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.parsesource.md)                                                                                                                              | Parses a string of Yarn source code, and produces a FileParseResult and (if there were any problems) a collection of diagnostics.         |
| [ParseSourceText(string,string)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.parsesourcetext.md)                                                                                                               | Parses a string of Yarn source code, and produces a [FileParseResult](/3.1/api/csharp/yarn.compiler/yarn.compiler.fileparseresult.md) .   |
| [TagLines(string,ICollection?)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.taglines.md)                                                                                                                       | Given Yarn source code, adds line tags to the ends of all lines that need one and do not already have one.                                |
| [TryGetNodeTitle(string?,YarnSpinnerParser.NodeContext,string?,string?,string?,string?)](/3.1/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.trygetnodetitle.md)                                                       | Gets the title for a node as defined in the source code, along with its unique title (which may be different to the source title.)        |
