public DebuggingStateChangedEventArgs(DebuggingState before, DebuggingState after) { Debug.Assert(before != after); Before = before; After = after; }
public DebuggingStateChangedEventArgs(DebuggingState before, DebuggingState after) { Debug.Assert(before != after); this.Before = before; this.After = after; }
public void OnBeforeDebuggingStateChanged(DebuggingState before, DebuggingState after) { BeforeDebuggingStateChanged?.Invoke( this, new DebuggingStateChangedEventArgs(before, after) ); CurrentDebuggingState = after; }
private static DebuggingState ApplyDebugging(Container content) { var debuggingState = new DebuggingState(); content.VisitChildren(x => { x.CreateProxy(y => new DebuggingProxy(debuggingState, y)); }); return(debuggingState); }
public virtual bool Scan(string source, int position) { result.Verb = null; result.Position = -1; var newPattern = replaceInPattern(pattern); var matcher = new Matcher(); if (matcher.IsMatch(source.Substring(position), newPattern, ignoreCase, multiline)) { this.source = matcher[0]; this.position = position; this.source = source; overridePosition = null; var tokens = matcher.Groups(0); length = tokens[0].Length; var verb = CreateVerb(tokens); if (verb == null) { return(false); } result.Verb = verb; result.Position = overridePosition ?? position + length; if (IsDebugging) { var lineLength = overridePosition - position ?? length; var line = source.Substring(position, lineLength); if (result.Verb is IEnd) { DebuggingState.EndSource(line); } else { DebuggingState.AddSource(line); } result.Verb.LineNumber = DebuggingState.LineNumber; result.Verb.LinePosition = DebuggingState.LinePosition; } return(true); } FailedScan(source, position); if (NextParser(source, position, out var nextResult)) { result = nextResult; return(true); } return(false); }
public void OnBeforeDebuggingStateChanged(DebuggingState before, DebuggingState after) { BeforeDebuggingStateChanged?.Invoke(this, new DebuggingStateChangedEventArgs(before, after)); }
public Block Compile() { var position = initialPosition; var previousPosition = initialPosition; InitialPosition = initialPosition; var block = new Block(); var scanning = true; var yieldCount = 0; var parsers = new List <Parser> { new MultilineCommentParser(), new SingleLineCommentParser(), new NoEndParser(), new EndBlockParser(endOfBlock, consumeEndOfBlock), new EndParser(endOfBlock == REGEX_END), //new AnonymousObjectParser(), new SomeParser(), new ClassParser(), new TypeParser(), new StaticParser(), new TraitParser(), new NullOpParser(), new HexParser(), new BinParser(), new OctParser(), new FloatParser(), new IntegerParser(), new StringParser(), new FillInBlockParser(), new InterpolatedStringParser(), new ArrayLiteralParser(), //new ArrayParametersParser(), new DateParser(), //new IndexParser(), new TypeNameParser(), new SpecialValueParser(), new ChangeSignParser(), new PreIncrementDecrementParser(), new ReadOnlyParser(), new ReferenceParser(), new SymbolParser(), new SendMessageParser(), //new MessageBlockParser(), new AbstractParser(), new AutoPropertyParser(), new InitBlockParser(), new LetParser(), new MacroParser(), new OperatorParser(), new ListParser(), new FunctionParser(), new DefineExpressionParser(), new NewObjectParser(), new FunctionInvokeParser(), new DefineParser(), new EnumerationValueParser(), new DelegateParser(), new PlainSignalParser(), //new ScalarParser(), new IsDefinedParser(), //new ApplyInvokeParser(), new RegexParser(), new MessageArgumentParser(), //new AlternateLambdaParser(), new MacroLiteralParser(), new DeferredParser(), new ThreeCharacterOperatorParser(), new TwoCharacterOperatorParser(), new OneCharacterOperatorParser(), new InvokeParser(), new PrintBlockParser(), new GeneratorParser(), new EmptyArrayLiteralParser(), //new BlockParser(true), new PatternParser(), new IndexerParser(), new FormatLiteralParser(), new LazyBlockParser(), new IfParser(), new MatchParser(), new WhileParser(), new WithParser(), new WhereParser(), new CForParser(), new AssertParser(), new ShortCircuitBooleanParser(), new DisjoinMessageParser(), new WordOperatorParser(), new VariableParser() }; while (position < sourceLength && scanning) { if (Verbose) { verboseText.WriteLine($"Scanning {source.Skip(position)}"); } scanning = false; var found = false; foreach (var parser in parsers.Where(p => p.Scan(source, position))) { var result = parser.Result; if (result.Verb != null && !(result.Verb is NullOp)) { if (result.Verb is Yield) { yieldCount++; } block.Add(result.Verb); if (result.Next != null) { block.Add(result.Next); result.Next = null; } if (Verbose) { verboseText.WriteLine($" Found {parser.VerboseName}"); } } if (result.Verbs != null && result.Verbs.Count > 0) { foreach (var verb in result.Verbs) { if (verb is Yield) { yieldCount++; } block.Add(verb); } result.Verbs.Clear(); if (Verbose) { verboseText.WriteLine($" Found {parser.VerboseName}"); } } position = result.Position; (position != -1).Assert("-1?"); scanning = !parser.EndOfBlock; found = true; break; } var substring = source.Substring(position); found.Assert($"Orange compiler: Didn't understand \"{substring.Substitute("/s+", " ").TrimAll()}\""); (position != previousPosition || !scanning).Assert("Orange compiler: Scanning position has not changed"); previousPosition = position; } (initialPosition > 0 && scanning && endOfBlock != REGEX_END).Reject("End of block not found"); if (IsDebugging && initialPosition == 0) { DebuggingState.Final(); } lastPosition = position; if (yieldCount > 1) { var blockGenerator = new YieldGenerator(block); block = PushValue(blockGenerator); var generator = new Generator(VAR_MANGLE + "b", block); block = PushValue(generator); } block.YieldCount = yieldCount; return(block); }