public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement) { this.typeReference = typeReference; this.variableName = variableName; this.expression = expression; this.embeddedStatement = embeddedStatement; }
public PropertyDeclaration(string name, TypeReference typeReference, Modifier modifier, ArrayList attributes) { this.name = name; this.typeReference = typeReference; this.modifier = modifier; this.attributes = attributes; }
public IndexerDeclaration(TypeReference typeReference, ArrayList parameters, Modifier modifier, ArrayList attributes) { this.type = typeReference; this.modifier = modifier; this.parameters = parameters; this.attributes = attributes; }
public MethodDeclaration(string name, Modifier modifier, TypeReference typeReference, ArrayList parameters, ArrayList attributes) { this.name = name; this.modifier = modifier; this.typeReference = typeReference; this.parameters = parameters; this.attributes = attributes; }
public EventDeclaration(TypeReference typeReference, string name, Modifier modifier, ArrayList attributes) { this.typeReference = typeReference; this.name = name; this.variableDeclarators = null; this.modifier = modifier; this.attributes = attributes; }
public void AddVariable(TypeReference typeRef, string name, Point startPos, Point endPos) { if (name == null || name.Length == 0) { return; } ArrayList list; if (variables[name] == null) { variables[name] = list = new ArrayList(); } else { list = (ArrayList)variables[name]; } list.Add(new LocalLookupVariable(typeRef, startPos, endPos)); }
public string Convert(TypeReference typeRef) { StringBuilder builder = new StringBuilder(); builder.Append(ConvType(typeRef.Type)); for (int i = 0; i < typeRef.PointerNestingLevel; ++i) { builder.Append('*'); } for (int i = 0; i < typeRef.RankSpecifier.Length; ++i) { builder.Append('['); for (int j = 1; j < typeRef.RankSpecifier[i]; ++j) { builder.Append(','); } builder.Append(']'); } return builder.ToString(); }
public ArrayCreateExpression(TypeReference createType) { this.createType = createType; }
void NonArrayType( #line 872 "cs.ATG" out TypeReference type) { #line 874 "cs.ATG" string name = ""; int pointer = 0; if (la.kind == 1 || la.kind == 90 || la.kind == 107) { ClassType( #line 878 "cs.ATG" out name); } else if (StartOf(14)) { SimpleType( #line 879 "cs.ATG" out name); } else if (la.kind == 122) { lexer.NextToken(); Expect(6); #line 880 "cs.ATG" pointer = 1; name = "void"; } else SynErr(155); while ( #line 882 "cs.ATG" IsPointer()) { Expect(6); #line 883 "cs.ATG" ++pointer; } #line 886 "cs.ATG" type = new TypeReference(name, pointer, null); }
string GetTypeString(TypeReference typeRef) { if (typeRef == null) { errors.Error(-1, -1, String.Format("Got empty type string (internal error, check generated source code for empty types")); return String.Empty; } string typeStr = ConvertTypeString(typeRef.Type); StringBuilder arrays = new StringBuilder(); if (typeRef.RankSpecifier != null) { for (int i = 0; i < typeRef.RankSpecifier.Length; ++i) { arrays.Append("("); for (int j = 1; j < typeRef.RankSpecifier[i]; ++j) { arrays.Append(","); } arrays.Append(")"); } } if (typeRef.PointerNestingLevel > 0) { errors.Error(-1, -1, String.Format("Pointer types are not suported by VB.NET")); } return typeStr + arrays.ToString(); }
public CastExpression(TypeReference castTo, Expression expression) { this.castTo = castTo; this.expression = expression; }
public TypeOfExpression(TypeReference typeReference) { this.typeReference = typeReference; }
// for all other cases public FieldDeclaration(ArrayList attributes, TypeReference typeReference, Modifier modifier) { this.attributes = attributes; this.typeReference = typeReference; this.modifier = modifier; }
public CastExpression(TypeReference castTo) { this.castTo = castTo; }
public OperatorDeclarator(OperatorType operatorType,TypeReference typeReference, TypeReference firstParameterType, string firstParameterName) { this.operatorType = operatorType; this.typeReference = typeReference; this.firstParameterType = firstParameterType; this.firstParameterName = firstParameterName; }
public TypeReferenceExpression(string type) { this.typeReference = new TypeReference(type); }
void PrimaryExpr( #line 1824 "cs.ATG" out Expression pexpr) { #line 1826 "cs.ATG" TypeReference type = null; bool isArrayCreation = false; Expression expr; pexpr = null; switch (la.kind) { case 112: { lexer.NextToken(); #line 1833 "cs.ATG" pexpr = new PrimitiveExpression(true, "true"); break; } case 71: { lexer.NextToken(); #line 1834 "cs.ATG" pexpr = new PrimitiveExpression(false, "false"); break; } case 89: { lexer.NextToken(); #line 1835 "cs.ATG" pexpr = new PrimitiveExpression(null, "null"); break; } case 2: { lexer.NextToken(); #line 1836 "cs.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 1: { lexer.NextToken(); #line 1838 "cs.ATG" pexpr = new IdentifierExpression(t.val); break; } case 18: { lexer.NextToken(); Expr( #line 1840 "cs.ATG" out expr); Expect(19); #line 1840 "cs.ATG" pexpr = new ParenthesizedExpression(expr); break; } case 51: case 53: case 56: case 61: case 65: case 74: case 81: case 86: case 90: case 101: case 103: case 107: case 115: case 116: case 119: { switch (la.kind) { case 51: { lexer.NextToken(); break; } case 53: { lexer.NextToken(); break; } case 56: { lexer.NextToken(); break; } case 61: { lexer.NextToken(); break; } case 65: { lexer.NextToken(); break; } case 74: { lexer.NextToken(); break; } case 81: { lexer.NextToken(); break; } case 86: { lexer.NextToken(); break; } case 90: { lexer.NextToken(); break; } case 101: { lexer.NextToken(); break; } case 103: { lexer.NextToken(); break; } case 107: { lexer.NextToken(); break; } case 115: { lexer.NextToken(); break; } case 116: { lexer.NextToken(); break; } case 119: { lexer.NextToken(); break; } } #line 1846 "cs.ATG" string val = t.val; t.val = ""; Expect(13); Expect(1); #line 1846 "cs.ATG" pexpr = new FieldReferenceExpression(new TypeReferenceExpression(val), t.val); break; } case 110: { lexer.NextToken(); #line 1848 "cs.ATG" pexpr = new ThisReferenceExpression(); break; } case 50: { lexer.NextToken(); #line 1850 "cs.ATG" Expression retExpr = new BaseReferenceExpression(); if (la.kind == 13) { lexer.NextToken(); Expect(1); #line 1852 "cs.ATG" retExpr = new FieldReferenceExpression(retExpr, t.val); } else if (la.kind == 16) { lexer.NextToken(); Expr( #line 1853 "cs.ATG" out expr); #line 1853 "cs.ATG" ArrayList indices = new ArrayList(); indices.Add(expr); while (la.kind == 12) { lexer.NextToken(); Expr( #line 1854 "cs.ATG" out expr); #line 1854 "cs.ATG" indices.Add(expr); } Expect(17); #line 1855 "cs.ATG" retExpr = new IndexerExpression(retExpr, indices); } else SynErr(179); #line 1856 "cs.ATG" pexpr = retExpr; break; } case 88: { lexer.NextToken(); NonArrayType( #line 1857 "cs.ATG" out type); #line 1857 "cs.ATG" ArrayList parameters = new ArrayList(); if (la.kind == 18) { lexer.NextToken(); #line 1862 "cs.ATG" ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); if (StartOf(21)) { Argument( #line 1862 "cs.ATG" out expr); #line 1862 "cs.ATG" parameters.Add(expr); while (la.kind == 12) { lexer.NextToken(); Argument( #line 1863 "cs.ATG" out expr); #line 1863 "cs.ATG" parameters.Add(expr); } } Expect(19); #line 1863 "cs.ATG" pexpr = oce; } else if (la.kind == 16) { #line 1865 "cs.ATG" isArrayCreation = true; ArrayCreateExpression ace = new ArrayCreateExpression(type); pexpr = ace; lexer.NextToken(); #line 1866 "cs.ATG" int dims = 0; ArrayList rank = new ArrayList(); ArrayList parameterExpression = new ArrayList(); if (StartOf(4)) { Expr( #line 1868 "cs.ATG" out expr); #line 1868 "cs.ATG" parameterExpression.Add(expr); while (la.kind == 12) { lexer.NextToken(); Expr( #line 1868 "cs.ATG" out expr); #line 1868 "cs.ATG" parameterExpression.Add(expr); } Expect(17); #line 1868 "cs.ATG" parameters.Add(new ArrayCreationParameter(parameterExpression)); ace.Parameters = parameters; while ( #line 1869 "cs.ATG" IsDims()) { Expect(16); #line 1869 "cs.ATG" dims =0; while (la.kind == 12) { lexer.NextToken(); #line 1869 "cs.ATG" dims++; } #line 1869 "cs.ATG" rank.Add(dims); parameters.Add(new ArrayCreationParameter(dims)); Expect(17); } #line 1870 "cs.ATG" if (rank.Count > 0) { ace.Rank = (int[])rank.ToArray(typeof (int)); } if (la.kind == 14) { ArrayInitializer( #line 1871 "cs.ATG" out expr); #line 1871 "cs.ATG" ace.ArrayInitializer = (ArrayInitializerExpression)expr; } } else if (la.kind == 12 || la.kind == 17) { while (la.kind == 12) { lexer.NextToken(); #line 1873 "cs.ATG" dims++; } #line 1873 "cs.ATG" parameters.Add(new ArrayCreationParameter(dims)); Expect(17); while ( #line 1873 "cs.ATG" IsDims()) { Expect(16); #line 1873 "cs.ATG" dims =0; while (la.kind == 12) { lexer.NextToken(); #line 1873 "cs.ATG" dims++; } #line 1873 "cs.ATG" parameters.Add(new ArrayCreationParameter(dims)); Expect(17); } ArrayInitializer( #line 1873 "cs.ATG" out expr); #line 1873 "cs.ATG" ace.ArrayInitializer = (ArrayInitializerExpression)expr; ace.Parameters = parameters; } else SynErr(180); } else SynErr(181); break; } case 114: { lexer.NextToken(); Expect(18); if ( #line 1879 "cs.ATG" NotVoidPointer()) { Expect(122); #line 1879 "cs.ATG" type = new TypeReference("void"); } else if (StartOf(8)) { Type( #line 1880 "cs.ATG" out type); } else SynErr(182); Expect(19); #line 1881 "cs.ATG" pexpr = new TypeOfExpression(type); break; } case 104: { lexer.NextToken(); Expect(18); Type( #line 1882 "cs.ATG" out type); Expect(19); #line 1882 "cs.ATG" pexpr = new SizeOfExpression(type); break; } case 57: { lexer.NextToken(); Expect(18); Expr( #line 1883 "cs.ATG" out expr); Expect(19); #line 1883 "cs.ATG" pexpr = new CheckedExpression(expr); break; } case 117: { lexer.NextToken(); Expect(18); Expr( #line 1884 "cs.ATG" out expr); Expect(19); #line 1884 "cs.ATG" pexpr = new CheckedExpression(expr); break; } default: SynErr(183); break; } while (StartOf(27)) { if (la.kind == 29 || la.kind == 30) { if (la.kind == 29) { lexer.NextToken(); #line 1888 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); } else if (la.kind == 30) { lexer.NextToken(); #line 1889 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); } else SynErr(184); } else if (la.kind == 47) { lexer.NextToken(); Expect(1); #line 1892 "cs.ATG" pexpr = new PointerReferenceExpression(pexpr, t.val); } else if (la.kind == 13) { lexer.NextToken(); Expect(1); #line 1893 "cs.ATG" pexpr = new FieldReferenceExpression(pexpr, t.val); } else if (la.kind == 18) { lexer.NextToken(); #line 1895 "cs.ATG" ArrayList parameters = new ArrayList(); if (StartOf(21)) { Argument( #line 1896 "cs.ATG" out expr); #line 1896 "cs.ATG" parameters.Add(expr); while (la.kind == 12) { lexer.NextToken(); Argument( #line 1897 "cs.ATG" out expr); #line 1897 "cs.ATG" parameters.Add(expr); } } Expect(19); #line 1898 "cs.ATG" pexpr = new InvocationExpression(pexpr, parameters); } else { #line 1900 "cs.ATG" if (isArrayCreation) Error("element access not allow on array creation"); ArrayList indices = new ArrayList(); lexer.NextToken(); Expr( #line 1903 "cs.ATG" out expr); #line 1903 "cs.ATG" indices.Add(expr); while (la.kind == 12) { lexer.NextToken(); Expr( #line 1904 "cs.ATG" out expr); #line 1904 "cs.ATG" indices.Add(expr); } Expect(17); #line 1905 "cs.ATG" pexpr = new IndexerExpression(pexpr, indices); } } }
void Type( #line 853 "cs.ATG" out TypeReference type) { #line 855 "cs.ATG" string name = ""; int pointer = 0; if (la.kind == 1 || la.kind == 90 || la.kind == 107) { ClassType( #line 859 "cs.ATG" out name); } else if (StartOf(14)) { SimpleType( #line 860 "cs.ATG" out name); } else if (la.kind == 122) { lexer.NextToken(); Expect(6); #line 861 "cs.ATG" pointer = 1; name = "void"; } else SynErr(133); #line 862 "cs.ATG" ArrayList r = new ArrayList(); while ( #line 863 "cs.ATG" IsPointerOrDims()) { #line 863 "cs.ATG" int i = 1; if (la.kind == 6) { lexer.NextToken(); #line 864 "cs.ATG" ++pointer; } else if (la.kind == 16) { lexer.NextToken(); while (la.kind == 12) { lexer.NextToken(); #line 865 "cs.ATG" ++i; } Expect(17); #line 865 "cs.ATG" r.Add(i); } else SynErr(134); } #line 867 "cs.ATG" int[] rank = new int[r.Count]; r.CopyTo(rank); type = new TypeReference(name, pointer, rank); }
public FixedStatement(TypeReference type) { this.type = type; }
public LocalVariableDeclaration(TypeReference type, Modifier modifier) { this.type = type; this.modifier = modifier; }
ArrayList variables = new ArrayList(); // [VariableDeclaration] #endregion Fields #region Constructors public LocalVariableDeclaration(TypeReference type) { this.type = type; }
public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParamModifiers paramModifiers) { this.typeReference = typeReference; this.parameterName = parameterName; this.paramModifiers = paramModifiers; }
public ObjectCreateExpression(TypeReference createType, ArrayList parameters) { this.createType = createType; this.parameters = parameters; }
public LocalLookupVariable(TypeReference typeRef, Point startPos, Point endPos) { this.typeRef = typeRef; this.startPos = startPos; this.endPos = endPos; }
public StackAllocExpression(TypeReference type, Expression expression) { this.type = type; this.expression = expression; }
public OperatorDeclarator(OperatorType operatorType, TypeReference typeReference, int overloadOperatorToken, TypeReference firstParameterType, string firstParameterName, TypeReference secondParameterType, string secondParameterName) { this.operatorType = operatorType; this.typeReference = typeReference; this.overloadOperatorToken = overloadOperatorToken; this.firstParameterType = firstParameterType; this.firstParameterName = firstParameterName; this.secondParameterType = secondParameterType; this.secondParameterName = secondParameterName; }
object Visit(TypeReference type, object data) { outputFormatter.PrintIdentifier(type.Type); for (int i = 0; i < type.PointerNestingLevel; ++i) { outputFormatter.PrintToken(Tokens.Times); } if (type.IsArrayType) { for (int i = 0; i < type.RankSpecifier.Length; ++i) { outputFormatter.PrintToken(Tokens.OpenSquareBracket); for (int j = 1; j < type.RankSpecifier[i]; ++j) { outputFormatter.PrintToken(Tokens.Comma); } outputFormatter.PrintToken(Tokens.CloseSquareBracket); } } return null; }