コード例 #1
0
        public override IList <string> GetFirsts()
        {
            var result = new StringList();

            result.AddRange(Prefixes);
            //we assume that prefix is always optional, so string can start with start-end symbol
            result.AddRange(_startSymbolsFirsts.Select(ch => ch.ToString()));

            return(result);
        }
コード例 #2
0
ファイル: FreeTextLiteral.cs プロジェクト: DevMk/Irony
        }//constructor

        public override IList <string> GetFirsts()
        {
            var result = new StringList();

            result.AddRange(Firsts);
            return(result);
        }
コード例 #3
0
ファイル: CommentTerminal.cs プロジェクト: hozuki/irony-vs
 public CommentTerminal(string name, string startSymbol, params string[] endSymbols) : base(name, TokenCategory.Comment)
 {
     StartSymbol = startSymbol;
     EndSymbols  = new StringList();
     EndSymbols.AddRange(endSymbols);
     Priority = TerminalPriority.High; //assign max priority
 }
コード例 #4
0
ファイル: NewLineTerminal.cs プロジェクト: hozuki/irony-vs
        public override IList <string> GetFirsts()
        {
            var firsts = new StringList();

            firsts.AddRange(LineTerminators.Select(t => t.ToString()));
            return(firsts);
        }
コード例 #5
0
ファイル: NumberLiteral.cs プロジェクト: yangbodevp/irony
        public override IList <string> GetFirsts()
        {
            StringList result = new StringList();

            result.AddRange(base.Prefixes);
            //we assume that prefix is always optional, so number can always start with plain digit
            result.AddRange(new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" });
            // Python float numbers can start with a dot
            if (IsSet(NumberOptions.AllowStartEndDot))
            {
                result.Add(DecimalSeparator.ToString());
            }
            if (IsSet(NumberOptions.AllowSign))
            {
                result.AddRange(new string[] { "-", "+" });
            }
            return(result);
        }
コード例 #6
0
        public static string JoinStrings(string separator, IEnumerable <string> values)
        {
            StringList list = new StringList();

            list.AddRange(values);
            string[] arr = new string[list.Count];
            list.CopyTo(arr, 0);
            return(string.Join(separator, arr));
        }
コード例 #7
0
        public LineContinuationTerminal(string name, params string[] startSymbols) : base(name, TokenCategory.Outline)
        {
            var symbols = startSymbols.Where(s => !IsNullOrWhiteSpace(s)).ToArray();

            StartSymbols = new StringList(symbols);
            if (StartSymbols.Count == 0)
            {
                StartSymbols.AddRange(_defaultStartSymbols);
            }
            Priority = TerminalPriority.High;
        }
コード例 #8
0
        }//method

        public override IList <string> GetFirsts()
        {
            StringList result = new StringList();

            result.AddRange(Prefixes);
            //we assume that prefix is always optional, so string can start with start-end symbol
            foreach (char ch in _startSymbolsFirsts)
            {
                result.Add(ch.ToString());
            }
            return(result);
        }
コード例 #9
0
        //TODO: put into account non-Ascii aplhabets specified by means of Unicode categories!
        public override IList <string> GetFirsts()
        {
            var list = new StringList();

            list.AddRange(Prefixes);
            foreach (char ch in _allFirstCharsSet)
            {
                list.Add(ch.ToString());
            }
            if ((Options & IdOptions.CanStartWithEscape) != 0)
            {
                list.Add(this.EscapeChar.ToString());
            }
            return(list);
        }
コード例 #10
0
        //TODO: put into account non-Ascii aplhabets specified by means of Unicode categories!
        public override IList <string> GetFirsts()
        {
            StringList list = new StringList();

            list.AddRange(Prefixes);
            if (string.IsNullOrEmpty(AllFirstChars))
            {
                return(list);
            }
            char[] chars = AllFirstChars.ToCharArray();
            foreach (char ch in chars)
            {
                list.Add(ch.ToString());
            }
            if ((Options & IdOptions.CanStartWithEscape) != 0)
            {
                list.Add(this.EscapeChar.ToString());
            }
            return(list);
        }