示例#1
0
        public override void DebugEnd(AstNode node, TextLocation?end)
        {
            var state = debugStack.Pop();

            if (currentMemberMapping != null)
            {
                foreach (var range in ILRange.OrderAndJoin(GetILRanges(state)))
                {
                    currentMemberMapping.MemberCodeMappings.Add(
                        new SourceCodeMapping {
                        ILInstructionOffset = range,
                        StartLocation       = state.StartLocation,
                        EndLocation         = end ?? output.Location,
                        MemberMapping       = currentMemberMapping
                    });
                }
            }
            else if (multiMappings != null)
            {
                foreach (var mm in multiMappings)
                {
                    foreach (var range in ILRange.OrderAndJoin(mm.Item2))
                    {
                        mm.Item1.MemberCodeMappings.Add(
                            new SourceCodeMapping {
                            ILInstructionOffset = range,
                            StartLocation       = state.StartLocation,
                            EndLocation         = end ?? output.Location,
                            MemberMapping       = mm.Item1
                        });
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Create a new Freezable Sequence
        /// </summary>
        public static IFreezableStep CreateFreezableSequence(
            IEnumerable <IFreezableStep> steps,
            IFreezableStep finalStep,
            TextLocation?location)
        {
            var dict = new StepParameterDict
            {
                {
                    new StepParameterReference.Named(nameof(Sequence <object> .InitialSteps)),
                    new FreezableStepProperty.StepList(steps.ToImmutableList(), location)
                },
                {
                    new StepParameterReference.Named(nameof(Sequence <object> .FinalStep)),
                    new FreezableStepProperty.Step(finalStep, location)
                },
            };

            var fpd = new FreezableStepData(dict, location);

            return(new CompoundFreezableStep(
                       "Sequence",
                       fpd,
                       location
                       ));
        }
示例#3
0
 public override void NewLine()
 {
     if (lastUsingDeclaration)
     {
         output.MarkFoldEnd();
         lastUsingDeclaration = false;
     }
     lastEndOfLine = output.Location;
     output.WriteLine();
 }
示例#4
0
 public override void Execute(TextArea textArea)
 {
     if (_location == null)
     {
         _location = textArea.Caret.Position;
     }
     textArea.Document.BreakpointManager.ToggleMarkAt(_location.Value);
     textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, _location.Value.Line));
     textArea.Document.CommitUpdate();
 }
示例#5
0
 public bool Equals(TextLocation?other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(File.Equals(other.File) && Span.Equals(other.Span));
 }
示例#6
0
        /// <summary>
        /// Create a new Freezable EntityGetValue
        /// </summary>
        public static IFreezableStep CreateFreezableArrayAccess(
            IFreezableStep entityOrArray,
            IFreezableStep indexer,
            TextLocation?location)
        {
            var entityGetValueDict = new StepParameterDict
            {
                {
                    new StepParameterReference.Named(nameof(EntityGetValue <int> .Entity)),
                    new FreezableStepProperty.Step(entityOrArray, location)
                },
                {
                    new StepParameterReference.Named(nameof(EntityGetValue <int> .Property)),
                    new FreezableStepProperty.Step(indexer, location)
                },
            };

            var entityGetValueData = new FreezableStepData(entityGetValueDict, location);

            var entityGetValueStep = new CompoundFreezableStep(
                "EntityGetValue",
                entityGetValueData,
                location
                );

            var elementAtIndexDict = new StepParameterDict
            {
                {
                    new StepParameterReference.Named(nameof(ElementAtIndex <object> .Array)),
                    new FreezableStepProperty.Step(entityOrArray, location)
                },
                {
                    new StepParameterReference.Named(nameof(ElementAtIndex <object> .Index)),
                    new FreezableStepProperty.Step(indexer, location)
                },
            };

            var elementAtData = new FreezableStepData(elementAtIndexDict, location);

            var elementAtStep = new CompoundFreezableStep(
                "ElementAtIndex",
                elementAtData,
                location
                );

            var result = new OptionFreezableStep(new[] { entityGetValueStep, elementAtStep }, location);

            return(result);
        }
示例#7
0
 public void CloseBrace(BraceStyle style, out TextLocation?start, out TextLocation?end)
 {
     output.Unindent();
     start = output.Location;
     output.WriteRightBrace();
     end = output.Location;
     if (nodeStack.OfType <BlockStatement>().Count() <= 1)
     {
         output.MarkFoldEnd();
     }
     if (braceLevelWithinType >= 0)
     {
         braceLevelWithinType--;
     }
 }
示例#8
0
 public void OpenBrace(BraceStyle style, out TextLocation?start, out TextLocation?end)
 {
     if (braceLevelWithinType >= 0 || nodeStack.Peek() is TypeDeclaration)
     {
         braceLevelWithinType++;
     }
     if (nodeStack.OfType <BlockStatement>().Count() <= 1)
     {
         output.MarkFoldStart(defaultCollapsed: braceLevelWithinType == 1);
     }
     output.WriteLine();
     start = output.Location;
     output.WriteLeftBrace();
     end = output.Location;
     output.WriteLine();
     output.Indent();
 }
示例#9
0
        /// <summary>
        /// Create a new Freezable Interpolated string
        /// </summary>
        public static IFreezableStep CreateFreezableInterpolatedString(
            IEnumerable <IFreezableStep> steps,
            TextLocation?location)
        {
            var dict = new StepParameterDict
            {
                {
                    new StepParameterReference.Named(nameof(StringInterpolate.Strings)),
                    new FreezableStepProperty.StepList(steps.ToImmutableList(), location)
                },
            };

            var fpd = new FreezableStepData(dict, location);

            return(new CompoundFreezableStep(
                       nameof(StringInterpolate),
                       fpd,
                       location
                       ));
        }
示例#10
0
        /// <summary>
        /// Create a new Freezable Array
        /// </summary>
        public static IFreezableStep CreateFreezableList(
            ImmutableList <IFreezableStep> elements,
            TextLocation?location)
        {
            var dict = new StepParameterDict
            {
                {
                    new StepParameterReference.Named(nameof(ArrayNew <object> .Elements)),
                    new FreezableStepProperty.StepList(elements, location)
                }
            };

            var fpd = new FreezableStepData(dict, location);

            return(new CompoundFreezableStep(
                       "ArrayNew",
                       fpd,
                       location
                       ));
        }
示例#11
0
        /// <summary>
        /// Create a freezable GetVariable step.
        /// </summary>
        public static IFreezableStep CreateFreezableGetVariable(
            VariableName variableName,
            TextLocation?location)
        {
            var dict = new StepParameterDict
            {
                {
                    new StepParameterReference.Named(nameof(GetVariable <object> .Variable)),
                    new FreezableStepProperty.Variable(variableName, location)
                }
            };

            var fpd = new FreezableStepData(dict, location);

            var step = new CompoundFreezableStep(
                "GetVariable",
                fpd,
                location
                );

            return(step);
        }
示例#12
0
    private void Report(TextLocation?span, string message)
    {
        var diagnostic = new Diagnostic(span, message);

        _diagnostics.Add(diagnostic);
    }
示例#13
0
 public ContextTextEvent(byte textId, TextLocation?location, NpcId npcId)
 {
     TextId   = textId;
     Location = location;
     NpcId    = npcId;
 }
示例#14
0
 /// <summary>
 /// Create a new OptionFreezableStep
 /// </summary>
 public OptionFreezableStep(IReadOnlyList <IFreezableStep> options, TextLocation?textLocation)
 {
     Options      = options;
     TextLocation = textLocation;
 }
示例#15
0
 public MapTextEvent(MapDataId mapId, byte textId, TextLocation?location, SmallPortraitId?portrait) : base(textId, location, portrait) => MapId = mapId;
示例#16
0
 public EventTextEvent(EventSetId eventSetId, byte textId, TextLocation?location, SmallPortraitId?portrait) : base(textId, location, portrait) => EventSetId = eventSetId;
示例#17
0
 protected BaseTextEvent(byte textId, TextLocation?location, SmallPortraitId?portrait)
 {
     TextId     = textId;
     Location   = location;
     PortraitId = portrait;
 }
示例#18
0
		public void Dispose() {
			SD.ParserService.ParseInformationUpdated -= ParseInfoUpdated;
			
			if (this.editor != null) {
				if (this.editor.Caret != null)
					this.editor.Caret.LocationChanged -= CaretLocationChanged;
				this.editor = null;
			}
			
			this.document = null;
			this.lastCaretLocation = null;
			this.selectedNode = null;
			
			if (this.updateTreeTimer != null) {
				this.updateTreeTimer.Stop();
				this.updateTreeTimer.Tick -= this.UpdateTreeTimer_Tick;
				this.updateTreeTimer = null;
			}

			if (this.scrollToNodeTimer != null) {
				this.scrollToNodeTimer.Stop();
				this.scrollToNodeTimer.Tick -= this.ScrollToNodeTimer_Tick;
				this.scrollToNodeTimer = null;
			}	
		}
示例#19
0
		void SelectActiveTreeNode() {
			if (!optionSelectActiveTreeNode)
				return;
			// prevent unnecessary looping, when both CaretLocationChanged and ParseUpdateChanged are fired.
			if (this.lastCaretLocation.HasValue && this.lastCaretLocation == this.editor.Caret.Location)
				return;
			
			this.lastCaretLocation = this.editor.Caret.Location;
			selectedNode = null;
			FindNodeFromLocation(this.editor.Caret.Location, treeView.Root as XamlOutlineNode);			
			if (selectedNode != null && treeView.SelectedItem != selectedNode) {
				treeView.SelectedItem = selectedNode;				
				if (!scrollToNodeTimer.IsEnabled) {				
					scrollToNodeTimer.Start();		
				}		
			}
		}
示例#20
0
        public override void Execute()
        {
            try
            {
                if (!NoLogo)
                {
                    Console.WriteLine(Parser.LogoBanner);
                }

                bool hasContentFile = !String.IsNullOrEmpty(ContentPath);

                if ((!hasContentFile && this.Command == "help") ||
                    (String.IsNullOrEmpty(this.Command) && this.ShowHelp))
                {
                    Console.WriteLine(Parser.Usage);
                    return;
                }

                if (!hasContentFile)
                {
                    WriteError("A .content file must be specified");
                    return;
                }

                this.ContentPath = new ParsedFilePath(this.ContentPath.MakeFullPath());

                if (this.Command == "new")
                {
                    CreateContentFileFromTemplate();
                    return;
                }

                if (!File.Exists(this.ContentPath))
                {
                    WriteError("Content file '{0}' does not exist", this.ContentPath);
                    return;
                }

                buildContext = new BuildContext(this.Properties, this.ContentPath);

                ApplyCompilerSettingsExtensions();

                if (this.Command == "help")
                {
                    WriteContentCompilerUsage();
                    return;
                }

                List <BuildTarget> buildTargets;

                PrepareBuildTargets(out buildTargets);

                if (this.Command == "clean")
                {
                    Clean(buildTargets);
                }
                else
                {
                    Build(buildTargets);
                }

                WriteMessage("Done");
            }
            catch (Exception e)
            {
                TextLocation?mark = null;

                do
                {
                    ContentFileException cfe = e as ContentFileException;
                    TsonParseException   tpe = e as TsonParseException;

                    if (cfe != null)
                    {
                        mark = cfe.ErrorLocation;
                    }
                    else if (tpe != null)
                    {
                        mark = tpe.ErrorLocation;
                    }

                    // If we started showing content file errors, keep going...
                    if (mark.HasValue)
                    {
                        WriteErrorWithLine(ContentPath, mark.Value.Line + 1, mark.Value.Column + 1, e.Message);
                    }
                    else
                    {
                        ConsoleUtility.WriteMessage(MessageType.Error, e.Message);
                    }
#if DEBUG
                    // Gotta have this in debug builds
                    Console.WriteLine(e.StackTrace);
#endif
                }while ((e = e.InnerException) != null);
            }
        }
示例#21
0
 public Diagnostic(TextLocation?location, string message)
 {
     Location = location;
     Message  = message;
 }
示例#22
0
 /// <summary>
 /// Creates a new FreezableStepData
 /// </summary>
 public FreezableStepData(StepParameterDict stepProperties, TextLocation?location)
 {
     StepProperties = stepProperties;
     Location       = location;
 }
示例#23
0
 public override void DebugStart(AstNode node, TextLocation?start)
 {
     debugStack.Push(new DebugState {
         StartLocation = start ?? output.Location
     });
 }
示例#24
0
 public TextEvent(byte textId, TextLocation?location, SmallPortraitId?portrait)
 {
     TextId     = textId;
     Location   = location;
     PortraitId = portrait;
 }
示例#25
0
 public override void NewLine()
 {
     if (lastUsingDeclaration) {
         output.MarkFoldEnd();
         lastUsingDeclaration = false;
     }
     lastEndOfLine = output.Location;
     output.WriteLine();
 }
示例#26
0
 public ToggleBreakpoint(TextLocation location)
 {
     _location = location;
 }