package org.peg4d.vm;

import org.peg4d.expression.ParsingExpression;

public final class Opcode {
	public MachineInstruction opcode;
    public int ndata = 0;          
    public byte[] bdata = null;
    public ParsingExpression generated; // this is 
    
    public Opcode(MachineInstruction mi) {
    	this.opcode = mi;
    }
    public Opcode(MachineInstruction mi, int ndata) {
    	this.opcode = mi;
    	this.ndata = ndata;
    }
    @Override
	public String toString() {
    	if(this.bdata == null) {
    		return opcode.toString() + " " + ndata; 
    	}
    	else {
    		return opcode.toString() + " " + ndata; 
    	}
    }
    public final boolean isJumpCode() {
    	return this.opcode.compareTo(MachineInstruction.IFFAIL) <= 0;
    }
}
@@ -20,69 +20,15 @@
 m;%0A%0A
-import org.peg4d.expression.ParsingExpression;%0A%0A
 public 
-final 
 clas
@@ -46,23 +46,16 @@
 %09public 
-Machine
 Instruct
@@ -62,20 +62,15 @@
 ion 
-opcode;%0A    
+inst;%0A%09
 publ
@@ -90,42 +90,28 @@
 = 0;
-          %0A    public byte%5B%5D bdata
+%0A%09public String name
  = n
@@ -119,69 +119,71 @@
 ll;%0A
-    
+%09%0A%09
 public 
-ParsingExpression generated; // this is %0A    %0A    
+Opcode(Instruction inst) %7B%0A%09%09this.inst = inst;%0A%09%7D%0A%09%0A%09
 publ
@@ -184,39 +184,32 @@
 %0A%09public Opcode(
-Machine
 Instruction mi) 
@@ -208,47 +208,75 @@
 ion 
-mi) %7B%0A    %09this.opcode = mi;%0A    %7D%0A    
+inst, int ndata) %7B%0A%09%09this.inst = inst;%0A%09%09this.ndata = ndata;%0A%09%7D%0A%09%0A%09
 publ
@@ -285,23 +285,16 @@
  Opcode(
-Machine
 Instruct
@@ -301,92 +301,73 @@
 ion 
-mi, int ndata) %7B%0A    %09this.opcode = mi;%0A    %09this.ndata = ndata;%0A    %7D%0A    @Override
+inst, String name) %7B%0A%09%09this.inst = inst;%0A%09%09this.name = name;%0A%09%7D%0A%09
 %0A%09pu
@@ -395,26 +395,23 @@
 ) %7B%0A
-    
+%09
 %09if
+ 
 (this.
-bdata
+name
  == 
@@ -418,20 +418,17 @@
 null) %7B%0A
-    
+%09
 %09%09return
@@ -420,38 +420,36 @@
 ll) %7B%0A%09%09%09return 
-opcode
+inst
 .toString() + %22 
@@ -462,33 +462,13 @@
 ata;
- %0A    %09%7D%0A    %09else %7B%0A    
+%0A%09%09%7D%0A
 %09%09re
@@ -472,22 +472,20 @@
 %09return 
-opcode
+inst
 .toStrin
@@ -501,32 +501,19 @@
  + n
-data; %0A    %09%7D%0A    %7D%0A    
+ame;%0A%09%7D%0A%09%0A%09
 publ
@@ -565,14 +565,12 @@
 his.
-opcode
+inst
 .com
@@ -580,15 +580,8 @@
 eTo(
-Machine
 Inst
@@ -609,8 +609,9 @@
 %0A    %7D%0A%7D
+%0A

add VM opcode