Пример #1
0
        /// <summary>
        /// Reads the next break-statement from the file and returns it.
        /// </summary>
        /// <param name="parentReference">
        /// The parent code unit.
        /// </param>
        /// <returns>
        /// Returns the statement.
        /// </returns>
        private BreakStatement ParseBreakStatement(Reference<ICodePart> parentReference)
        {
            Param.AssertNotNull(parentReference, "parentReference");
            Reference<ICodePart> statementReference = new Reference<ICodePart>();

            // Move past the break keyword.
            CsToken firstToken = this.GetToken(CsTokenType.Break, SymbolType.Break, parentReference, statementReference);
            Node<CsToken> firstTokenNode = this.tokens.InsertLast(firstToken);

            // Get the closing semicolon.
            this.tokens.Add(this.GetToken(CsTokenType.Semicolon, SymbolType.Semicolon, statementReference));

            // Create the token list for the statement.
            CsTokenList partialTokens = new CsTokenList(this.tokens, firstTokenNode, firstTokenNode);

            // Create and return the break-statement.
            BreakStatement statement = new BreakStatement(partialTokens);
            statementReference.Target = statement;

            return statement;
        }
 /// <summary>
 /// The save.
 /// </summary>
 /// <param name="breakStatement">
 /// The break statement.
 /// </param>
 private void Save(BreakStatement breakStatement)
 {
     this.cppWriter.Write("break");
 }