Exemplo n.º 1
0
 public void Visit(ArrayTypeDecl decl)
 {
     Deserialize(decl);
     decl.Element    = TypeDecl.Deserialize(this.Element.Element("Element").Elements().First());
     decl.Expression = this.Element.Attribute("Expression").Value;
 }
Exemplo n.º 2
0
 public void Visit(ArrayTypeDecl decl)
 {
     Serialize(decl);
     this.Element.Add(new XElement("Element", decl.Element.Serialize()));
     this.Element.Add(new XAttribute("Expression", decl.Expression));
 }
Exemplo n.º 3
0
 public void Visit(ArrayTypeDecl decl)
 {
     this.Result = "array[" + decl.Expression + "] " + decl.Element.ToString();
 }
Exemplo n.º 4
0
 public void Visit(ArrayTypeDecl decl)
 {
     decl.Element.Resolve(this.Symbol, this.Environment);
 }
Exemplo n.º 5
0
 public void Visit(ArrayTypeDecl decl)
 {
     Serialize(decl);
     this.Element.Add(new XElement("Element", decl.Element.Serialize()));
     this.Element.Add(new XAttribute("Expression", decl.Expression));
 }
Exemplo n.º 6
0
        internal static void ParseTypeContinueAfterName(string[] tokens, ref int index, ref CallingConvention callingConvention, out TypeDecl decl, out Action<TypeDecl> continuation)
        {
            decl = null;
            continuation = null;

            while (true)
            {
                if (CppParser.Token(tokens, ref index, "["))
                {
                    var oldIndex = index;
                    CppParser.SkipUntil(tokens, ref index, "]");
                    var arrayDecl = new ArrayTypeDecl
                    {
                        Expression = tokens
                            .Skip(oldIndex)
                            .Take(index - 1 - oldIndex)
                            .Aggregate("", (a, b) => a == "" ? b : a + " " + b),
                    };
                    if (decl == null)
                    {
                        continuation = x => arrayDecl.Element = x;
                    }
                    else
                    {
                        arrayDecl.Element = decl;
                    }
                    decl = arrayDecl;
                }
                else if (CppParser.Token(tokens, ref index, "("))
                {
                    var funcDecl = new FunctionTypeDecl
                    {
                        Const = false,
                        CallingConvention = callingConvention,
                        Parameters = new List<VarDecl>(),
                    };
                    callingConvention = CallingConvention.Default;

                    if (decl == null)
                    {
                        continuation = x => funcDecl.ReturnType = x;
                    }
                    else
                    {
                        funcDecl.ReturnType = decl;
                    }
                    decl = funcDecl;

                    bool skipParameters = false;
                    if (CppParser.Token(tokens, ref index, "void"))
                    {
                        if (CppParser.Token(tokens, ref index, ")"))
                        {
                            skipParameters = true;
                        }
                        else
                        {
                            index--;
                        }
                    }

                    if (!skipParameters && !CppParser.Token(tokens, ref index, ")"))
                    {
                        while (true)
                        {
                            string name = null;
                            var parameterType = EnsureType(tokens, ref index, out name);

                            funcDecl.Parameters.Add(new VarDecl
                            {
                                Static = false,
                                Name = name,
                                Type = parameterType,
                            });

                            if (CppParser.Token(tokens, ref index, "="))
                            {
                                CppParser.SkipUntilInTemplate(tokens, ref index, ",", ")", ";");
                                index--;
                            }

                            if (CppParser.Token(tokens, ref index, ")"))
                            {
                                break;
                            }
                            CppParser.EnsureToken(tokens, ref index, ",");
                        }
                    }

                    while (true)
                    {
                        if (CppParser.Token(tokens, ref index, "const"))
                        {
                            funcDecl.Const = true;
                        }
                        else if (CppParser.Token(tokens, ref index, "override"))
                        {

                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    break;
                }
            }
        }
Exemplo n.º 7
0
 public void Visit(ArrayTypeDecl decl)
 {
     decl.Element.Resolve(this.Symbol, this.Environment);
 }
Exemplo n.º 8
0
 public void Visit(ArrayTypeDecl decl)
 {
     this.Result = "array[" + decl.Expression + "] " + decl.Element.ToString();
 }