1 package jfun.parsec; 2 3 import jfun.util.Misc; 4 5 11 public class ParsingFrame { 12 private final String module; 13 private final int ind; 14 private final Pos pos; 15 private final Parser parser; 16 23 public ParsingFrame(String module, int ind, Pos pos, 24 Parser parser) { 25 this.ind = ind; 26 this.module = module; 27 this.parser = parser; 28 this.pos = pos; 29 } 30 33 public int getIndex() { 34 return ind; 35 } 36 39 public String getModule() { 40 return module; 41 } 42 45 public Parser getParser() { 46 return parser; 47 } 48 51 public Pos getPosition() { 52 return pos; 53 } 54 public String toString(){ 55 return module+" - " + pos+": "+parser.getName(); 56 } 57 public boolean equals(Object obj) { 58 if(obj instanceof ParsingFrame){ 59 final ParsingFrame other = (ParsingFrame)obj; 60 return ind==other.ind && 61 Misc.equals(module, other.module); 62 } 63 else return false; 64 } 65 public int hashCode() { 66 return Misc.hashcode(module)*31+ind; 67 } 68 } 69 | Popular Tags |