public void Visit(ExpressionStmt expressionStmt, object[] args) { foreach (Expr.Expression expr in expressionStmt.ExpressionList) { exprProcessor.Eval(expr); } kernel.Next(); }
public override void Visit(ExpressionStmt stmt) { if (isNewLine) { isNewLine = false; AddStr(WS()); } stmt.expr.Accept(this); AddStr(";"); NewLine(); }
public override void VisitExpressionStmt(ExpressionStmt x) { Add(x); if (x.Expression is ExitEx ee) { // NOTE: Added by VisitExpressionStmt already // NOTE: similar to ThrowEx but unhandleable // connect to Exception block Connect(_current, this.GetExceptionBlock()); _current = NewDeadBlock(); // unreachable } else if (x.Expression is ThrowEx te) { //var tryedge = GetTryTarget(); //if (tryedge != null) //{ // // find handling catch block // QualifiedName qname; // var newex = x.Expression as NewEx; // if (newex != null && newex.ClassNameRef is DirectTypeRef) // { // qname = ((DirectTypeRef)newex.ClassNameRef).ClassName; // } // else // { // qname = new QualifiedName(Name.EmptyBaseName); // } // CatchBlock handlingCatch = tryedge.HandlingCatch(qname); // if (handlingCatch != null) // { // // throw jumps to a catch item in runtime // } //} // connect to Exception block Connect(_current, this.GetExceptionBlock()); _current = NewDeadBlock(); // unreachable } }
public override void VisitExpressionStmt(ExpressionStmt x) { base.VisitExpressionStmt(x); ConsumeToken(Tokens.T_SEMI, ";", x.Span.End - 1); }
public override void VisitExpressionStmt(ExpressionStmt x) { Add(x); VisitElement(x.Expression as ExitEx); }
/// <summary> /// Visit expression in given expression statement. /// </summary> /// <param name="x"></param> virtual public void VisitExpressionStmt(ExpressionStmt x) { VisitElement(x.Expression); }
public void Visit(ExpressionStmt expressionStmt, object[] args) { throw new NotImplementedException(); }
public object Visit(ExpressionStmt stmt) { stmt.Expression.Accept(this); return(null); }
private void visitMainContent(ASTNode parent, List <Statement> content) { bool endWithBr = false; while (reader.Read()) { reader.MoveToContent(); Location location = new Location(file, reader.LineNumber, reader.LinePosition); switch (reader.NodeType) { case XmlNodeType.Text: string text = reader.Value; string[] lines = text.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); foreach (string line in lines) { string trimed = line.Trim(); if (trimed.Length == 0) { continue; } if (endWithBr && content.Count > 0 && content[content.Count - 1] is DialogStmt) { DialogStmt dialog = content[content.Count - 1] as DialogStmt; dialog.Text += Environment.NewLine + trimed; } else { DialogStmt dialog = new DialogStmt(); dialog.Parent = parent; dialog.Location = location; dialog.Text = trimed; content.Add(dialog); } endWithBr = false; } break; case XmlNodeType.Element: Statement statement = null; switch (dic[reader.Name]) { case "br": endWithBr = true; continue; case "expr": statement = new ExpressionStmt(); break; case "return": statement = new ReturnStmt(); break; case "include": statement = new IncludeStmt(); break; case "actor": statement = new ActorStmt(); break; case "bg": statement = new BackgroundStmt(); break; case "echo": statement = new EchoStmt(); break; case "select": statement = new SelectStmt(); break; case "selectWithValue": statement = new SelectStmt(); break; case "if": statement = new IfStmt(); break; case "else": return; case "elseif": return; case "switch": statement = new SwitchStmt(); break; case "break": statement = new BreakStmt(); break; case "continue": statement = new ContinueStmt(); break; case "loop": statement = new LoopStmt(); break; case "music": statement = new MusicStmt(); break; case "musicStop": statement = new MusicStopStmt(); break; case "musicVol": statement = new MusicVolStmt(); break; default: statement = new FunctionCallStmt(); break; } statement.Parent = parent; statement.Location = location; statement.Accept(this); content.Add(statement); break; case XmlNodeType.EndElement: //reader.Read(); //MainContent结束 return; } } }
protected abstract void MatchExpressionStmt(ExpressionStmt exprStmt);
public override void Visit(ExpressionStmt stmt) { stmt.expr.Accept(this); }
public void Visit(ExpressionStmt expressionStmt, object[] args) { expressionStmt.ExpressionList = new List <Expr.Expression>(); string expr = reader.ReadString(); bool escape = false; bool inQuot = false; int firstPos = 0; string subExpr; for (int i = 0; i < expr.Length; i++) { if (expr[i] == '\\') { escape = !escape; } else if (expr[i] == '"') { if (!inQuot) { inQuot = true; } else if (escape) { escape = false; } else { inQuot = false; } } else if (expr[i] == ';') { subExpr = expr.Substring(firstPos, i - firstPos); if (subExpr.Trim().Length > 0) { Expr.Expression result = exprParser.ParseExpr(subExpr, new Location(file, reader.LineNumber, reader.LinePosition).Offset(6 + firstPos)); expressionStmt.ExpressionList.Add(result); } firstPos = i + 1; escape = false; } else { escape = false; } } if (firstPos < expr.Length) { subExpr = expr.Substring(firstPos, expr.Length - firstPos); if (subExpr.Trim().Length > 0) { Expr.Expression result = exprParser.ParseExpr(subExpr, new Location(file, reader.LineNumber, reader.LinePosition).Offset(6 + firstPos)); expressionStmt.ExpressionList.Add(result); } } }
public virtual void Visit(ExpressionStmt expressionStmt, object[] args) { }
protected override void MatchExpressionStmt(ExpressionStmt stmt) => Resolve(stmt.Expression);
public void VisitExpressionStmt(ExpressionStmt stmt) { Evaluate(stmt.Expression); }
public virtual void Visit(ExpressionStmt stmt) { }