def check_type(node,expected_type,label,accept_nil = false)
              
        valid_type = true;
        if(@types.has_key?(expected_type))
          valid_type = match_node(node,@types[expected_type],label)
        elsif node.class.to_s != expected_type && !(node.kind_of?(NilClass) && (expected_type=='empty' || accept_nil))
          valid_type = false
        end
       
        return valid_type
        
      end
def check_type(node,expected_type,label,accept_nil = false)
              
        valid_type = true;
        if(@types.has_key?(expected_type))
          valid_type = match_node(node,@types[expected_type],label)
        elsif node.class.to_s != expected_type && !(node.kind_of?(NilClass) && (expected_type=='empty' || accept_nil))
          valid_type = false
        end
       
        return valid_type
        
      end
Checks that the node is of the correct type

 If the expected node is a custom node type as defined in the schema
 It will run `match_node` to check that the node schema matches the
 custom type.