1 17 package org.eclipse.emf.importer.rose.parser; 18 19 25 public class RoseToken 29 { 30 public final static int OBJECT = 0; 31 public final static int LIST = 1; 32 public final static int LEFT_PAREN = 2; 33 public final static int RIGHT_PAREN = 3; 34 public final static int VERTICAL_BAR = 4; 35 public final static int KEY = 5; 36 public final static int STRING = 6; 37 public final static int VALUE = 7; 38 39 protected int tokenType; 40 protected String tokenValue; 41 protected int lineNum; 42 43 public RoseToken(int tokenType, String tokenValue) 44 { 45 this.tokenType = tokenType; 46 this.tokenValue = tokenValue; 47 } 48 49 public int getType() 50 { 51 return tokenType; 52 } 53 54 public String getValue() 55 { 56 return tokenValue; 57 } 58 59 public String getToken() 60 { 61 if (tokenType == OBJECT) 62 { 63 return "object"; 64 } 65 else if (tokenType == LIST) 66 { 67 return "list"; 68 } 69 else if (tokenType == VALUE) 70 { 71 return "value"; 72 } 73 else if (tokenType == LEFT_PAREN) 74 { 75 return "("; 76 } 77 else if (tokenType == RIGHT_PAREN) 78 { 79 return ")"; 80 } 81 else if (tokenType == VERTICAL_BAR) 82 { 83 return "|"; 84 } 85 else if (tokenType == KEY) 86 { 87 return "key: " + getValue(); 88 } 89 else 90 { 91 return "string: " + getValue(); 92 } 93 } 94 } 95 | Popular Tags |