Esempio n. 1
0
 // Formatted
 public StringAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.Formatted_stringContext stringContext) : this(parseInfo.Script, stringContext.@string(), false)
 {
     FormatParameters = new IExpression[stringContext.expr().Length];
     for (int i = 0; i < FormatParameters.Length; i++)
     {
         FormatParameters[i] = DeltinScript.GetExpression(parseInfo, scope, stringContext.expr(i));
     }
     ParseString(parseInfo.Script);
 }
 // Formatted
 public StringAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.Formatted_stringContext stringContext)
 {
     Init(parseInfo, stringContext.@string());
     FormatParameters = new IExpression[stringContext.expr().Length];
     for (int i = 0; i < FormatParameters.Length; i++)
     {
         FormatParameters[i] = parseInfo.GetExpression(scope, stringContext.expr(i));
     }
     ParseString();
 }
        // <"hello <0>! Waiting game...", EventPlayer()>
        public override Node VisitFormatted_string(DeltinScriptParser.Formatted_stringContext context)
        {
            string value = context.@string().GetText().Trim('"');

            Node[] format = new Node[context.expr().Length];
            for (int i = 0; i < format.Length; i++)
            {
                format[i] = VisitExpr(context.expr()[i]);
            }
            return(new StringNode(value, format, new Location(file, Range.GetRange(context))));
        }
Esempio n. 4
0
        // <"hello <0>! Waiting game...", EventPlayer()>
        public override Node VisitFormatted_string(DeltinScriptParser.Formatted_stringContext context)
        {
            string value = context.@string().GetText().Trim('"');

            IExpressionNode[] format = new IExpressionNode[context.expr().Length];
            for (int i = 0; i < format.Length; i++)
            {
                format[i] = (IExpressionNode)VisitExpr(context.expr()[i]);
            }
            Node node = new StringNode(value, format, Range.GetRange(context));

            CheckRange(node);
            return(node);
        }