_Core/Lang/Plugins/Parser/VariablePathPlugin.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Lang;


namespace ComLib.Lang.Extensions
{
    /* *************************************************************************
    <doc:example>	
    // Provides representation of file paths in more convenient ways
    
    // Set the home dir
    home    = c:\myapp\
    script  = "build"
    
    // Case 1: Typical approach
    file = home + "\\build\\build.xml"    
    
    // Case 2: VariablePath plugin simple case
    // The @ is optional on the first variable in the path.
    file = home\build\script.xml
    file = @home\build\script.xml
     
    // Case 3: Use variables in the path by prefixing @
    file = @home\build\@script.xml
    file = @home\build\@script-build.xml
    file = @home\build\@script.build.xml
     
    // Case 4: Use variables by prefixing with @ and surrounding by {}
    // This is only needed when separating a variable name from another variable name.
    file = @home\build\@{script}build.xml
    file = @home\build\@{script}-build.xml
    file = @home\build\@{script}.build.xml
     
     
    // NOTE:
    // This plugin is useful since the beginning drive letter ( "c:\" or "d:\" )
    // should NOT be hardcoded. This plugin removes the need to:
    // 1. use "+" for appending parts of the path
    // 2. use doublequotes for wrapping the path name e.g. "\build\appbuild.fs"
    
    </doc:example>
    ***************************************************************************/

    /// <summary>
    /// Plugin to allow using units such as length, weight, etc.
    /// </summary>
    public class VariablePathPlugin : ExprPlugin
    {
        private static string[] _tokens = new string[] { "@", "$IdToken" };


        /// <summary>
        /// Initialize
        /// </summary>
        public VariablePathPlugin()
        {
            _startTokens = _tokens;
后面还有 199 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。