/plugins/SuperAbbrevs/tags/version0.31/superabbrevs/lexer/Token.java

# · Java · 69 lines · 35 code · 12 blank · 22 comment · 0 complexity · 6b2521f4ee9bd749fc552a7c10db972b MD5 · raw file

  1. package superabbrevs.lexer;
  2. import java.util.*;
  3. /**
  4. * @author Sune Simonsen
  5. * class Tokens
  6. * Token for the lexer
  7. */
  8. public class Token {
  9. public static final int TEXT_FIELD = 1;
  10. public static final int CODE_OUTPUT_FIELD = 2;
  11. public static final int CODE = 3;
  12. public static final int FIELD = 4;
  13. public static final int FIELD_POINTER = 5;
  14. public static final int END_FIELD = 6;
  15. public static final int TRANSFORMATION_FIELD = 7;
  16. //{{{ Field ArrayList values
  17. protected ArrayList values;
  18. /**
  19. * Getter function for the field values
  20. */
  21. public ArrayList getValues() {
  22. return values;
  23. }
  24. //}}}
  25. public Object getValue(int number) {
  26. return values.get(number);
  27. }
  28. /**
  29. * Method getStringValue()
  30. * gets the value with the specified number and cast it to a string
  31. */
  32. public String getStringValue(int number) {
  33. return (String)values.get(number);
  34. }
  35. public void addValue(Object value) {
  36. values.add(value);
  37. }
  38. //{{{ Field int type
  39. private int type;
  40. /**
  41. * Getter function for the field type
  42. */
  43. public int getType() {
  44. return type;
  45. }
  46. //}}}
  47. /*
  48. * Constructor for Token
  49. */
  50. public Token(int type){
  51. this.type = type;
  52. this.values = new ArrayList();
  53. }
  54. public String toString(){
  55. return "<"+type+","+values+">";
  56. }
  57. }