private void UpdateContextForNextConcept(TokenReader tokenReader, Stack <IConceptInfo> context, IConceptInfo conceptInfo) { if (tokenReader.TryRead("{")) { context.Push(conceptInfo); _onUpdateContext?.Invoke(tokenReader, context, true); } else if (!tokenReader.TryRead(";")) { var(dslScript, position) = tokenReader.GetPositionInScript(); throw new DslSyntaxException("Expected \";\" or \"{\".", "RH0001", dslScript, position, 0, ReportPreviousConcept(conceptInfo)); } while (tokenReader.TryRead("}")) { if (context.Count == 0) { var simpleMessage = "Unexpected \"}\"."; var(dslScript, position) = tokenReader.GetPositionInScript(); throw new DslSyntaxException(simpleMessage, "RH0007", dslScript, position, 0, null); } context.Pop(); _onUpdateContext?.Invoke(tokenReader, context, false); } }
protected void UpdateContextForNextConcept(TokenReader tokenReader, Stack <IConceptInfo> context, IConceptInfo conceptInfo) { if (tokenReader.TryRead("{")) { context.Push(conceptInfo); } else if (!tokenReader.TryRead(";")) { var sb = new StringBuilder(); sb.Append(ReportErrorContext(conceptInfo, tokenReader)); sb.Append("Expected \";\" or \"{\"."); throw new DslSyntaxException(sb.ToString()); } while (tokenReader.TryRead("}")) { if (context.Count == 0) { throw new DslSyntaxException(tokenReader.ReportPosition() + "\r\nUnexpected \"}\". "); } context.Pop(); } }
protected void UpdateContextForNextConcept(TokenReader tokenReader, Stack<IConceptInfo> context, IConceptInfo conceptInfo) { if (tokenReader.TryRead("{")) context.Push(conceptInfo); else if (!tokenReader.TryRead(";")) { var sb = new StringBuilder(); sb.Append(ReportErrorContext(conceptInfo, tokenReader.CurrentPosition)); sb.AppendFormat("Expected \";\" or \"{{\"."); throw new DslSyntaxException(sb.ToString()); } while (tokenReader.TryRead("}")) { if (context.Count == 0) throw new DslSyntaxException(_dslSource.ReportError(tokenReader.CurrentPosition) + "\r\nUnexpected \"}\". "); context.Pop(); } }