4 Replies Latest reply: Jan 27, 2011 2:40 AM by 834337 RSS

    Enumerated types and recursive descent parsing

    834337
      I recently discovered that enum type is a special class, constructors can be formed, instance variables, and the enum data declaration can posses a primitive type.

      My question is, in the general sense how can I use this structure to enable terminal retrieval from the following list?

      Code:

      private enum Foo {
      COMMA (","),
      SEMICOLON (";");
      private String poo
      Foo (String poo) {
      this.poo = poo;
      private String poo {return poo};
      }

      I would like to better understand this. I know I can create a variable of Foo such as Foo morePoo and access the , and ; using the names but I just don't know how well. Strong application in parsing and compiler design.

      I know there are simpler ways to accomplishing this bit I am curious about enumeration since I skipped it in my early studies.

      Thank you for the info