Пример #1
0
        /// <summary>
        /// Parses all text into lines and lines into words. Parses the into scopes. Checks syntax for indentation, scopeStarters
        /// </summary>
        /// <returns>The into scopes.</returns>
        /// <param name="codeText">Code text.</param>
        public static Scope parseIntoScopes(string codeText)
        {
            // Creates list with CodeLine objects with lineNumber, indentNumber and word list
            List <CodeLine> programLines = SyntaxCheck.parseLines(codeText);

            Scope mainScope = IndentParser.parseIntoScopes(programLines);

            ScopeLogicParser.parseScopeLineLogic(mainScope);
            ScopeStarterParser.checkScopeStarters(programLines, mainScope);
            //CodeSyntaxWalker.walkAllLines (programLines.ToArray (), mainScope);

            return(mainScope);
        }
Пример #2
0
        public static void SubmitInput(string inputFromUser, Scope currentScope)
        {
            if (!CodeWalker.isWaitingForUserInput)
            {
                return;
            }

            CodeWalker.isWaitingForUserInput = false;

            var oldLine       = currentScope.getCurrentLine().cloneLine();
            var oldLineString = oldLine.getFullLine();
            var newLine       = ReplaceInputWithValue(oldLineString, inputFromUser);

            var lines = SyntaxCheck.parseLines(newLine);
            var words = lines.First().words;
            var logic = WordsToLogicParser.determineLogicFromWords(words, 1, currentScope);

            currentScope.getCurrentLine().words      = words;
            currentScope.getCurrentLine().logicOrder = logic;

            CodeWalker.parseLine(currentScope.getCurrentLine(), oldLine);
        }