Click here to Skip to main content
Click here to Skip to main content

Writing Your First Visual Studio Language Service

By , 11 Dec 2009
 
CSLanguage_Service.zip
bottles-v11-long.mycs
CSLanguageService
CSLanguageService.csproj.user
Integration
Key.snk
Properties
Resources
Package.ico
Irony
Compiler
AST
Grammar
LALR
NLALR
Scanner
Terminals
TokenFilters
EditorServices
Key.snk
Microsoft
MS-PubLicense.Rtf
Properties
Runtime
IronyLanguageServicePackage.zip
__TemplateIcon.ico
Integration
Key.snk
MyTemplate.vstemplate
Properties
Resources
Irony.dll
Irony.GrammarExplorer.exe
IronyLanguageServiceTemplate.zip
IronyLanguageServicePackage.zip
IronyLanguageServiceWizard.dll
Wizard.dll
MyCLanguageService.zip
MyCLanguageService
MyCLanguageService
bin
Debug
Irony.dll
Irony.GrammarExplorer.exe
MyCLanguageService.dll
MyCLanguageService.pkgdef
Integration
Key.snk
MyCLanguageService.csproj.user
Properties
Resources
Irony.dll
Irony.GrammarExplorer.exe
Test Files
short.myc
thing.myc
#region License
/* **********************************************************************************
 * Copyright (c) Roman Ivantsov
 * This source code is subject to terms and conditions of the MIT License
 * for Irony. A copy of the license can be found in the License.txt file
 * at the root of this distribution. 
 * By using this source code in any fashion, you are agreeing to be bound by the terms of the 
 * MIT License.
 * You must not remove this notice from this software.
 * **********************************************************************************/
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Irony.Runtime;

namespace Irony.Compiler.AST {

  public class StatementListNode : AstNode {
    
    public StatementListNode(NodeArgs args) : base(args) { }

    public StatementListNode(NodeArgs args, AstNodeList statements) : base(args) {
      ChildNodes.Clear();
      foreach (AstNode stmt in statements)
        AddChild(null, stmt);
    }

    public override void OnCodeAnalysis(CodeAnalysisArgs args) {
      switch (args.Phase) {
        case CodeAnalysisPhase.MarkTailCalls:
          if (IsSet(AstNodeFlags.IsTail) && ChildNodes.Count > 0)
            ChildNodes[ChildNodes.Count - 1].Flags |= AstNodeFlags.IsTail;
          break;
      }
      base.OnCodeAnalysis(args);
    }

    
    protected override void DoEvaluate(Irony.Runtime.EvaluationContext context) {
      foreach(AstNode node in ChildNodes) {
        node.Evaluate(context);
/*
        switch (context.Jump) {
          case JumpType.Goto:
            //TODO: implement GOTO
            break;
          case JumpType.Break:
          case JumpType.Continue:
          case JumpType.Return:
            return; 
          case JumpType.None:
            continue; //nothing to do, just continue
        }//switch
 */ 
      }//foreach

    }//method

  }//class

}//namespace

By viewing downloads associated with this article you agree to the Terms of use and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ben Morrison
Software Developer
United States United States
Member
No Biography provided

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 11 Dec 2009
Article Copyright 2009 by Ben Morrison
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid