Beispiel #1
0
        public override void Compile(CompileContext context)
        {
            List <Process> processes = this.Processes;

            for (int i = 0; i < processes.Count; i++)
            {
                Process p = (Process)processes[i];

                if (context.Options.Optimize && !p.IsUsed)
                {
                    continue;
                }

                if (p is ProcessConstant && !p.HasRestrictionsOrPreProcess)
                {
                    //Don't need to create a special proc just for wrapping this
                    ProcessConstant pc = (ProcessConstant)p;
                    EmitRunProcess(context, context.GetType(pc.Name), true, p.LexicalInfo, true);
                }
                else
                {
                    string   innerTypeName = "NonDeterministic" + (i + 1);
                    TypeInfo newType       = p.CompileNewProcessStart(context, innerTypeName);
                    p.Compile(context);
                    p.CompileNewProcessEnd(context);
                    EmitRunProcess(context, newType, true, p.LexicalInfo, true);
                }
            }
        }
        public override bool Equals(object obj)
        {
            if (!(obj is ProcessConstant))
            {
                return(false);
            }
            ProcessConstant other = (ProcessConstant)obj;

            return(other.Name == this.Name && other.Expressions.Count == this.Expressions.Count);
        }
 public virtual void Visit(ProcessConstant node)
 {
 }
 void ProcessConstantInvoke(out ProcessConstant pc)
 {
     pc = null; Expression exp = null;
     Expect(1);
     pc = new ProcessConstant(t.val); Token start = t;
     if (la.kind == 10) {
     Get();
     ArithmeticExpression(out exp);
     pc.Expressions.Add(exp);
     while (la.kind == 11) {
         Get();
         ArithmeticExpression(out exp);
         pc.Expressions.Add(exp);
     }
     Expect(12);
     }
     SetPos(pc, start, t);
 }
 public override void Visit(ProcessConstant p)
 {
     if (_procNames.Contains(p.Name)) {
         _procNames.Remove(p.Name);
     }
 }
 public override void Visit(ProcessConstant node)
 {
     List<string> children = PopChildren();
     Return(node.Name + children[2] + children[0] + children[1]);
 }
 public virtual string Format(ProcessConstant pc)
 {
     return SurroundWithParens(pc.Name+Format(pc.Expressions), pc.ParenCount) + Format(pc.PreProcessActions) + Format(pc.ActionRestrictions);
 }