public ParsingException(int code, IParsingSourceStream sourceStream, Exception innerException, [CallerLineNumber] int lineNumber = 0, [CallerFilePath] string filePath = null, [CallerMemberName] string caller = null) : base(innerException.Message, innerException) { Code = code; Directory = null; ParsingSource = sourceStream.FreezedPosition(); LineNumber = lineNumber; FilePath = ShortFilePath(filePath); Caller = caller; }
private void ParseComponent(IParsingSourceStream sourceStream, ref IComponentEvent queryEvent, ref IDeclarationSource areaSource, ref IParsingSource allAreaLayoutsSource, ref Dictionary <IDeclarationSource, string> areaLayoutsPairs, ref IDeclarationSource designSource, ref IDeclarationSource widthSource, ref IDeclarationSource heightSource, ref bool isScrollable, ref IDeclarationSource backgroundSource, ref IDeclarationSource backgroundColorSource, ref string tag) { string Line = sourceStream.Line; if (Line.Trim() == "scrollable") { isScrollable = true; return; } IDeclarationSource ComponentSource; string ComponentValue; ParserDomain.ParseStringPair(sourceStream, ':', out ComponentSource, out ComponentValue); //ComponentValue = ComponentValue.ToLower(); if (ComponentSource.Name == "open on query") { if (queryEvent == null) { queryEvent = ParseQueryEvent(sourceStream, ComponentValue); } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else if (ComponentSource.Name == "area") { if (areaSource == null) { areaSource = new DeclarationSource(ComponentValue, sourceStream); } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else if (ComponentSource.Name == "default area layout") { if (areaLayoutsPairs == null) { allAreaLayoutsSource = sourceStream.FreezedPosition(); areaLayoutsPairs = ParseAreaLayoutsPairs(sourceStream, ComponentValue); } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else if (ComponentSource.Name == "design") { if (designSource == null) { designSource = new DeclarationSource(ComponentValue, sourceStream); } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else if (ComponentSource.Name == "width") { if (widthSource == null) { widthSource = new DeclarationSource(ComponentValue, sourceStream); } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else if (ComponentSource.Name == "height") { if (heightSource == null) { heightSource = new DeclarationSource(ComponentValue, sourceStream); } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else if (ComponentSource.Name == "background") { if (backgroundSource == null) { backgroundSource = new DeclarationSource(ComponentValue, sourceStream); } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else if (ComponentSource.Name == "background color") { if (backgroundColorSource == null) { backgroundColorSource = new DeclarationSource(ComponentValue, sourceStream); } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else if (ComponentSource.Name == "tag") { if (tag == null) { tag = ComponentValue; } else { throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once."); } } else { throw new ParsingException(115, sourceStream, $"Specifier '{ComponentSource.Name}' was unexpected."); } }
public DeclarationSource(string name, IParsingSourceStream sourceStream) { Name = name; Source = sourceStream?.FreezedPosition(); }
public static string ToCSharpName(IParsingSourceStream sourceStream, string name) { return(ToCSharpName(sourceStream.FreezedPosition(), name)); }
public static string ToXamlName(IParsingSourceStream sourceStream, string name, string suffix) { return(ToXamlName(sourceStream.FreezedPosition(), name, suffix)); }