示例#1
0
 /// <summary>
 /// A list with all the generators
 /// </summary>
 /// <param name="context">The context</param>
 public AllGenerators(WalkerContext context)
 {
     AddAssignment              = new AssignmentGenerator(context, AssignmentType.Add);
     AddressOfExpression        = new AddressOfExpressionGenerator(context);
     ArgumentList               = new ArgumentListGenerator(context);
     ArrayCreationExpression    = new ArrayCreationExpressionGenerator(context);
     ArrayInitializerExpression = new ArrayInitializerGenerator(context);
     BinaryAndAssignment        = new AssignmentGenerator(context, AssignmentType.BinaryAnd);
     BinaryOrAssignment         = new AssignmentGenerator(context, AssignmentType.BinaryOr);
     Block          = new BlockGenerator(context);
     CastExpression = new CastExpressionGenerator(context);
     ConditionalAccessExpression = new ConditionalAccessExpressionGenerator(context);
     ClassCode           = new ClassCodeGenerator(context);
     DelegateDeclaration = new DelegateDeclarationGenerator(context);
     DoStatement         = new DoStatementGenerator(context);
     DivideAssignment    = new AssignmentGenerator(context, AssignmentType.Divide);
     ElementAccess       = new ElementAccessGenerator(context);
     Enum = new EnumGenerator(context);
     ExclusiveOrAssignment         = new AssignmentGenerator(context, AssignmentType.ExclusiveOr);
     Expression                    = new ExpressionGenerator(context);
     ExpressionStatement           = new ExpressionStatementGenerator(context);
     FixedStatement                = new FixedStatementGenerator(context);
     ForStatement                  = new ForStatementGenerator(context);
     GotoStatement                 = new GotoStatementGenerator(context);
     IfStatement                   = new IfStatementGenerator(context);
     Invocation                    = new InvocationGenerator(context);
     Interface                     = new InterfaceGenerator(context);
     IdentifierName                = new IdentifierNameGenerator(context);
     LabeledStatement              = new LabeledStatementGenerator(context);
     LeftShiftAssignment           = new AssignmentGenerator(context, AssignmentType.LeftShift);
     LocalDeclaration              = new LocalDeclarationGenerator(context);
     MethodDeclaration             = new MethodGenerator(context);
     ModuloAssignment              = new AssignmentGenerator(context, AssignmentType.Modulo);
     MultiplyAssignment            = new AssignmentGenerator(context, AssignmentType.Multiply);
     ObjectCreationExpression      = new ObjectCreationExpressionGenerator(context);
     PreIncrementExpression        = new PrePostExpressionGenerator(context, ExpressionType.PreIncrement);
     PreDecrementExpression        = new PrePostExpressionGenerator(context, ExpressionType.PreDecrement);
     PostIncrementExpression       = new PrePostExpressionGenerator(context, ExpressionType.PostIncrement);
     PostDecrementExpression       = new PrePostExpressionGenerator(context, ExpressionType.PostDecrement);
     PointerMemberAccessExpression = new PointerMemberAccessGenerator(context);
     Property             = new PropertyGenerator(context);
     ReturnStatement      = new ReturnStatementGenerator(context);
     RightShiftAssignment = new AssignmentGenerator(context, AssignmentType.RightShift);
     SimpleAssignment     = new SimpleAssignmentGenerator(context);
     SimpleMemberAccess   = new SimpleMemberAccessGenerator(context);
     SizeOfExpression     = new SizeofExpressionGenerator(context);
     Struct = new StructGenerator(context);
     SubstractAssignment = new AssignmentGenerator(context, AssignmentType.Substract);
     SwitchStatement     = new SwitchStatementGenerator(context);
     checkedStatement    = new checkedStatementGenerator(context);
     Variable            = new VariableGenerator(context);
     WhileStatement      = new WhileStatementGenerator(context);
 }
