コード例 #1
0
ファイル: Statement.cs プロジェクト: darrelmiller/Parrot
 internal Statement(IHost host)
     : base(host)
 {
     Attributes = new AttributeList(host);
     Children = new StatementList(host);
     Parameters = new ParameterList(host);
 }
コード例 #2
0
ファイル: Statement.cs プロジェクト: ParrotFx/Parrot
 private Statement()
 {
     Attributes = new AttributeList();
     Children = new StatementList();
     Parameters = new ParameterList();
     IdentifierParts = new List<Identifier>();
     Errors = new List<ParserError>();
 }
コード例 #3
0
ファイル: Statement.cs プロジェクト: davidregis/Parrot
 private Statement()
 {
     Attributes      = new AttributeList();
     Children        = new StatementList();
     Parameters      = new ParameterList();
     IdentifierParts = new List <Identifier>();
     Errors          = new List <ParserError>();
 }
コード例 #4
0
ファイル: Statement.cs プロジェクト: darrelmiller/Parrot
        private void AddAttributes(AttributeList attributes)
        {
            if (attributes == null)
            {
                return;
            }

            int length = attributes.Count;

            for (int i = 0; i < length; i++)
            {
                Attributes.Add(attributes[i]);
            }
        }
コード例 #5
0
ファイル: Statement.cs プロジェクト: darrelmiller/Parrot
        private void AddAttributes(AttributeList attributes)
        {
            if (attributes == null) return;

            int length = attributes.Count;
            for (int i = 0; i < length; i++)
            {
                Attributes.Add(attributes[i]);
            }
        }
コード例 #6
0
ファイル: Parser.cs プロジェクト: ParrotFx/Parrot
        private AttributeList ParseAttributes(Stream stream)
        {
            var attributes = new AttributeList();

            var open = stream.Next();
            Token token = null;

            //expecting identifier
            while (stream.Peek() != null)
            {
                token = stream.Peek();

                switch (token.Type)
                {
                    case TokenType.Identifier:
                        attributes.Add(ParseAttribute(stream));
                        break;
                    case TokenType.CloseBracket:
                        //consume close bracket
                        stream.NextNoReturn();
                        goto doneWithAttribute;
                    default:
                        //invalid token
                        Errors.Add(new AttributeIdentifierMissing
                            {
                                Index = token.Index
                            });
                        //throw new ParserException(token);
                        return attributes;
                }
            }

            doneWithAttribute:
            if (attributes.Count == 0)
            {
                //must be empty attribute list
                Errors.Add(new AttributeListEmpty
                    {
                        Index = token.Index
                    });
                return attributes;
                //throw new ParserException(token);
            }

            //do reduction here
            return attributes;
        }
コード例 #7
0
ファイル: AttributeList.cs プロジェクト: darrelmiller/Parrot
 public AttributeList(IHost host, AttributeList list, params Attribute[] nodes) : base(host)
 {
     List.AddRange(list);
     List.AddRange(nodes);
 }