Beispiel #1
0
        private bool isLabel(string _line)
        {
            //The specification requires label definitions to be
            // - All uppercase letters or _
            // - The only thing on the line
            // - Terminated with a :
            //
            //This currently does not enforce the first restriction, and will let numbers
            //and other symbols in. Perhaps the specification SHOULD allow numbers in
            //labels, as well as printable symbols like |, $, etc.
            bool result = false;

            List <string> tokens = tokenizeLine(_line);

            if (tokens.Count == 1)                                  //Labels must be the only thing on that line
            {
                if (tokens[0][tokens[0].Length - 1] == ':')         //Labels must end with a :
                {
                    if (tokens[0] == tokens[0].ToUpper())           //Labels must be all uppercase
                    {
                        //This check goes last because it is the most resource intensive.
                        //See? I do optimize sometimes!
                        AssemblyTable table = new AssemblyTable();
                        if (!table.ContainsInstruction(tokens[0]))  //Labels cannot be an instruction
                        {
                            result = true;
                        }
                    }
                }
            }

            return(result);
        }
Beispiel #2
0
        private bool isInstruction(string _line)
        {
            bool result = false;

            List <string> tokens = tokenizeLine(_line);

            if (tokens.Count > 0)
            {
                AssemblyTable table = new AssemblyTable();
                if (table.ContainsInstruction(tokens[0]))
                {
                    result = true;
                }
            }

            return(result);
        }
Beispiel #3
0
        private bool isLabel(string _line)
        {
            //The specification requires label definitions to be
            // - All uppercase letters or _
            // - The only thing on the line
            // - Terminated with a :
            //
            //This currently does not enforce the first restriction, and will let numbers
            //and other symbols in. Perhaps the specification SHOULD allow numbers in
            //labels, as well as printable symbols like |, $, etc.
            bool result = false;

            List<string> tokens = tokenizeLine(_line);

            if (tokens.Count == 1)                                  //Labels must be the only thing on that line
            {
                if (tokens[0][tokens[0].Length - 1] == ':')         //Labels must end with a :
                {
                    if (tokens[0] == tokens[0].ToUpper())           //Labels must be all uppercase
                    {
                        //This check goes last because it is the most resource intensive.
                        //See? I do optimize sometimes!
                        AssemblyTable table = new AssemblyTable();
                        if (!table.ContainsInstruction(tokens[0]))  //Labels cannot be an instruction
                        {
                            result = true;
                        }
                    }
                }
            }

            return result;
        }
Beispiel #4
0
        private bool isInstruction(string _line)
        {
            bool result = false;

            List<string> tokens = tokenizeLine(_line);

            if (tokens.Count > 0)
            {
                AssemblyTable table = new AssemblyTable();
                if (table.ContainsInstruction(tokens[0]))
                {
                    result = true;
                }
            }

            return result;
        }