SourceCodeKind.cs 1.2 KB
Newer Older
1 2
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

T
Tomas Matousek 已提交
3 4
using System;
using System.ComponentModel;
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis
{
    /// <summary>
    /// Specifies the C# or VB source code kind.
    /// </summary>
    public enum SourceCodeKind
    {
        /// <summary>
        /// No scripting. Used for .cs/.vb file parsing.
        /// </summary>
        Regular = 0,

        /// <summary>
T
Tomas Matousek 已提交
20 21
        /// Allows top-level statementsm, declarations, and optional trailing expression. 
        /// Used for parsing .csx/.vbx and interactive submissions.
22 23 24 25
        /// </summary>
        Script = 1,

        /// <summary>
T
Tomas Matousek 已提交
26
        /// The same as <see cref="Script"/>.
27
        /// </summary>
28
        [Obsolete("Use Script instead", error: false)]
T
Tomas Matousek 已提交
29
        [EditorBrowsable(EditorBrowsableState.Never)]
30 31 32 33 34 35 36
        Interactive = 2,
    }

    internal static partial class SourceCodeKindExtensions
    {
        internal static bool IsValid(this SourceCodeKind value)
        {
T
Tomas Matousek 已提交
37
            return value >= SourceCodeKind.Regular && value <= SourceCodeKind.Script;
38 39 40
        }
    }
}