Exemplo n.º 1
0
        public void TupleSegmentWithTwoBitLength_Parse_GetTupleSegmentWithTwoBitLength()
        {
            var segment = new ArrayRunTupleSegment("tuple", "|a:", 2);

            Assert.Single(segment.Elements);
            Assert.Equal("a", segment.Elements[0].Name);
            Assert.Equal(2, segment.Elements[0].BitWidth);
        }
Exemplo n.º 2
0
 private static IEnumerable <AutocompleteItem> CreateTupleEnumSingleElementAutocompleteOptions(string fieldName, ArrayRunTupleSegment tupleSegment, List <string> previousTupleElements, IEnumerable <string> optionText, string lineEnd)
 {
     foreach (var option in optionText)
     {
         var newLine = $"{fieldName}: ";
         newLine += tupleSegment.ConstructAutocompleteLine(previousTupleElements, option);
         newLine += lineEnd;
         yield return(new AutocompleteItem(option, newLine));
     }
 }
Exemplo n.º 3
0
 private IEnumerable <AutocompleteItem> CreateTupleEnumAutocompleteOptions(IReadOnlyList <string> tokens, ArrayRunTupleSegment tupleGroup, List <string> tupleTokens, IEnumerable <string> optionText, string lineEnd)
 {
     foreach (var option in optionText)
     {
         string newLine        = ", ".Join(tokens.Take(tokens.Count - 1));
         var    previousTokens = tupleTokens.Take(tupleTokens.Count - 1).ToList();
         newLine += tupleGroup.ConstructAutocompleteLine(previousTokens, option);
         var thisLineEnd = lineEnd.Trim();
         if (thisLineEnd.StartsWith(")"))
         {
             thisLineEnd = thisLineEnd.Substring(1);
         }
         newLine += thisLineEnd;
         if (Tokenize(newLine).Count < ElementContent.Count)
         {
             newLine += ", ";
         }
         yield return(new AutocompleteItem(option, newLine));
     }
 }