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); } }
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; }
public void Accept(StringExpression str) { str.Visit (functionCompiler); }
public override void Accept (StringExpression str) { str.Visit (parentVisitor); }
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); }
public virtual void Accept(StringExpression stringConst) { }
public void Accept(StringExpression str) { }