コード例 #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;
 }
コード例 #2
0
ファイル: SerializeVisitor.cs プロジェクト: mind-owner/Tools
 public void Visit(ArrayTypeDecl decl)
 {
     Serialize(decl);
     this.Element.Add(new XElement("Element", decl.Element.Serialize()));
     this.Element.Add(new XAttribute("Expression", decl.Expression));
 }
コード例 #3
0
 public void Visit(ArrayTypeDecl decl)
 {
     this.Result = "array[" + decl.Expression + "] " + decl.Element.ToString();
 }
コード例 #4
0
 public void Visit(ArrayTypeDecl decl)
 {
     decl.Element.Resolve(this.Symbol, this.Environment);
 }
コード例 #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));
 }
コード例 #6
0
ファイル: CppTypeParser.cs プロジェクト: jerrylee1999/GacUI
        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;
                }
            }
        }
コード例 #7
0
 public void Visit(ArrayTypeDecl decl)
 {
     decl.Element.Resolve(this.Symbol, this.Environment);
 }
コード例 #8
0
 public void Visit(ArrayTypeDecl decl)
 {
     this.Result = "array[" + decl.Expression + "] " + decl.Element.ToString();
 }