示例#1
0
        public override string VisitDialogLine([NotNull] WordLangParser.DialogLineContext context)
        {
            var speaker = Visit(context.text());
            var line    = Visit(context.multilineText());

            return($"(dialog speaker=[{speaker}] parts=[{line}])");
        }
示例#2
0
        public override AST.RuleTree VisitDialogLine([NotNull] WordLangParser.DialogLineContext context)
        {
            var dialog = new AST.Dialog();


            dialog.Speaker = new AST.FieldString()
            {
                Value      = context.text().NAME().CombineTokens(),
                StartIndex = context.text().NAME().First().Symbol.StartIndex,
                StopIndex  = context.text().NAME().Last().Symbol.StopIndex
            };
            dialog.Line = new AST.FieldString()
            {
                Value      = context.multilineText().GetText(),
                StartIndex = context.multilineText().Start.StartIndex,
                StopIndex  = context.multilineText().Stop.StopIndex
            };

            return(dialog);
        }
示例#3
0
        public override string VisitDialogLine([NotNull] WordLangParser.DialogLineContext context)
        {
            var speaker = "";

            if (context.text() != null)
            {
                speaker = Quotize($"'{Visit(context.text()).AddEscapes()}'");
            }
            else if (context.templatedText() != null)
            {
                speaker = Visit(context.templatedText());
            }

            // var


            var line  = Quotize(context.multilineText().GetText());
            var parts = Visit(context.multilineText());

            return($"{{\"speaker\":{speaker},\"content\":{line},\"parts\":{parts}}}");
        }