Ejemplo n.º 1
0
        /*************************/
        /*** Private Functions ***/
        /*************************/

        /// <summary>
        /// Add() - Adds a command to the command dictionary.  The command is <br/>
        /// added to the dictionary with its name as the key.  The command is <br/>
        /// retrieved from the dictionary each time it is needed for parsing.
        /// </summary>
        /// <param name="command">New command to populate the dictionary</param>
        private void Add(ProgCmd command)
        {
            if (command != null)
            {
                cmdDict.Add(command.CommandName, command);
            }
        }
Ejemplo n.º 2
0
        public ProgCmd GetProgCmd(string keyword)
        {
            ProgCmd command = null;

            if (!cmdDict.TryGetValue(keyword, out command))
            {
                command = null;
            }

            return(command);
        }
Ejemplo n.º 3
0
        public ProgNode GetCommand()
        {
            ProgNode node = null;

            string variable = parser.GetToken().GetString();
            string keyword  = variable.ToUpper();

            ProgCmd command = parser.GetProgCmd(keyword);

            if (command != null)
            {
                node = command.Interpret(this);
            }
            else
            {
                Token assignToken = parser.GetToken();

                ProgNode expression = Expression();

                node = new ProgNodeAssign(variable, expression);
            }

            return(node);
        }