예제 #1
0
        public static string GetAttribute(this IAstNodeWithAttributes node, string s)
        {
            var value = node.Attributes.FirstOrDefault(a => a.Name == s)?.Value;

            if (value == null)
            {
                throw new CodeGenException("Expected attribute " + s + " for node " + node);
            }
            return(value);
        }
예제 #2
0
 public static string GetAttributeOrDefault(this IAstNodeWithAttributes node, string s)
 => node.Attributes.FirstOrDefault(a => a.Name == s)?.Value;
예제 #3
0
 public static bool HasAttribute(this IAstNodeWithAttributes node, string s) => node.Attributes.HasAttribute(s);