/** * Creates a token **/ private void processMatch(Match m, ConfuseTokenType type) { if (type == ConfuseTokenType.NOTHING) { return; } if (type == ConfuseTokenType.ERROR) { throw new Exception("Unable to find a valid token for '" + m.Value + "'."); } ConfuseToken t = new ConfuseToken(); t.type = type; tokens.Add(t); if (type == ConfuseTokenType.STRING) { t.val = m.Groups[1].Value; } else { t.val = m.Value; } return; }
/** * Creates a token **/ private void processMatch(Match m, ConfuseTokenType type) { if (type == ConfuseTokenType.NOTHING) return; if (type == ConfuseTokenType.ERROR) throw new Exception("Unable to find a valid token for '" + m.Value + "'."); ConfuseToken t = new ConfuseToken(); t.type = type; tokens.Add(t); if (type == ConfuseTokenType.STRING) { t.val = m.Groups[1].Value; } else { t.val = m.Value; } return; }