private bool parseLocations() { if (lastToken is CommandToken) { CommandToken ct = (CommandToken)lastToken; if (ct.isLocations()) { if (getNextToken() is LeftBracket) { Token num = getNextToken(); if (num is NumToken && getNextToken() is RightBracket && getNextToken() is Colon) { int locationsCount = num.toInt(); LocationDef.__setLocationsCountDoNotUseOutsideOfParser(locationsCount); for (int i = 0; i < locationsCount; i++) { Token locName = getNextToken(); if (locName is NumToken) // Unnamed location { LocationDef.__setLocationNameDontUseOutsideOfParser(i, "Location " + ((NumToken)locName).toInt()); } else if (locName is StringToken) { LocationDef.__setLocationNameDontUseOutsideOfParser(i, ((StringToken)locName).toStringDef().ToString()); } else if (locName is CommandToken) { if (((CommandToken)locName).isNoLocation()) { LocationDef.__setLocationNameDontUseOutsideOfParser(i, "No Location"); } else { throw new NotImplementedException(); } } else { throw new NotImplementedException(); } } return(true); } } } } throw new NotImplementedException(); }
public bool parse(ref int lastReadPosition, ref int lastReadPositionEnd) { LocationDef.__setLocationsCountDoNotUseOutsideOfParser(256); // Safe keeping return(parse(false, ref lastReadPosition, ref lastReadPositionEnd)); }