Any easy way to break a massive switch into an OO design would have
pseudo code
class XTokenType { public bool isToken(string data); } class TokenParse { public void parseTokens(string data) { for each step in data { for each tokenType in tokenTypess { if (tokenType.isToken(step)) { parsedTokens[len] = new tokenType(step); } ... } } ... } }
Here is your break of each switch statement in a method on this token object to determine if the next bit of the string is this type.
Earlier:
class TokenParse { public void parseTokens(string data) { for each step in data { switch (step) { case x: ... case y: ... ... } } ... } }
source share