I have the following code components in my source file. There are all in one class, in the same source file. First, the declaration of my enum type:
class Lexer { protected enum NumStates { // Number-lexer states S0, // start state SIGN, // sign has been seen at start INTEGER, // seen a digit BAREINTEGER, // seen an integer without sign or decimal point HEXINTEGER, // while scanning an integer DECIMAL, // decimal point seen after integer BAREDECIMAL, // decimal point seen with no preceding digit ...more of the same, boring
Then the method that uses it:
protected Lexeme ScanNumber(InputFileManager source) throws LexerException, InputFileManager.InputFileManagerException, IOException { NumStates state = NumStates.S0; // <=== THIS IS AN 'enum' VARIABLE!!! String num = ""; while(true) { /* scan number */ char ch = source.GetCharacter(); switch(state)
For the switch statement, I get the error
Cannot switch on a value of type Lexer.NumStates. Only convertible int values, strings or enum variables are permitted Lexer.java /Parser/src line 493 Java Problem
Of the hundreds of errors I was getting, after I downloaded Eclipse, and "jre-8u131-macosx-x64.dmg", I managed to fix several hundred with a simple reconfiguration. After far too much time spent with Google Search, I found an explanation for my many errors. At the declaration of the enum, it told me that I could not use 'enum' as a variable name, and it was all downhill from there. Upping the conformance to 1.7 was required to solve this. More searching. I found yet more advice, so I followed it and went into the preferences, and modified the preferences for this project:
Screen Shot 2017-07-11 at 9.26.28 PM.jpg
This project compiled and ran under Eclipse Neon under Windows; I am using Eclipse Kepler under Mac OS X, which I just installed today. For some reason, when I clicked on the icon to download Orion, I got Kepler instead. If this problem can be solved by downloading Orion, please tell me how to get it (I tried three times and kept getting Kepler, so I gave up). My Windows machine is in the Computer Hospital, where it was taken by ambulance, and I'm told it may need an organ transplant. I have work to do, so I moved to my MacBook.
Here's most of the information about Eclipse. It looked like many of the plugins (the ones truncated at the bottom of the display) are not relevant to what I am doing. Perhaps none of these are relevant, either, but the small "About" box at the top left of the screenshot may say everything that is important.
Screen Shot 2017-07-11 at 9.49.03 PM.jpg
****I AM NOT AN ECLIPSE OR JAVA ENVIRONMENT EXPERT! Please do not give me explanations that assume that I have a clue about what I am doing. The Eclipse documentation does not even hint that I have to have installed a particular version of JRE to support Eclipse. This is discovered when the program fails to start. And involves more searching for "Why does Eclipse fail to start" articles. So I need simple instructions that even a retired PhD can understand. In the past, I installed Eclipse, and it "just ran". I am a Java programmer, not an Eclipse Build Environment/JRE expert.****
Of course, pointers to good articles are a great help. After hours of searching I was unable to locate anything about this particular error that was relevant (lots of articles about using strings, no help there).