Exemplo n.º 1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">ParsingOptions</param>
 public BaseParser(ParsingOptions options)
 {
     this.Options = options;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="context">CompilationContext</param>
 /// <param name="options">ParsingOptions</param>
 private ParsingEngine(CompilationContext context, ParsingOptions options)
 {
     this.CompilationContext = context;
     this.Options = options;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a P# parsing engine for the specified compilation
 /// context and using the specified parsing options.
 /// </summary>
 /// <param name="context">CompilationContext</param>
 /// <param name="options">ParsingOptions</param>
 /// <returns>ParsingEngine</returns>
 public static ParsingEngine Create(CompilationContext context, ParsingOptions options)
 {
     return new ParsingEngine(context, options);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Parses a C# syntax tree to C#.
        /// th
        /// </summary>
        /// <param name="tree">SyntaxTree</param>
        /// <param name="options">ParsingOptions</param>
        private void ParseCSharpSyntaxTree(SyntaxTree tree, ParsingOptions options)
        {
            var root = (CompilationUnitSyntax)tree.GetRoot();

            var program = new CSharpParser(this, tree, options).Parse();

            this.CSharpPrograms.Add(program as CSharpProgram);
            this.ProgramMap.Add(program, tree);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="project">PSharpProject</param>
 /// <param name="tree">SyntaxTree</param>
 /// <param name="options">ParsingOptions</param>
 internal CSharpParser(PSharpProject project, SyntaxTree tree, ParsingOptions options)
     : base(project, tree, options)
 {
     this.ErrorLog = new List<Tuple<SyntaxToken, string>>();
     this.WarningLog = new List<Tuple<SyntaxToken, string>>();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="project">PSharpProject</param>
 /// <param name="tree">SyntaxTree</param>
 /// <param name="options">ParsingOptions</param>
 internal TokenParser(PSharpProject project, SyntaxTree tree, ParsingOptions options)
     : base(project, tree, options)
 {
     this.ErrorLog = new StringBuilder();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="project">PSharpProject</param>
 /// <param name="tree">SyntaxTree</param>
 /// <param name="options">ParsingOptions</param>
 internal PSharpParser(PSharpProject project, SyntaxTree tree, ParsingOptions options)
     : base(project, tree, options)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpParser"/> class.
 /// </summary>
 public CSharpParser(ParsingOptions options)
     : base(options)
 {
     this.ErrorLog   = new List <Tuple <SyntaxToken, string> >();
     this.WarningLog = new List <Tuple <SyntaxToken, string> >();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpParser"/> class.
 /// </summary>
 internal CSharpParser(PSharpProject project, SyntaxTree tree, ParsingOptions options)
     : base(project, tree, options)
 {
     this.ErrorLog   = new List <Tuple <SyntaxToken, string> >();
     this.WarningLog = new List <Tuple <SyntaxToken, string> >();
 }
Exemplo n.º 10
0
 /// <summary>
 /// Creates a P# parsing engine for the specified compilation
 /// context and using the specified parsing options.
 /// </summary>
 public static ParsingEngine Create(CompilationContext context, ParsingOptions options)
 {
     return(new ParsingEngine(context, options));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ParsingEngine"/> class.
 /// </summary>
 private ParsingEngine(CompilationContext context, ParsingOptions options)
 {
     this.CompilationContext = context;
     this.Options            = options;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Creates a P# parsing engine for the specified compilation
 /// context and using the default parsing options.
 /// </summary>
 public static ParsingEngine Create(CompilationContext context)
 {
     return(new ParsingEngine(context, ParsingOptions.CreateDefault()));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="project">PSharpProject</param>
 /// <param name="tree">SyntaxTree</param>
 /// <param name="options">ParsingOptions</param>
 internal BaseParser(PSharpProject project, SyntaxTree tree, ParsingOptions options)
 {
     this.Project    = project;
     this.SyntaxTree = tree;
     this.Options    = options;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">ParsingOptions</param>
 public BaseParser(ParsingOptions options)
 {
     this.Options = options;
 }
Exemplo n.º 15
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="project">PSharpProject</param>
 /// <param name="tree">SyntaxTree</param>
 /// <param name="options">ParsingOptions</param>
 internal BaseParser(PSharpProject project, SyntaxTree tree, ParsingOptions options)
 {
     this.Project = project;
     this.SyntaxTree = tree;
     this.Options = options;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TokenParser"/> class.
 /// </summary>
 public TokenParser(ParsingOptions options)
     : base(options)
 {
     this.ErrorLog = new StringBuilder();
 }
Exemplo n.º 17
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">ParsingOptions</param>
 public TokenParser(ParsingOptions options)
     : base(options)
 {
     this.ErrorLog = new StringBuilder();
 }
Exemplo n.º 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TokenParser"/> class.
 /// </summary>
 internal TokenParser(PSharpProject project, SyntaxTree tree, ParsingOptions options)
     : base(project, tree, options)
 {
     this.ErrorLog = new StringBuilder();
 }
Exemplo n.º 19
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">ParsingOptions</param>
 public PSharpParser(ParsingOptions options)
     : base(options)
 {
 }
Exemplo n.º 20
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">ParsingOptions</param>
 public PSharpParser(ParsingOptions options)
     : base(options)
 {
 }
Exemplo n.º 21
0
        /// <summary>
        /// Parses the project.
        /// </summary>
        /// <param name="options">ParsingOptions</param>
        public void Parse(ParsingOptions options)
        {
            var project = this.CompilationContext.GetProjectWithName(this.Name);
            var compilation = project.GetCompilationAsync().Result;

            foreach (var tree in compilation.SyntaxTrees.ToList())
            {
                if (this.CompilationContext.IsPSharpFile(tree))
                {
                    this.ParsePSharpSyntaxTree(tree, options);
                }
                else if (this.CompilationContext.IsCSharpFile(tree))
                {
                    this.ParseCSharpSyntaxTree(tree, options);
                }
            }
        }
Exemplo n.º 22
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="project">PSharpProject</param>
 /// <param name="tree">SyntaxTree</param>
 /// <param name="options">ParsingOptions</param>
 internal PSharpParser(PSharpProject project, SyntaxTree tree, ParsingOptions options)
     : base(project, tree, options)
 {
 }
Exemplo n.º 23
0
        /// <summary>
        /// Parses a P# syntax tree to C#.
        /// th
        /// </summary>
        /// <param name="tree">SyntaxTree</param>
        /// <param name="options">ParsingOptions</param>
        private void ParsePSharpSyntaxTree(SyntaxTree tree, ParsingOptions options)
        {
            var root = (CompilationUnitSyntax)tree.GetRoot();

            var tokens = new PSharpLexer().Tokenize(root.ToFullString());
            var program = new PSharpParser(this, tree, options).ParseTokens(tokens);

            this.PSharpPrograms.Add(program as PSharpProgram);
            this.ProgramMap.Add(program, tree);
        }
Exemplo n.º 24
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="options">ParsingOptions</param>
 public CSharpParser(ParsingOptions options)
     : base(options)
 {
     this.ErrorLog = new List<Tuple<SyntaxToken, string>>();
     this.WarningLog = new List<Tuple<SyntaxToken, string>>();
 }