Пример #1
0
        /// <summary>
        /// Parses the day expression.
        /// Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
        /// </summary>
        /// <returns></returns>
        public override Expr Parse()
        {
            EnvToken token = _tokenIt.NextToken.Token as EnvToken;
            var      expr  = new EnvExpr(token.Scope, token.VarName);

            _tokenIt.Advance();
            return(expr);
        }
Пример #2
0
        /// <summary>
        /// run step 123.
        /// </summary>
        /// <returns></returns>
        public override Token[] Parse()
        {
            // env.<ident>
            // env.sys.<ident>
            // env.user.<ident>
            var takeoverToken = _lexer.LastTokenData;
            int line          = _lexer.State.Line;
            int pos           = _lexer.State.LineCharPosition;

            // First "."
            _lexer.Scanner.ReadChar();

            // Read the next part.
            // Case 1: variable env.path
            // Case 2: sys or user env.user or env.sys
            Token  part    = _lexer.ReadWord();
            string varName = part.Text;
            string scope   = string.Empty;

            if (string.Compare(part.Text, "sys", StringComparison.InvariantCultureIgnoreCase) == 0 ||
                string.Compare(part.Text, "user", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                // Second "."
                _lexer.Scanner.ReadChar();

                // "env. (sys | user )
                scope = part.Text.ToLower();

                // Final variable name.
                part    = _lexer.ReadWord();
                varName = part.Text;
            }
            string   finalText = varName;
            EnvToken envToken  = new EnvToken(scope, varName);
            var      t         = new TokenData()
            {
                Token = envToken, Line = line, LineCharPos = pos
            };

            _lexer.ParsedTokens.Add(t);
            return(new Token[] { envToken });
        }
Пример #3
0
        /// <summary>
        /// run step 123.
        /// </summary>
        /// <returns></returns>
        public override Token[] Parse()
        {
            // env.<ident>
            // env.sys.<ident>
            // env.user.<ident>
            var takeoverToken = _lexer.LastTokenData;
            int line = _lexer.State.Line;
            int pos = _lexer.State.LineCharPosition;

            // First "."
            _lexer.Scanner.ReadChar();

            // Read the next part.
            // Case 1: variable env.path
            // Case 2: sys or user env.user or env.sys
            Token part = _lexer.ReadWord();
            string varName = part.Text;
            string scope = string.Empty;

            if (string.Compare(part.Text, "sys", StringComparison.InvariantCultureIgnoreCase) == 0
                || string.Compare(part.Text, "user", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                // Second "."
                _lexer.Scanner.ReadChar();

                // "env. (sys | user )
                scope = part.Text.ToLower();

                // Final variable name.
                part = _lexer.ReadWord();
                varName = part.Text;
            }
            string finalText = varName;
            EnvToken envToken = new EnvToken(scope, varName);
            var t = new TokenData() { Token = envToken, Line = line, LineCharPos = pos };
            _lexer.ParsedTokens.Add(t);
            return new Token[] { envToken };
        }