internal static PkgdefRegistryKeyDataItemSegment ParseRegistryKeyDataItem(int startIndex, string text) { PreCondition.AssertGreaterThanOrEqualTo(startIndex, 0, nameof(startIndex)); PreCondition.AssertNotNullAndNotEmpty(text, nameof(text)); PreCondition.AssertOneOf(text[0], "@\"", "text[0]"); Action <PkgdefIssue> onIssue = PkgdefDocument.IgnoreIssue; PkgdefTokenizer tokenizer = PkgdefTokenizer.Create(startIndex, text, onIssue); tokenizer.Next(); return(PkgdefDocument.ParseRegistryKeyDataItem(tokenizer, onIssue)); }
private static PkgdefSegment ParseSegment(PkgdefTokenizer tokenizer, Action <PkgdefIssue> onIssue) { PreCondition.AssertNotNull(tokenizer, nameof(tokenizer)); PreCondition.AssertTrue(tokenizer.HasCurrent(), "tokenizer.HasCurrent()"); PreCondition.AssertNotNull(onIssue, nameof(onIssue)); PkgdefSegment result; switch (tokenizer.GetCurrent().GetTokenType()) { case PkgdefTokenType.Whitespace: result = PkgdefSegment.Whitespace(tokenizer.GetCurrent().GetStartIndex(), tokenizer.GetCurrent().GetText()); tokenizer.Next(); break; case PkgdefTokenType.NewLine: result = PkgdefSegment.NewLine(tokenizer.GetCurrent().GetStartIndex(), tokenizer.GetCurrent().GetText()); tokenizer.Next(); break; case PkgdefTokenType.ForwardSlash: result = PkgdefDocument.ParseLineComment(tokenizer, onIssue); break; case PkgdefTokenType.LeftSquareBracket: result = PkgdefDocument.ParseRegistryKeyPath(tokenizer, onIssue); break; case PkgdefTokenType.AtSign: case PkgdefTokenType.DoubleQuote: result = PkgdefDocument.ParseRegistryKeyDataItem(tokenizer, onIssue); break; default: result = PkgdefSegment.Unrecognized(tokenizer.GetCurrent().GetStartIndex(), tokenizer.GetCurrent().GetText()); tokenizer.Next(); break; } return(result); }
public static PkgdefRegistryKeyDataItemSegment RegistryKeyDataItem(int startIndex, string text) { return(PkgdefDocument.ParseRegistryKeyDataItem(startIndex, text)); }