Пример #1
0
		public override void Accept (StringExpression str)
		{
			str.VisitChildren (this);
			methodBuilder.EmitInstruction (str.Location, Opcode.LoadConst, 
				methodBuilder.Module.DefineConstant (new IodineString (str.Value)));
			if (str.Children.Count != 0) {
				methodBuilder.EmitInstruction (str.Location, Opcode.LoadAttribute,
					methodBuilder.Module.DefineConstant (new IodineName ("format")));
				methodBuilder.EmitInstruction (str.Location, Opcode.Invoke, str.Children.Count);
			}
		}
Пример #2
0
        private static AstNode ParseString(SourceLocation loc, string str)
        {
            int pos = 0;
            string accum = "";
            List<string> vars = new List<string> ();
            while (pos < str.Length) {
                if (str [pos] == '#' && str.Length != pos + 1 && str [pos + 1] == '{') {
                    string substr = str.Substring (pos + 2);
                    if (substr.IndexOf ('}') == -1)
                        return null;
                    substr = substr.Substring (0, substr.IndexOf ('}'));
                    pos += substr.Length + 3;
                    vars.Add (substr);
                    accum += "{}";

                } else {
                    accum += str [pos++];
                }
            }
            StringExpression ret = new StringExpression (loc, accum);

            foreach (string name in vars) {
                ret.Add (new NameExpression (loc, name));
            }
            return ret;
        }
Пример #3
0
 public void Accept(StringExpression str)
 {
     str.Visit (functionCompiler);
 }
Пример #4
0
		public override void Accept (StringExpression str)
		{
			str.Visit (parentVisitor);
		}
Пример #5
0
		public override void Accept (StringExpression str)
		{
			str.Visit (parentVisitor);
			methodBuilder.EmitInstruction (str.Location, Opcode.LoadLocal, temporary);
			methodBuilder.EmitInstruction (str.Location, Opcode.BinOp, (int)BinaryOperation.Equals);
		}
Пример #6
0
 public virtual void Accept(StringExpression stringConst)
 {
 }
Пример #7
0
 public void Accept(StringExpression str)
 {
 }