private ParsingEvent ParseBlockMappingKey(bool isFirst) { if (isFirst) { GetCurrentToken(); Skip(); } if (GetCurrentToken() is Key) { Mark end = GetCurrentToken().End; Skip(); if (!(GetCurrentToken() is Key) && !(GetCurrentToken() is Value) && !(GetCurrentToken() is BlockEnd)) { states.Push(ParserState.BlockMappingValue); return(ParseNode(true, true)); } state = ParserState.BlockMappingValue; return(ProcessEmptyScalar(end)); } if (GetCurrentToken() is BlockEnd) { state = states.Pop(); ParsingEvent result = new MappingEnd(GetCurrentToken().Start, GetCurrentToken().End); Skip(); return(result); } Token token = GetCurrentToken(); throw new SemanticErrorException(token.Start, token.End, "While parsing a block mapping, did not find expected key."); }
public YamlMapping() { _mappingStart = new MappingStart(); _mappingEnd = new MappingEnd(); _keys = new List <YamlElement>(); _contents = new Dictionary <YamlElement, YamlElement>(); }
public void addNode(MappingEnd end, List <string> path) { var linkedNode = this.AddNode(path); linkedNode.MappedEnd = end; //check if we need to use createPath() to fill the voids in the path }
private ParsingEvent ParseBlockMappingKey(bool isFirst) { if (isFirst) { this.GetCurrentToken(); this.Skip(); } if (this.GetCurrentToken() is Key) { Mark end = this.GetCurrentToken().End; this.Skip(); if (!(this.GetCurrentToken() is Key) && (!(this.GetCurrentToken() is Value) && !(this.GetCurrentToken() is BlockEnd))) { this.states.Push(ParserState.BlockMappingValue); return(this.ParseNode(true, true)); } this.state = ParserState.BlockMappingValue; return(ProcessEmptyScalar(end)); } if (!(this.GetCurrentToken() is BlockEnd)) { Token currentToken = this.GetCurrentToken(); throw new SemanticErrorException(currentToken.Start, currentToken.End, "While parsing a block mapping, did not find expected key."); } this.state = this.states.Pop(); ParsingEvent event2 = new MappingEnd(this.GetCurrentToken().Start, this.GetCurrentToken().End); this.Skip(); return(event2); }
public void addNode(MappingEnd mappedEnd, bool source) { var path = mappedEnd.fullMappingPath.Split('.').ToList(); if (source) { this.trees.SourceTree.addNode(mappedEnd, path); } else { this.trees.TargetTree.addNode(mappedEnd, path); } //make sure the new node is visible? this.trees.ExpandAll(); }
private ParsingEvent ParseFlowMappingKey(bool isFirst) { if (isFirst) { this.GetCurrentToken(); this.Skip(); } if (!(this.GetCurrentToken() is FlowMappingEnd)) { if (!isFirst) { switch (this.GetCurrentToken()) { case (FlowEntry _): break; default: { Token currentToken = this.GetCurrentToken(); throw new SemanticErrorException(currentToken.Start, currentToken.End, "While parsing a flow mapping, did not find expected ',' or '}'."); break; } } this.Skip(); } if (this.GetCurrentToken() is Key) { this.Skip(); if (!(this.GetCurrentToken() is Value) && (!(this.GetCurrentToken() is FlowEntry) && !(this.GetCurrentToken() is FlowMappingEnd))) { this.states.Push(ParserState.FlowMappingValue); return(this.ParseNode(false, false)); } this.state = ParserState.FlowMappingValue; return(ProcessEmptyScalar(this.GetCurrentToken().Start)); } if (!(this.GetCurrentToken() is FlowMappingEnd)) { this.states.Push(ParserState.FlowMappingEmptyValue); return(this.ParseNode(false, false)); } } this.state = this.states.Pop(); ParsingEvent event2 = new MappingEnd(this.GetCurrentToken().Start, this.GetCurrentToken().End); this.Skip(); return(event2); }
private ParsingEvent ParseFlowMappingKey(bool isFirst) { if (isFirst) { GetCurrentToken(); Skip(); } if (!(GetCurrentToken() is FlowMappingEnd)) { if (!isFirst) { if (!(GetCurrentToken() is FlowEntry)) { Token token = GetCurrentToken(); throw new SemanticErrorException(token.Start, token.End, "While parsing a flow mapping, did not find expected ',' or '}'."); } Skip(); } if (GetCurrentToken() is Key) { Skip(); if (!(GetCurrentToken() is Value) && !(GetCurrentToken() is FlowEntry) && !(GetCurrentToken() is FlowMappingEnd)) { states.Push(ParserState.FlowMappingValue); return(ParseNode(false, false)); } state = ParserState.FlowMappingValue; return(ProcessEmptyScalar(GetCurrentToken().Start)); } if (!(GetCurrentToken() is FlowMappingEnd)) { states.Push(ParserState.FlowMappingEmptyValue); return(ParseNode(false, false)); } } state = states.Pop(); ParsingEvent result = new MappingEnd(GetCurrentToken().Start, GetCurrentToken().End); Skip(); return(result); }
YamlMapping(MappingStart mappingStart, MappingEnd mappingEnd, List <YamlElement> keys, Dictionary <YamlElement, YamlElement> contents, YamlNodeTracker tracker) { Tracker = tracker; MappingStart = mappingStart; this._mappingEnd = mappingEnd; if (Tracker == null) { _keys = keys; _contents = contents; } else { _keys = new List <YamlElement>(); _contents = new Dictionary <YamlElement, YamlElement>(); foreach (var key in keys) { Add(key, contents[key]); } } }
void IParsingEventVisitor.Visit(MappingEnd e) { clonedEvent = new MappingEnd(e.Start, e.End); }
public void Visit(MappingEnd e) { _branches.Pop(); _currentPath.Pop(); }
public void Visit(MappingEnd e) { _emitter.Emit(e); _branches.Pop(); _currentPath.Pop(); }