Beispiel #1
0
        public static PkgdefTokenizer Create(int startIndex, Iterator <char> characters, Action <PkgdefIssue> onIssue)
        {
            PreCondition.AssertGreaterThanOrEqualTo(startIndex, 0, nameof(startIndex));
            PreCondition.AssertNotNull(characters, "characters");

            return(new PkgdefTokenizer(CurrentIndexIterator.Create(startIndex, characters), onIssue));
        }
Beispiel #2
0
        public static PkgdefTokenizer Create(int startIndex, string text, Action <PkgdefIssue> onIssue)
        {
            PreCondition.AssertGreaterThanOrEqualTo(startIndex, 0, nameof(startIndex));
            PreCondition.AssertNotNull(text, "text");

            return(PkgdefTokenizer.Create(startIndex, Iterator.Create(text), onIssue));
        }
Beispiel #3
0
        public PkgdefToken(int startIndex, string text, PkgdefTokenType tokenType)
        {
            PreCondition.AssertGreaterThanOrEqualTo(startIndex, 0, nameof(startIndex));
            PreCondition.AssertNotNullAndNotEmpty(text, nameof(text));

            this.startIndex = startIndex;
            this.text       = text;
            this.tokenType  = tokenType;
        }
Beispiel #4
0
        /// <summary>
        /// Create a new PkgdefIssue object.
        /// </summary>
        /// <param name="startIndex">The character index that the issue starts on.</param>
        /// <param name="length">The number of characters that the issue spans over.</param>
        /// <param name="message">The message that describes the issue.</param>
        public PkgdefIssue(int startIndex, int length, string message)
        {
            PreCondition.AssertGreaterThanOrEqualTo(startIndex, 0, nameof(startIndex));
            PreCondition.AssertGreaterThanOrEqualTo(length, 1, nameof(length));
            PreCondition.AssertNotNullAndNotEmpty(message, nameof(message));

            this.startIndex = startIndex;
            this.length     = length;
            this.message    = message;
        }
Beispiel #5
0
        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));
        }
Beispiel #6
0
        /// <summary>
        /// Get the index directly after (not contained by) this PkgdefSegment.
        /// </summary>
        public virtual int GetAfterEndIndex()
        {
            PreCondition.AssertGreaterThanOrEqualTo(this.GetLength(), 1, "this.GetLength()");

            return(this.GetStartIndex() + this.GetLength());
        }
Beispiel #7
0
        /// <summary>
        /// Get the last index that is contained by this PkgdefToken.
        /// </summary>
        public int GetEndIndex()
        {
            PreCondition.AssertGreaterThanOrEqualTo(this.GetLength(), 1, "this.GetLength()");

            return(this.GetAfterEndIndex() - 1);
        }