public IncludeStatement(EvaluationStatement target, StatementInfo info) { Target = target; Info = info; TraversableChildren = StatementHelpers.CreateChildren(target); }
public static IApiMethodBuilderResult CompileResourceMethod <TFunc>( TFunc func, ExpressionBuilderParams p, string resourceName, FunctionInfo functionInfo, EvaluationStatement[] parameters, StatementInfo statementInfo) where TFunc : ApiBaseFunction { // if (p.Scope.TryGetFunctionInfo(functionInfo, out var funcInfo)) // { // return Inline(new FunctionCallStatement(funcInfo.ObjectName, funcInfo.Name, funcInfo.DataType, // parameters, statementInfo)); // } // // using (var file = Assembly.GetCallingAssembly() // .GetManifestResourceStream(typeof(TFunc), resourceName)) // using (var reader = new StreamReader(file)) // { // string line; // while ((line = reader.ReadLine()) != null) // { // p.MetaWriter.WriteLine(line); // } // // p.MetaWriter.WriteLine(); // } // // p.Context.GeneralScope.ReserveNewFunction(functionInfo); return(Inline(new FunctionCallStatement(func.ClassName, functionInfo.Name, functionInfo.TypeDescriptor, parameters, statementInfo))); }
public ParserSyntaxException(string message, StatementInfo info, ParserContext context) : base(message) { LineNumber = info?.LineNumber ?? 0; ColumnNumber = info?.ColumnNumber ?? 0; ParserContext = context; }
protected void Page_Load(object sender, EventArgs e) { /** * 전자명세서의 1건의 상태 및 요약정보 확인합니다. * - https://docs.popbill.com/statement/dotnet/api#GetInfo */ // 팝빌회원 사업자번호, '-' 제외 10자리 String testCorpNum = "1234567890"; // 명세서 종류 코드 - 121(거래명세서), 122(청구서), 123(견적서), 124(발주서), 125(입금표), 126(영수증) int itemCode = 121; // 전자명세서 문서번호 String mgtKey = "20220525-001"; try { statementInfo = Global.statementService.GetInfo(testCorpNum, itemCode, mgtKey); } catch (PopbillException ex) { code = ex.code.ToString(); message = ex.Message; } }
public VariableAccessStatement(string variableName, StatementInfo info) { VariableName = variableName; Info = info; TraversableChildren = new IStatement[0]; }
public BlockStatement(IStatement[] statements, StatementInfo info) { Statements = statements; Info = info; TraversableChildren = statements; }
public StatementInfo TryGetFollowing(string eventName) { if (_currentIndex >= Statements.Length - 1) { return(null); } StatementInfo statementInfo = new StatementInfo(this); Statement currentStatement = Statements[_currentIndex]; Statement statement = Statements[_currentIndex + 1]; if ((currentStatement.Skippable && eventName == "Skip") || (_timeOutEnded && triggeredEnd && eventName == statement.TriggerStart) || (_timeOutEnded && triggeredEnd && eventName == null)) { statementInfo.statement = statement; if (currentStatement.TimeOut != 0) { _timeOutEnded = false; } if (currentStatement.TriggerEnd != null) { triggeredEnd = false; } _currentIndex++; return(statementInfo); } else if (currentStatement.TriggerEnd == eventName) { triggeredEnd = true; } return(null); }
public static CodeRunnerInfo GenerateCodeRunnerInfo(int numStatements = 1, int level2Staements = 0) { CodeRunnerInfo info = new CodeRunnerInfo(); info.Name = "TestMethod"; info.IsConstructor = false; info.blockInfo[0] = new BlockInfo(); for (int i = 0; i < numStatements; i++) { StatementInfo sInfo = new StatementInfo(); sInfo.LineNo = 9 + i; info.blockInfo[0].Add(sInfo); } if (level2Staements > 0) { info.blockInfo[1] = new BlockInfo(); for (int i = 0; i < level2Staements; i++) { StatementInfo sInfo = new StatementInfo(); sInfo.LineNo = 9 + i; info.blockInfo[1].Add(sInfo); } } return(info); }
public ReturnStatement(EvaluationStatement result, StatementInfo info) { Result = result; Info = info; TraversableChildren = StatementHelpers.CreateChildren(result); }
public static IApiMethodBuilderResult WriteNativeMethod <TFunc>( TFunc func, ExpressionBuilderParams p, string methodBody, FunctionInfo functionInfo, EvaluationStatement[] parameters, StatementInfo statementInfo) where TFunc : ApiBaseFunction { if (p.Scope.TryGetFunctionInfo(functionInfo, out var funcInfo)) { return(Inline(new FunctionCallStatement(funcInfo.ClassName, funcInfo.Name, funcInfo.TypeDescriptor, parameters, statementInfo))); } using (var funcWriter = new StringWriter()) { funcWriter.Write("function "); funcWriter.Write(functionInfo.Fqn); funcWriter.WriteLine("() {"); funcWriter.WriteLine(methodBody); funcWriter.WriteLine("}"); p.MetaWriter.Write(funcWriter); } p.Context.GeneralScope.ReserveNewFunction(functionInfo); return(Inline(new FunctionCallStatement(func.ClassName, functionInfo.Name, functionInfo.TypeDescriptor, parameters, statementInfo))); }
public TypeCastOperator(TypeDescriptor typeDescriptor, StatementInfo info) { TypeDescriptor = typeDescriptor; Info = info; TraversableChildren = StatementHelpers.EmptyStatements; }
public static IApiMethodBuilderResult CompileMethod <TFunc>( TFunc func, ExpressionBuilderParams p, string methodBody, FunctionInfo functionInfo, EvaluationStatement[] parameters, StatementInfo statementInfo) where TFunc : ApiBaseFunction { return(Inline(new FunctionCallStatement(func.ClassName, functionInfo.Name, functionInfo.TypeDescriptor, parameters, statementInfo))); }
public ConditionalBlockStatement(EvaluationStatement condition, IStatement statement, StatementInfo info) { Condition = condition; Statement = statement; Info = info; TraversableChildren = StatementHelpers.CreateChildren(condition, statement); }
public LambdaExpressionStatement(StatementInfo info, string[] parameters, IStatement statement) { Info = info; Parameters = parameters; Statement = statement; TraversableChildren = new[] { statement }; }
public IndexerAccessStatement(EvaluationStatement source, EvaluationStatement indexer, StatementInfo info) { Source = source; Indexer = indexer; Info = info; TraversableChildren = StatementHelpers.CreateChildren(source, indexer); }
public ForEachStatement(IStatement variable, EvaluationStatement iterator, IStatement statement, StatementInfo info) { Variable = variable; Iterator = iterator; Statement = statement; Info = info; TraversableChildren = StatementHelpers.CreateChildren(variable, iterator, statement); }
protected static ExpressionResult CreateVariableAccess(TypeDescriptor typeDescriptor, string name, StatementInfo info) { return(new ExpressionResult( typeDescriptor, $"${name}", new VariableAccessStatement(name, info) )); }
public AssignmentStatement(EvaluationStatement leftSide, EvaluationStatement rightSide, StatementInfo info, IStatement parentStatement = null) { LeftSide = leftSide; RightSide = rightSide; Info = info; ParentStatement = parentStatement; TraversableChildren = StatementHelpers.CreateChildren(leftSide, rightSide); }
public StatementExecutionResult ExecuteStatement(string statement, IEnumerable <Parameter> inputParameters) { StatementInfo info = new StatementInfo(); info.Provider = DataProviders.SQL; info.Statement = statement; info.StatementType = StatementType.Query; return(this.iDatabaseService.ExecuteStatement(this.DBConnection, info, inputParameters)); }
public void GetInfo_WhenStartsWithEqualsAndParenthesis_GetsCorrectInfo() { string statement = "= (foo)"; string expectedContent = "foo"; StatementInfo statementInfo = processor.GetInfoFor(statement); Assert.Equal(expectedContent, statementInfo.Content); Assert.IsType(typeof(EncodedOutputMethodGenerator), statementInfo.Generator); }
public void GetInfo_WhenStartsWithWhitespaceAndSharpSign_GetsCorrectInfo() { string statement = " # foo"; string expectedContent = "foo"; StatementInfo statementInfo = processor.GetInfoFor(statement); Assert.Equal(expectedContent, statementInfo.Content); Assert.IsType(typeof(EncodedOutputMethodGenerator), statementInfo.Generator); }
internal StatementInfo Parse(ClzInfo model) { StatementInfo rslt = null; if (this.Expression != null) { rslt = this.Expression.Parse(); } if (this.Declare_Statement != null) { rslt = this.Declare_Statement.Parse(); } if (this.IfStatement != null) { rslt = this.IfStatement.Parse(); } if (this.SwitchStatement != null) { rslt = this.SwitchStatement.Parse(); } if (this.WhileStatement != null) { rslt = this.WhileStatement.Parse(); } if (this.DoWhileStatement != null) { rslt = this.DoWhileStatement.Parse(); } if (this.ForStatement != null) { rslt = this.ForStatement.Parse(); } if (this.ForEachStatement != null) { rslt = this.ForEachStatement.Parse(); } if (this.GotoStatement != null) { rslt = this.GotoStatement.Parse(); } if (this.BreakStatement != null) { rslt = this.BreakStatement.Parse(); } if (this.ContinueStatement != null) { rslt = this.ContinueStatement.Parse(); } return(rslt); }
//////////////////////////////////////////////////////////////////////// public void appendStatement(Statement s) { Debug.Assert(s != null); if (controlStatement == null) { // Debug.Assert(controlStatement == null); var si = new StatementInfo(s, postState, new StateInformation(), this, statements.Count); statements.Add(si); postState = si.postState; } else { insertStatementAt(statements.Count - 1, s); } }
public StatementInfo Collect(StatementSyntax node) { StatementInfo info = new StatementInfo(); var localDecStx = node as LocalDeclarationStatementSyntax; if (localDecStx != null) { info.IsLocalVarDeclaration = true; foreach (var varDec in localDecStx.Declaration.Variables) { info.LocalVarNames.Add(varDec.Identifier.ToString()); } return(info); } var exprNode = node as ExpressionStatementSyntax; if (exprNode != null) { IdentifierNameSyntax idst = null; var expr = exprNode.Expression as AssignmentExpressionSyntax; if (expr != null) { idst = expr.Left as IdentifierNameSyntax; } var postExpr = exprNode.Expression as PostfixUnaryExpressionSyntax; if (postExpr != null) { idst = postExpr.Operand as IdentifierNameSyntax; } // Todo - Ensure there are no more cases for local var identification. if (idst != null) { var name = idst.Identifier.ToString(); info.LocalVarNames.Add(name); info.IsLocalVarStateChanger = true; } } return(info); }
//////////////////////////////////////////////////////////////////////// public void setControlStatement(ControlStatement tc) { Debug.Assert(tc != null); if (controlStatement != null) { Debug.Assert(!ReferenceEquals(controlStatement, tc)); var os = new List <BasicEdge>(successors); foreach (var e in successors) { e.target.removePredecessor(e); } controlStatement = tc; statements[statements.Count - 1].statement = tc; foreach (var e in tc.successors) { Debug.Assert(e.source == this); } foreach (var e in tc.successors) { Debug.Assert(e.target.predecessors.Contains(e)); } foreach (var se in os) { if (se.target.predecessors.Count == 0) { se.target.delete(); } } } else { Debug.Assert(controlStatement == null); foreach (var e in tc.successors) { Debug.Assert(e.source == this); } controlStatement = tc; var cs = new StatementInfo(tc, postState, new StateInformation(), this, statements.Count); statements.Add(cs); postState = cs.postState; } assertLocalInvariant(); }
public static DocumentBuilder Run() { string statementJsonFile = CheckFile( Path.Combine("Content", "sample-statement-data.json")); string infoJsonFile = CheckFile( Path.Combine("Content", "sample-statement-info-data.json")); string statementJsonContent = File.ReadAllText(statementJsonFile); string infoJsonContent = File.ReadAllText(infoJsonFile); StatementInfo statementInfo = JsonConvert.DeserializeObject <StatementInfo>( infoJsonContent); List <Statement> statements = JsonConvert.DeserializeObject <List <Statement> >( statementJsonContent); BankAccountStatementBuilder bankAccountStatementBuilder = new BankAccountStatementBuilder(statementInfo, statements); return(bankAccountStatementBuilder.Build()); }
public override int SaveStatement(StatementInfo statement, IDbTransaction transaction) { var sqlParam = new DynamicParameters(); sqlParam.Add("@Date", statement.Date); sqlParam.Add("@ArtistID", statement.ArtistID); sqlParam.Add("@Amount", statement.Amount); sqlParam.Add("@BookingIDS", statement.BookingIDS); sqlParam.Add("@Remark", statement.Remark); sqlParam.Add("@UpdatedBy", statement.UpdatedBy); sqlParam.Add("@IdentityReturn", dbType: DbType.Int32, direction: ParameterDirection.Output); transaction.Connection.Execute("[dbo].[StatementInsert]", sqlParam, transaction, null, CommandType.StoredProcedure); return(sqlParam.Get <int>("IdentityReturn")); }
//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// public StatementId insertStatementAt(int index, Statement statement) { Debug.Assert(controlStatement != null); Debug.Assert(statement != null); Debug.Assert(index >= 0 && index < statements.Count); StateInformation pre = statements[index].preState; var post = new StateInformation(); //(index == statements.Count) ? : statements[index].preState; statements[index].preState = post; var si = new StatementInfo(statement, pre, post, this, index); statements.Insert(index, si); assertLocalInvariant(); for (int i = index + 1; i < statements.Count; i++) { statements[i].index++; } return(statements[index].statementId); }
internal static TestCase GetLocalVarAssignmentCode() { string testMethod = @""" class TestClass { void MethodA() { int localVar1 = 99; localVar1 = 45; } } """; ClassInfo classInfo = new ClassInfo(); CodeRunnerInfo codeRunnerInfo = new CodeRunnerInfo(); BlockInfo block = new BlockInfo(); StatementInfo s1 = new StatementInfo(); s1.IsLocalVarDeclaration = true; block.StatementInfos.Add(s1); s1.LocalVarNames.Add("localVar1"); s1.LineNo = 5; StatementInfo s2 = new StatementInfo(); s2.IsLocalVarStateChanger = true; s2.LocalVarNames.Add("localVar1"); block.StatementInfos.Add(s2); s1.LineNo = 6; codeRunnerInfo.blockInfo[0] = block; classInfo.AddCodeRunnerInfo(codeRunnerInfo, 0); return(new TestCase { Code = testMethod, ClassInfo = classInfo }); }
private void FillActivitySummaryTable(TableBuilder tableBuilder) { tableBuilder .SetWidth(XUnit.FromPercent(80)) .SetBorder(Stroke.None) .SetAltRowStyleBackColor(Color.White) .AddColumnPercentToTable("", 75).AddColumnPercent("", 25); var rowBuilder = tableBuilder.AddRow(); var cellBuilder = rowBuilder.AddCell(); cellBuilder .ApplyStyle( StyleBuilder.New() .SetBorderLeftStroke(Stroke.None) .SetBorderTop( 0.5f, Stroke.Solid, Color.Black) .SetBorderRightStroke(Stroke.None) .SetBorderBottomStroke(Stroke.None) .SetFont(FNT10_5B) ) .SetColSpan(2) .AddParagraphToCell("Activity summary"); FillActivitySummaryTableRow(tableBuilder, new Field[] { new Field("Beginning balance on " + statementInfo.DateBegin.ToString( "MMMM dd, yyyy", DocumentLocale), "$" + StatementInfo.ToString(statementInfo.BeginningBalance)), new Field("Deposits/Credits", StatementInfo.ToString(statementInfo.Deposits)), new Field("Withdrawals/Debits", StatementInfo.ToString(statementInfo.Withdrawals)), new Field("Ending balance on " + statementInfo.DateEnd.ToString("MMMM dd, yyyy", DocumentLocale), "$" + StatementInfo.ToString(statementInfo.EndingBalance)), new Field("Average ledger balance this period", "$" + StatementInfo.ToString(statementInfo.AverageBalance)) }); }