// EOF received.
case StreamTokenizer.TT_EOF:
// Error if we weren't expecting EOF.
if ((expecting & EOF) == 0)
{
throw new InvalidSyntaxException(
"Expecting more arguments.", null);
}
// Add current target if there is one.
if (currentTargetName != null)
{
pc.addTarget(currentTargetName, null);
}
// Return cleanly.
return pc;
// WORD or quoted WORD received.
case StreamTokenizer.TT_WORD:
case '\'':
case '\"':
// If we are expecting a command SWITCH and the token
// equals a NODEPS switch, then record it.
if (((expecting & SWITCH) > 0) && tokenizer.sval.equals(NODEPS_SWITCH))
{
pc.setResolve(false);
expecting = (EOF | TARGET);
}
// If we are expecting a command SWITCH and the token
// equals a CHECK swithc, then record it.
else if (((expecting & SWITCH) > 0) && tokenizer.sval.equals(CHECK_SWITCH))
{
pc.setCheck(true);
expecting = (EOF);
}
// If we are expecting a target, the record it.
else if ((expecting & TARGET) > 0)
{
// Add current target if there is one.
if (currentTargetName != null)
{
pc.addTarget(currentTargetName, null);
}
// Set the new target as the current target.
currentTargetName = tokenizer.sval;
expecting = (EOF | TARGET | VERSION);
}
else if ((expecting & VERSION_VALUE) > 0)
{
pc.addTarget(currentTargetName, tokenizer.sval);
currentTargetName = null;
expecting = (EOF | TARGET);
}
else
{
throw new InvalidSyntaxException(
"Not expecting '" + tokenizer.sval + "'.", null);
}
break;
// Version separator character received.
case ';':
// Error if we weren't expecting the version separator.
if ((expecting & VERSION) == 0)
{
throw new InvalidSyntaxException(
"Not expecting version.", null);
}
// Otherwise, we will only expect a version value next.
expecting = (VERSION_VALUE);
break;