<RESOLVED>Passing a Statement Object into a Program Object
The main issue is that I am having a reference to a non-static type, but Statement must be static.
Can I ensure that the syntax is at least right? This comes from a parser program. Error marked below in the code
Code:
public <Program> Program Parser (String fileName) throws FileNotFoundException, LexException
{
if (fileName == null)
throw new IllegalArgumentException ("null string argument");
lex = new LexicalAnalyzer2(fileName);
L = StatementList.getStatement(); // ***this is the error ****
Program prog = (L);
return prog;
}
StatementList class is shown below:
Code:
public class StatementList
{
/**
* This method takes the Statement List and returns the getStatement method.
*/
public StatementList ()
{
getStatement();
}
// This method will use the Statement class with this project and privatize it and return it.
// The Statement class will then use the line number, basic statement, and EOLN token.
public static void getStatement()
{
//this.Statement = Statement;
while (Parser.lex.moreTokens())
{
Parser.lex.getNextToken();
}
System.out.println("no more tokens");
}
}
Thoughts?
Re: Passing a Statement Object into a Program Object
L = StatementList.getStatement() assumes the method returns something but the method is void: public static void getStatement(). This does not return anything.
Re: Passing a Statement Object into a Program Object
You are correct. Thank you!