public SherlockParser() { //File.WriteAllText(".\\DotGraph",state.StateMachine.ToDotGraph()); Type thisType = GetType(); try { foreach (var method in thisType.GetMethods(BindingFlags.Instance & BindingFlags.NonPublic)) { foreach (var attribute in method.CustomAttributes) { if (attribute.AttributeType.Name == "SherlockHandlerAttribute") { SherlockTokenType type = (SherlockTokenType)attribute.NamedArguments.Single().TypedValue.Value; Debug.Assert(!mapTokenHandler.ContainsKey(type)); mapTokenHandler[(SherlockTokenType)attribute.NamedArguments.Single().TypedValue.Value] = (Func <ASTNode, SherlockToken, ASTNode>)method.CreateDelegate(typeof(Func <ASTNode, SherlockToken, ASTNode>), this); } } } } catch (Exception) { Debug.Assert(false); } }
public SherlockHandlerAttribute(SherlockTokenType type) { Type = type; }
internal SherlockToken(string value, SherlockTokenType tokenType, int column) { this.value = value; this.tokenType = tokenType; this.column = column; }