示例#2
0
        public bool Validate(ProcessContext context, WalkerContext token)
        {
            // TODO: Should be asynchronous process
            foreach (var p in this._predicates)
            {
                if (p(context, token).Result == false)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#3
0
        public void CreateWalker(Transition transition, WalkerContext token = null)
        {
            if (token == null)
            {
                token = new WalkerContext();
            }

            var walker = new Walker();

            token.Transitions.Add(transition);
            walker.SetToken(token);
            this._walkers.Add(walker);
        }
示例#4
0
 public WorkflowStation(string id, NormalNode rootNode, WalkerContext context)
 {
     _walkerContext      = context ?? throw new ArgumentNullException(nameof(context));
     _rootNode           = rootNode ?? throw new ArgumentNullException(nameof(rootNode));
     _registeredNodeList = new List <Node> {
         _rootNode
     };
     Id               = id;
     Name             = _rootNode.Name;
     _rootNode.IsRoot = true;
     _rootNode.UpdateWorkflowContainer(this);
     _startNode = new StartNode(this);
     _endNode   = new EndNode(this);
 }
示例#5
0
        public (WalkerContext, IList <Transition>) execute(
            ProcessContext context, WalkerContext token)
        {
            ExecutionDelegate next = (c, t) => Task.CompletedTask;

            foreach (var exec in this._executions)
            {
                next = exec(next);
            }

            next(context, token).Wait();

            return(token, this.OutgoingTransitions);
        }
示例#6
0
 /// <summary>
 /// Block generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public BlockGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#7
0
 /// <summary>
 /// Argument list generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public ArgumentListGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#8
0
 /// <summary>
 /// Enum statement generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public EnumGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#9
0
 /// <summary>
 /// Fixed statement generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public FixedStatementGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#10
0
 /// <summary>
 /// Delegate declaration generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public DelegateDeclarationGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#11
0
 /// <summary>
 /// Element access expression generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public ElementAccessGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#12
0
 /// <summary>
 /// Expression generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public ExpressionGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#13
0
 /// <summary>
 /// Class field generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public ClassCodeGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#14
0
 /// <summary>
 /// Expression generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public ExpressionStatementGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#15
0
 /// <summary>
 /// Class struct generator
 /// </summary>
 /// <param name="context">The walker context</param>
 /// <param name="classCode">Class code</param>
 public ClassStructGenerator(WalkerContext context, ClassCodeData classCode)
 {
     m_context   = context;
     m_classCode = classCode;
 }
 /// <summary>
 /// Conditional access expression generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public ConditionalAccessExpressionGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#17
0
文件: Walker.cs 项目: poweralex/Pvm
 public void SetToken(WalkerContext token)
 {
     this.Token = token;
 }
示例#18
0
文件: Walker.cs 项目: poweralex/Pvm
 public Walker()
 {
     this.Id    = Guid.NewGuid();
     this.Token = new WalkerContext();
 }
示例#19
0
 /// <summary>
 /// Assignment generator
 /// </summary>
 /// <param name="context">The walker context</param>
 /// <param name="assignmentType">Assignment type</param>
 public AssignmentGenerator(WalkerContext context, AssignmentType assignmentType)
 {
     m_context        = context;
     m_assignmentType = assignmentType;
 }
示例#20
0
 /// <summary>
 /// Walks through the syntax and outputs C code to a string
 /// </summary>
 public SyntaxWalker(string initSuffix) : base(SyntaxWalkerDepth.Node)
 {
     m_context    = new WalkerContext();
     m_initSuffix = initSuffix;
 }
示例#21
0
 /// <summary>
 /// Array initializer expression generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public ArrayInitializerGenerator(WalkerContext context)
 {
     m_context = context;
 }
示例#22
0
 public abstract Task Next(WalkerContext context);
示例#23
0
 public WorkflowContext(WalkerContext context)
 {
     WalkerContext = context ?? throw new ArgumentNullException(nameof(context));
 }
示例#24
0
 /// <summary>
 /// Sizeof statement generator
 /// </summary>
 /// <param name="context">The walker context</param>
 public ArrayCreationExpressionGenerator(WalkerContext context)
 {
     m_context = context;
 }