Exemple #1
0
        private static Chart _createChart(IEnumerable <Rule> rules, IEnumerable <Token> tokens)
        {
            var sRls   = StartTerminal.Create(rules.Where(x => x.IsStart)).ToArray();
            var parser = new EarleyParser(sRls, null);

            return(parser.Parse(tokens));
        }
Exemple #2
0
        public override void BasicDraw(Context context)
        {
            if (_points.Count < 2)
            {
                return;
            }

            context.LineWidth = LineWidth;
            context.LineJoin  = LineJoin.Round;
            context.Color     = LineColor;

            if (Dashes != null)
            {
                context.SetDash(Dashes, 0);
            }

            PointD start, end;

            if (StartTerminal != null)
            {
                start = StartTerminal.Draw(context, StartPoint, _points [1]);
            }
            else
            {
                start = StartPoint;
            }

            if (EndTerminal != null)
            {
                end = EndTerminal.Draw(context, EndPoint, _points [PointCount - 2]);
            }
            else
            {
                end = EndPoint;
            }

            context.MoveTo(start);

            for (int i = 1; i < _points.Count - 1; i++)
            {
                context.LineTo(_points [i]);
            }

            context.LineTo(end);

            context.Stroke();
        }