public override int VisitOptionLink(YarnSpinnerParser.OptionLinkContext context) { // Create the formatted string and evaluate any inline // expressions GenerateFormattedText(context.option_formatted_text().children, out var composedString, out var expressionCount); string destination = context.NodeName.Text.Trim(); string label = composedString; int lineNumber = context.Start.Line; // getting the lineID from the hashtags if it has one string lineID = compiler.GetLineID(context.hashtag()); var hashtagText = GetHashtagTexts(context.hashtag()); string stringID = compiler.RegisterString(label, compiler.CurrentNode.Name, lineID, lineNumber, hashtagText); compiler.Emit(OpCode.AddOption, new Operand(stringID), new Operand(destination), new Operand(expressionCount)); return(0); }
/// <summary> /// Visit a parse tree produced by the <c>OptionLink</c> /// labeled alternative in <see cref="YarnSpinnerParser.option_statement"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitOptionLink([NotNull] YarnSpinnerParser.OptionLinkContext context) { return(VisitChildren(context)); }
public override void ExitOptionLink(YarnSpinnerParser.OptionLinkContext context) { graph.edge(currentNode, context.NodeName.Text); }
/// <summary> /// Exit a parse tree produced by the <c>OptionLink</c> /// labeled alternative in <see cref="YarnSpinnerParser.option_statement"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitOptionLink([NotNull] YarnSpinnerParser.OptionLinkContext context) { }