예제 #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)
 {
 }