Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: engine/ProcAssignInstrucDescription.java


1   
2   /* **********************************
3    File:ProcAssignInstrucDescription.java
4    Author: Alec(panovici@elcom.pub.ro)
5    Created on 28.01.1999 14:17:48
6    Comments: Part of the vIDE Project
7               Copyright 1999 the vIDE Team.
8   ***********************************/
9   
10  package engine;
11  
12  /**
13   * Implements the description of a procedural assignement
14   * <PRE><CODE>
15   * ex:
16   *     #1 a #2 = b ;  //blocking
17   *   or:
18   *     b <= a;     //non-blocking
19   * </CODE><PRE>
20   */
21   class ProcAssignInstrucDescription extends InstructionDescription{
22    
23    ExpressionDescription rValue;
24    AssignableSelection lValue;
25    int delayInside;
26    boolean blocking;
27    
28    public ProcAssignInstrucDescription(int delayBefore, int line,
29                                        NameSpaceDescription nsd,
30                                        AssignableSelection lValue,
31                                        ExpressionDescription rValue,
32                                        int delayinside, boolean blocking){
33      super(delayBefore, line, nsd);
34      this.rValue = rValue;
35      this.lValue = lValue;
36      delayInside = delayinside;
37      this.blocking = blocking;
38    }
39    
40    DefaultInstruction instantiate(NameSpace ns)throws ParseException{
41  
42      Expression rv;
43      LeftValue lv;
44      try{
45        try{
46          lv = (LeftValue)lValue.instantiate(ns);
47        }catch(ClassCastException ex){
48          throw new ParseException("lValue required");
49        }
50        if (!lv.isLeftValue()) throw new ParseException ("lValue required");
51        rv = rValue.instantiate(ns);
52      }catch(ParseException ex){
53        xConsole.dumpStack(ex);
54        throw new ParseException(super.toString() + " error:" + ex);
55      }
56  
57      return new ProcAssignInstruc(ns, delayBefore, this,
58                                   lv, rv,
59                                   next == null ? null : next.instantiate(ns),
60                                   delayInside, blocking);
61    }
62    
63    public String toString(){
64      return super.toString() + lValue + " = " + rValue;
65    }
66  }