Exemplo n.º 1
0
        public static string[] getParameterNames(string trimmedPara, int lineNumber, Scope currentScope)
        {
            string[] words = WordParser.parseWords(trimmedPara);
            if (words.Length == 0)
            {
                return(new string[0]);
            }

            Logic[]        logicOrder   = WordsToLogicParser.determineLogicFromWords(words, lineNumber, currentScope);
            List <Logic[]> packedLogics = convertIntoParameterLogic(words, logicOrder, lineNumber);


            List <string> returnWords = new List <string>();

            foreach (Logic[] l in packedLogics)
            {
                if (l.Length != 1)
                {
                    ErrorMessage.sendErrorMessage(lineNumber, "Du tycks ha glömt ett \",\"");
                }

                returnWords.Add(l [0].word);
            }


            return(returnWords.ToArray());
        }
Exemplo n.º 2
0
        public static int getParameterAmount(string trimmedPara, int lineNumber, Scope currentScope)
        {
            string[] words = WordParser.parseWords(trimmedPara);
            if (words.Length == 0)
            {
                return(0);
            }

            Logic[]        logicOrder   = WordsToLogicParser.determineLogicFromWords(words, lineNumber, currentScope);
            List <Logic[]> packedLogics = convertIntoParameterLogic(words, logicOrder, lineNumber);

            return(packedLogics.Count);
        }
Exemplo n.º 3
0
        public static void unpackPackage(string word, int lineNumber, Scope currentScope, Package currentPackage)
        {
            if (word.Length <= 2)
            {
                return;
            }

            string trimedString = removeSurrondingParanteser(word);

            string[] words      = WordParser.parseWords(trimedString);
            Logic[]  logicOrder = WordsToLogicParser.determineLogicFromWords(words, lineNumber, currentScope);

            currentPackage.logicOrder = logicOrder;
        }
Exemplo n.º 4
0
        public static List <CodeLine> parseLines(List <ParsedLine> lineList)
        {
            List <CodeLine> tempList = new List <CodeLine> ();

            for (int i = 0; i < lineList.Count; i++)
            {
                if (lineList [i].theString != "" && containsChar(lineList[i].theString) && !isComment(lineList[i].theString))
                {
                    int      indentLevel   = getIndentLevel(lineList [i].theString);
                    string   trimmedString = lineList [i].theString.Substring(indentLevel, lineList [i].theString.Length - indentLevel);
                    string[] words         = WordParser.parseWords(trimmedString);
                    addLine(tempList, lineList[i].lineNumber, indentLevel, words);
                }
            }

            return(tempList);
        }
Exemplo n.º 5
0
        public static Variable[] getValueOfParameters(string trimmedPara, Function calledFunction, int lineNumber, Scope currentScope, FunctionCall theFuncCall)
        {
            string[] words = WordParser.parseWords(trimmedPara);

            if (words.Length != 0)
            {
                Logic[]        logicOrder   = WordsToLogicParser.determineLogicFromWords(words, lineNumber, currentScope);
                List <Logic[]> packedLogics = convertIntoParameterLogic(words, logicOrder, lineNumber);
                theFuncCall.setReturnCalculations(packedLogics);

                if (packedLogics != null)
                {
                    return(parseInputVariables(packedLogics, lineNumber, calledFunction, currentScope));
                }
            }

            return(new Variable[0]);
        }