Ejemplo n.º 1
0
        public IEnumerable <Lexem> Read()
        {
            int charactedRead;

            while ((charactedRead = _reader.Read()) != -1)
            {
                var character = (char)charactedRead;
                switch (character)
                {
                case '(':
                    yield return(LexemFactory.CreateLexem(LexemTokenKind.OpenBrace));

                    continue;

                case ')':
                    yield return(LexemFactory.CreateLexem(LexemTokenKind.CloseBrace));

                    continue;

                case '\'':
                    yield return(LexemFactory.CreateLexem(LexemTokenKind.Quote));

                    continue;
                }

                if (char.IsWhiteSpace(character))
                {
                    continue;
                }

                // TODO: Parse identifiers.
            }

            yield return(LexemFactory.CreateLexem(LexemTokenKind.Eof));
        }
Ejemplo n.º 2
0
        public override IList <IModelItem> getChildren()
        {
            List <IModelItem> list = new List <IModelItem>();

            list.Add(LexemFactory.getInstance().getLexem(LEFT_BRACKET));
            list.Add(new KifConstant(getName()));
            list.Add(DELIMITER);
            list.AddRange(getSequence().getChildren());
            list.Add(LexemFactory.getInstance().getLexem(RIGHT_BRACKET));
            return(list);
        }
Ejemplo n.º 3
0
        public override IList <IModelItem> getChildren() //TODO:
        {
            List <IModelItem> result = new List <IModelItem>(_sentences.getSize() + 4);

            result.Add(new KifConstant(_name));
            result.Add(DELIMITER);
            result.Add(LexemFactory.getInstance().getLexem(LEFT_BRACKET));
            result.AddRange(_sentences.getChildren());
            result.Add(LexemFactory.getInstance().getLexem(RIGHT_BRACKET));
//            KifSequence<KifObject> sequence = new KifSequence<KifObject>(new KifConstant(Name));
//            sequence.addItem(Sentence);
//            return sequence.getChildren();
            return(result);
        }
        public override IList <IModelItem> getChildren()
        {
            List <IModelItem> list = new List <IModelItem>();

            list.Add(LexemFactory.getInstance().getLexem(LEFT_BRACKET));
            list.Add(_constant);
            if (!_terms.isEmpty())
            {
                list.Add(DELIMITER);
                list.AddRange(_terms.getChildren());
            }
            if (_variable != null)
            {
                list.Add(DELIMITER);
                list.Add(_variable);
            }
            list.Add(LexemFactory.getInstance().getLexem(RIGHT_BRACKET));
            return(list);
        }
Ejemplo n.º 5
0
        public override IList <IModelItem> getChildren()
        {
            List <IModelItem> result       = new List <IModelItem>();
            LexemFactory      lexemFactory = LexemFactory.getInstance();

            result.Add(lexemFactory.getLexem(LEFT_BRACKET));
            result.Add(lexemFactory.getLexem(getConstructionName()));
            result.Add(DELIMITER);
            result.Add(new KifConstant(Name));
            result.Add(DELIMITER);
            if (_string != null)
            {
                result.Add(new KifString(_string));
                result.Add(DELIMITER);
            }
            result.AddRange(getInnerChildren());
            result.Add(lexemFactory.getLexem(RIGHT_BRACKET));
            return(result);
        }
Ejemplo n.º 6
0
        public override IList <IModelItem> getChildren()
        {
            List <IModelItem> result       = new List <IModelItem>();
            LexemFactory      lexemFactory = LexemFactory.getInstance();

            result.Add(lexemFactory.getLexem(LEFT_BRACKET));
            result.Add(new KifConstant(getConstant()));
            if (!(_termSeq == null || _termSeq.isEmpty()))
            {
                result.Add(DELIMITER);
                result.AddRange(_termSeq.getChildren());
            }
            if (_sequenceVar != null)
            {
                result.Add(DELIMITER);
                result.Add(_sequenceVar);
            }
            result.Add(lexemFactory.getLexem(RIGHT_BRACKET));
            return(result);
        }
Ejemplo n.º 7
0
        protected abstract ICollection <IModelItem> getInnerChildren(); //TODO:

        public override IList <IModelItem> getChildren()
        {
            List <IModelItem> list = new List <IModelItem>();

            list.Add(LexemFactory.getInstance().getLexem(LEFT_BRACKET));
            list.Add(LexemFactory.getInstance().getLexem(getConstructionName()));
            list.Add(new KifConstant(getName()));
            if (_argList != null && !_argList.isEmpty())
            {
                list.Add(LexemFactory.getInstance().getLexem(LEFT_BRACKET)); //TODO:
                list.AddRange(_argList.getChildren());
                list.Add(LexemFactory.getInstance().getLexem(RIGHT_BRACKET));
            }
            if (_docString != null)
            {
                list.Add(new KifSequence <KifObject>(_docString));
            }
            list.AddRange(getInnerChildren());
            list.Add(LexemFactory.getInstance().getLexem(RIGHT_BRACKET));
            return(list);
        }