internal void AddLabel(SimpleName label) { this.labelIndex[label.Name.UniqueKey] = this.cases.Count; GotoStatement gotoStatement = new GotoStatement(label, SourceDummy.SourceLocation); List<Statement> statements = new List<Statement>(1); statements.Add(gotoStatement); this.cases.Add(new SwitchCase(new CompileTimeConstant(this.cases.Count, label.SourceLocation), statements, SourceDummy.SourceLocation)); }
internal FieldDeclaration AddFieldForLocal(SimpleName localName, Expression initialValue, ISourceLocation sourceLocation) { FieldDeclaration field = new FieldDeclaration(null, FieldDeclaration.Flags.Static, TypeMemberVisibility.Private, TypeExpression.For(initialValue.Type), new NameDeclaration(localName.Name, localName.SourceLocation), null, sourceLocation); field.SetContainingTypeDeclaration(this, false); this.members.Add(field); this.localFieldFor.Add(localName.Name.UniqueKeyIgnoringCase, field.FieldDefinition); return field; }
private NamespaceImportDeclaration CreateNamespaceImport() { NameDeclaration dummyName = new NameDeclaration(Dummy.Name, SourceDummy.SourceLocation); SimpleName microsoft = new SimpleName(this.Compilation.NameTable.GetNameFor("Microsoft"), SourceDummy.SourceLocation, false); SimpleName smallBasic = new SimpleName(this.Compilation.NameTable.GetNameFor("SmallBasic"), SourceDummy.SourceLocation, false); SimpleName library = new SimpleName(this.Compilation.NameTable.GetNameFor("Library"), SourceDummy.SourceLocation, false); QualifiedName microsoftSmallBasic = new QualifiedName(microsoft, smallBasic, SourceDummy.SourceLocation); QualifiedName microsoftSmallBasicLibrary = new QualifiedName(microsoftSmallBasic, library, SourceDummy.SourceLocation); NamespaceReferenceExpression smallBasicLibrary = new NamespaceReferenceExpression(microsoftSmallBasicLibrary, SourceDummy.SourceLocation); return new NamespaceImportDeclaration(dummyName, smallBasicLibrary, SourceDummy.SourceLocation); }
/// <summary> /// Constructs a new parse tree for an argument. /// </summary> /// <param name="name">The name of the argument, if any.</param> /// <param name="colonEqualsLocation">The location of the ':=', if any.</param> /// <param name="expression">The expression, if any.</param> /// <param name="span">The location of the parse tree.</param> /// <param name="byValLocation">The location of ByVal, if any (VB6).</param> public Argument(SimpleName name, Location colonEqualsLocation, Expression expression, Span span, Location byValLocation) : base(TreeType.Argument, span) { if (expression == null) { throw new ArgumentNullException("expression"); } SetParent(name); SetParent(expression); _Name = name; _ColonEqualsLocation = colonEqualsLocation; _Expression = expression; _ByValLocation = byValLocation; }
public ForeachExpressionSyntax( TextSpan span, bool mutableBinding, string variableName, ExpressionSyntax typeExpression, ExpressionSyntax inExpression, BlockSyntax block) : base(span) { MutableBinding = mutableBinding; VariableName = new SimpleName(variableName); InExpression = inExpression; Block = block; TypeExpression = typeExpression; }
public bool showVersionInfoPopup(bool force = false) { if (needShowPopup || force) { try { UIComponent uIComponent = UIView.library.ShowModal("ExceptionPanel"); if (uIComponent != null) { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; BindPropertyByKey component = uIComponent.GetComponent <BindPropertyByKey>(); if (component != null) { string title = $"{SimpleName.Replace("&", "and")} v{version}"; string notes = Singleton <R> .instance.loadResourceString("UI.VersionNotes.txt"); string text = $"{SimpleName.Replace("&", "and")} was updated! Release notes:\r\n\r\n" + notes; string img = "IconMessage"; component.SetProperties(TooltipHelper.Format(new string[] { "title", title, "message", text, "img", img })); needShowPopup = false; currentSaveVersion.value = fullVersion; return(true); } return(false); } else { doLog("PANEL NOT FOUND!!!!"); return(false); } } catch (Exception e) { doErrorLog("showVersionInfoPopup ERROR {0} {1}", e.GetType(), e.Message); } } return(false); }
public QueryVyberUcetPrPolozkyInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("UCPREDP", TableUcetniPredpisyInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), AliasName.Create("ppredpis_id", "predpis_id"), SimpleName.Create("predpis_uckod"), SimpleName.Create("predpis_nazev"), SimpleName.Create("predpis_druh") )); AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("UCPOLOZ", TableUcetniPolozkyInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("cislo"), SimpleName.Create("poloz_nazev"), SimpleName.Create("poloz_druh"), SimpleName.Create("poloz_skup"), SimpleName.Create("poloz_synt"), SimpleName.Create("poloz_anal"), SimpleName.Create("poloz_text1"), SimpleName.Create("poloz_inf1"), SimpleName.Create("poloz_delka1"), SimpleName.Create("poloz_fmt1"), SimpleName.Create("poloz_text2"), SimpleName.Create("poloz_inf2"), SimpleName.Create("poloz_delka2"), SimpleName.Create("poloz_fmt2"), SimpleName.Create("poloz_text3"), SimpleName.Create("poloz_inf3"), SimpleName.Create("poloz_delka3"), SimpleName.Create("poloz_fmt3"), SimpleName.Create("poloz_text4"), SimpleName.Create("poloz_inf4"), SimpleName.Create("poloz_delka4"), SimpleName.Create("poloz_fmt4"), SimpleName.Create("poloz_text5"), SimpleName.Create("poloz_inf5"), SimpleName.Create("poloz_delka5"), SimpleName.Create("poloz_fmt5") )); AddTableJoin(QueryJoinDefInfo.GetQueryFirstJoinDefInfo("UCPREDP", "UCPOLOZ"). AddColumn("firma_id", "firma_id"). AddColumn("ppredpis_id", "predpis_id")); }
public QuerySumaDanInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("DAN", TableDanInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), SimpleName.Create("mesic"), SimpleName.Create("odkud"), SimpleName.Create("kod"), AliasName.Create("hodnota", "hodnota", "SUM({0})"), AliasName.Create("pocjed", "pocjed", "SUM({0})"), AliasName.Create("pocdal", "pocdal", "SUM({0})"), AliasName.Create("sazba", "sazba", "SUM({0})") )); AddClause("GROUP BY firma_id, mesic, odkud, kod"); }
// // Query parameter reference can include transparent parameters // protected override Expression GetParameterReferenceExpression(string name, Location loc) { Expression expr = base.GetParameterReferenceExpression(name, loc); if (expr != null) { return(expr); } TransparentParameter tp = parameters [0] as TransparentParameter; while (tp != null) { if (tp.Identifier == name) { break; } TransparentParameter tp_next = tp.Parent [0] as TransparentParameter; if (tp_next == null) { if (tp.Parent.GetParameterIndexByName(name) >= 0) { break; } } tp = tp_next; } if (tp != null) { expr = new SimpleName(parameters[0].Name, loc); TransparentParameter tp_cursor = (TransparentParameter)parameters[0]; while (tp_cursor != tp) { tp_cursor = (TransparentParameter)tp_cursor.Parent[0]; expr = new MemberAccess(expr, tp_cursor.Name); } return(new MemberAccess(expr, name)); } return(null); }
public QueryKrokujPracovnikyInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("PRAC", TablePracInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), AliasName.Create("ppracovnik_id", "pracovnik_id"), SimpleName.Create("logicky_zrusen"), SimpleName.Create("logicky_neuplny"), SimpleName.Create("pocitane_obdobi"), SimpleName.Create("osobni_cislo"), SimpleName.Create("datum_narozeni"), SimpleName.Create("rodne_cislo"), SimpleName.Create("prijmeni"), SimpleName.Create("jmeno"), SimpleName.Create("titul_pred"), SimpleName.Create("titul_za") )); AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("UTVAR", TableUtvarInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("uutvar_id"), SimpleName.Create("utvnazev"), SimpleName.Create("vyuctgr"), SimpleName.Create("zeme_cislo"), SimpleName.Create("uzivatel_id") )); AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("DAN", TableDanInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("mesic"), AliasName.Create("informace", "vyuct_cast") )); AddTableJoin(QueryJoinDefInfo.GetQueryFirstJoinDefInfo("PRAC", "DAN"). AddColumn("firma_id", "firma_id"). AddColumn("ppracovnik_id", "pracovnik_id")); AddTableJoin(QueryJoinDefInfo.GetQueryJoinDefInfo("DAN", "UTVAR"). AddColumn("firma_id", "firma_id"). AddColumn("sazba", "uutvar_id"). AddLeftColumn("odkud", "=", "0"). AddLeftColumn("kod", "=", "6100"). AddLeftColumn("cislo", "=", "1")); }
protected BlockDeclaration(TreeType type, AttributeBlockCollection attributes, ModifierCollection modifiers, Location keywordLocation, SimpleName name, DeclarationCollection declarations, EndBlockDeclaration endDeclaration, Span span, IList <Comment> comments) : base(type, attributes, modifiers, span, comments) { Debug.Assert(type == TreeType.ClassDeclaration || type == TreeType.ModuleDeclaration || type == TreeType.InterfaceDeclaration || type == TreeType.StructureDeclaration || type == TreeType.EnumDeclaration); if (name == null) { throw new ArgumentNullException("name"); } SetParent(name); SetParent(declarations); SetParent(endDeclaration); _KeywordLocation = keywordLocation; _Name = name; _Declarations = declarations; _EndDeclaration = endDeclaration; }
/// <summary> /// For now, we are putting string in the runtime library /// </summary> private static ISymbol BuildStringSymbol() { var typeName = new SimpleName("String"); var stringLiteralOperator = Symbol.New(typeName.Qualify(SpecialName.OperatorStringLiteral)); var symbols = new List <ISymbol>() { // Making these fields for now Symbol.New(typeName.Qualify("bytes"), DataType.BytePointer), Symbol.New(typeName.Qualify("byte_count"), DataType.Size), stringLiteralOperator }; var stringSymbol = Symbol.NewType(typeName, symbols); var stringType = new ObjectType(stringSymbol, false, Lifetime.None); stringSymbol.Type = new Metatype(stringType); stringLiteralOperator.Type = new FunctionType(new DataType[] { DataType.Size, DataType.BytePointer }, stringType); return(stringSymbol); }
private NameSyntax ParseSimpleName() { var identifier = Tokens.RequiredToken <IIdentifierToken>(); var name = new SimpleName(identifier.Value); NameSyntax syntax; if (Tokens.Accept <IOpenBracketToken>()) { var arguments = ParseArguments(); var closeBracket = Tokens.Expect <ICloseBracketToken>(); var span = TextSpan.Covering(identifier.Span, closeBracket); syntax = new GenericNameSyntax(span, identifier.Value, arguments); } else { syntax = new IdentifierNameSyntax(identifier.Span, name); } return(syntax); }
public bool ResolveMethodGroup(ResolveContext ec) { SimpleName sn = Expr as SimpleName; if (sn != null) { Expr = sn.GetMethodGroup(); } // FIXME: csc doesn't report any error if you try to use `ref' or // `out' in a delegate creation expression. Expr = Expr.Resolve(ec, ResolveFlags.VariableOrValue | ResolveFlags.MethodGroup); if (Expr == null) { return(false); } return(true); }
/// <summary> /// Constructs a new aliased import parse tree. /// </summary> /// <param name="name">The name of the alias.</param> /// <param name="equalsLocation">The location of the '='.</param> /// <param name="aliasedTypeName">The name being aliased.</param> /// <param name="span">The location of the parse tree.</param> public AliasImport(SimpleName name, Location equalsLocation, TypeName aliasedTypeName, Span span) : base(TreeType.AliasImport, span) { if (aliasedTypeName == null) { throw new ArgumentNullException("aliasedTypeName"); } if (name == null) { throw new ArgumentNullException("name"); } SetParent(name); SetParent(aliasedTypeName); _Name = name; _EqualsLocation = equalsLocation; _AliasedTypeName = aliasedTypeName; }
private SetterDeclarationSyntax ParseSetter( FixedList <AttributeSyntax> attributes, FixedList <IModiferToken> modifiers) { Tokens.Expect <ISetKeywordToken>(); var identifier = Tokens.RequiredToken <IIdentifierToken>(); var propertyName = nameContext.Qualify(identifier.Value); var name = nameContext.Qualify(SimpleName.Special("get_" + identifier.Value)); var bodyParser = NestedParser(name); var parameters = bodyParser.ParseParameters(); var mayEffects = ParseMayEffects(); var noEffects = ParseNoEffects(); var(requires, ensures) = ParseFunctionContracts(); var body = bodyParser.ParseBlock(); return(new SetterDeclarationSyntax(File, attributes, modifiers, propertyName, name, identifier.Span, parameters, mayEffects, noEffects, requires, ensures, body)); }
private void CheckValCtorType(SimpleName valCtorName, TypeExpr valTy) { CheckGlobalName(valCtorName.ToString(), valCtorName._lexLocation); var kind = Typeof(_definingCtorEnv, valTy); if (kind == null) { throw new SemanticException("Invalid Type of Value Constructor", valCtorName._lexLocation); } var final = valTy.FinalType; //var errType = final.Match(DefiningCtorAsShape(),this); //no gadt so simplify into the following var expectingCtorTy = DefiningCtorAsType(); var errType = final.Match(expectingCtorTy, this); if (errType != null) { throw new InvalidFinalTypeForValueCtor(valCtorName, expectingCtorTy, final); } }
public bool IsNullTarget(AmlParser.Target target) { SuperName superName = target.superName; if (superName.Tag != SuperName.TagValue.SimpleName) { return(false); } SimpleName simpleName = superName.GetAsSimpleName(); if (simpleName.Tag != SimpleName.TagValue.NameString) { return(false); } NodePath nodePath = simpleName.GetAsNameString().nodePath; return(!nodePath.IsAbsolute && nodePath.NumParentPrefixes == 0 && nodePath.NameSegments.Length == 0); }
public QueryCelkVyuctFinInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("VFIN", TableZsestPrehvyuctfinInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), SimpleName.Create("kod_data"), SimpleName.Create("uzivatel_id"), SimpleName.Create("kod"), AliasName.Create("hodnota_numb", "hodnota_numb", "SUM({0})") )); AddFiltr(QueryWhereDefInfo.GetQueryWhereDefInfo("VFIN", TableZsestPrehvyuctfinInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddConstraints( QueryFilterDefInfo.Create("mesic", "<>", "0"), QueryFilterDefInfo.Create("poradi", "=", "0") )); AddClause("GROUP BY firma_id, kod_data, uzivatel_id, kod"); }
public QueryVyberPracZarazeniInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("MDAN_UTVAR", TableDanInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), SimpleName.Create("pracovnik_id"), SimpleName.Create("mesic"), AliasName.Create("sazba", "cislo_utvar"), AliasName.Create("pocjed", "cislo_zdrpoj") )); AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("MDAN_STRCZ", TableDanInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("cislo_zdroj"), SimpleName.Create("cislo_stred"), SimpleName.Create("cislo_cinnost"), SimpleName.Create("cislo_zakazka") )); AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("MUTVAR", TableUtvarInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( AliasName.Create("utvnazev", "nazev_utvar"), AliasName.Create("zeme_cislo", "cislo_zeme") )); AddTableJoin(QueryJoinDefInfo.GetQueryFirstJoinDefInfo("MDAN_UTVAR", "MDAN_STRCZ"). AddColumn("firma_id", "firma_id"). AddColumn("pracovnik_id", "pracovnik_id"). AddColumn("mesic", "mesic"). AddRightColumn("odkud", "=", "0"). AddRightColumn("kod", "=", "6100"). AddRightColumn("cislo", "=", "1"). AddLeftColumn("odkud", "=", "0"). AddLeftColumn("kod", "=", "6101"). AddLeftColumn("cislo", "=", "1")); AddTableJoin(QueryJoinDefInfo.GetQueryJoinDefInfo("MDAN_UTVAR", "MUTVAR"). AddColumn("firma_id", "firma_id"). AddColumn("sazba", "uutvar_id")); }
public static Lifetime EvaluateLifetime(SimpleName lifetimeName) { if (lifetimeName.IsSpecial) { if (lifetimeName == SpecialName.Owned) { return(Lifetime.Owned); } if (lifetimeName == SpecialName.Ref) { return(RefLifetime.Instance); } if (lifetimeName == SpecialName.Forever) { return(Lifetime.Forever); } throw NonExhaustiveMatchException.For(lifetimeName.Text); } return(new NamedLifetime(lifetimeName.Text)); }
public InitializerDeclarationSyntax ParseInitializer( FixedList <AttributeSyntax> attributes, FixedList <IModiferToken> modifiers) { var initKeywordSpan = Tokens.Expect <IInitKeywordToken>(); var identifier = Tokens.AcceptToken <IIdentifierToken>(); var name = nameContext.Qualify(SimpleName.Special("init" + (identifier != null ? "_" + identifier.Value : ""))); var bodyParser = NestedParser(name); var genericParameters = AcceptGenericParameters(); var parameters = bodyParser.ParseParameters(); var genericConstraints = ParseGenericConstraints(); var mayEffects = ParseMayEffects(); var noEffects = ParseNoEffects(); var(requires, ensures) = ParseFunctionContracts(); var body = bodyParser.ParseBlock(); return(new InitializerDeclarationSyntax(File, modifiers, name, TextSpan.Covering(initKeywordSpan, identifier?.Span), genericParameters, parameters, genericConstraints, mayEffects, noEffects, requires, ensures, body)); }
public virtual Name GetName() { if (parts.Count == 1) { var obj = ObjectSearcher.SearchIdentifier <INamedEntity>(currentScore, (parts[0] as Part.SelectedPart).Suffix, x => true); return(new SimpleName(obj)); } else if (parts.Count > 1) { var objs = ObjectSearcher.SearchComponents <INamedEntity>(currentScore, parts); Name suffix = new SimpleName(objs[objs.Count - 1]); for (int i = objs.Count - 2; i >= 0; --i) { Name prefix = new SimpleName(objs[i]); suffix = new SelectedName(prefix, suffix); } return(suffix); } throw new VHDL.ParseError.vhdlUnknownIdentifierException(context, visitor.FileName, Identifier); }
public QueryCelkExtMListInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("EXTML", TableZsestExtMzdlistInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), SimpleName.Create("kod_data"), SimpleName.Create("uzivatel_id"), SimpleName.Create("pracovnik_id"), SimpleName.Create("pomer_id"), SimpleName.Create("mesic_opr"), SimpleName.Create("kod"), SimpleName.Create("hodnota_numb", "SUM({0})"))); AddFiltr(QueryWhereDefInfo.GetQueryWhereDefInfo("EXTML", TableZsestExtMzdlistInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddConstraints( QueryFilterDefInfo.Create("mesic", "<>", "0"), QueryFilterDefInfo.Create("poradi", "=", "0"))); AddClause("GROUP BY firma_id, kod_data, uzivatel_id, pracovnik_id, pomer_id, mesic_opr, kod"); }
private (Name, TextSpan) ParseNamespaceName() { var nameSegment = Tokens.RequiredToken <IIdentifierToken>(); var span = nameSegment.Span; Name name = new SimpleName(nameSegment.Value); while (Tokens.Accept <IDotToken>()) { TextSpan segmentSpan; (segmentSpan, nameSegment) = Tokens.ExpectIdentifier(); // We need the span to cover a trailing dot span = TextSpan.Covering(span, segmentSpan); if (nameSegment == null) { break; } name = name.Qualify(nameSegment.Value); } return(name, span); }
public QueryVyberPPomZarazeniInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("MMZDA_STRCZ", TableMzdaInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), SimpleName.Create("pracovnik_id"), SimpleName.Create("cislo_pp"), SimpleName.Create("mesic"), AliasName.Create("cislo_zdroj", "ppomer_zdroj"), AliasName.Create("cislo_stred", "ppomer_stred"), AliasName.Create("cislo_cinnost", "ppomer_cinnost"), AliasName.Create("cislo_zakazka", "ppomer_zakazka") )); AddFiltr(QueryWhereDefInfo.GetQueryWhereDefInfo("MMZDA_STRCZ", TableZsestExtMzdlistInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddConstraints( QueryFilterDefInfo.Create("odkud", "=", "0"), QueryFilterDefInfo.Create("kod", "=", "6000"), QueryFilterDefInfo.Create("cislo", "=", "1") )); }
public QueryVyplListkySortInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("ZSEST_VYPL_LISTKY", TableZsestVyplListkyInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), SimpleName.Create("uzivatel_id"), SimpleName.Create("pracovnik_id"), SimpleName.Create("vlist_info"), SimpleName.Create("radek"), SimpleName.Create("typ"), SimpleName.Create("radtext"), SimpleName.Create("engtext") )); AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("LISTKYP", TableZsestVyplListkyInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( AliasName.Create("typ", "typ_pr"), AliasName.Create("radtext", "text_pr") )); AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("LISTKYU", TableZsestVyplListkyInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( AliasName.Create("typ", "typ_ut"), AliasName.Create("radtext", "text_ut") )); AddTableJoin(QueryJoinDefInfo.GetQueryFirstJoinDefInfo("ZSEST_VYPL_LISTKY", "LISTKYP"). AddColumn("firma_id", "firma_id"). AddColumn("uzivatel_id", "uzivatel_id"). AddColumn("pracovnik_id", "pracovnik_id"). AddRightColumn("typ", "=", "2")); AddTableJoin(QueryJoinDefInfo.GetQueryJoinDefInfo("ZSEST_VYPL_LISTKY", "LISTKYU"). AddColumn("firma_id", "firma_id"). AddColumn("uzivatel_id", "uzivatel_id"). AddColumn("pracovnik_id", "pracovnik_id"). AddRightColumn("typ", "=", "1")); }
public void HasSelf(string nStr, bool expectedResult, Refactorization r) { bool result = false; if (r == Refactorization.Current) { var name = Name.BuildName(nStr); for (long i = 0; i < reps; i++) { result = name.HasSelf(); } } else if (r == Refactorization.New) { var name = new SimpleName(nStr); for (long i = 0; i < reps; i++) { result = SimpleWFN.HasSelf(name); } } Assert.AreEqual(expectedResult, result); }
public void ToString(string n1, string expectedResult, Refactorization r) { string result = string.Empty; if (r == Refactorization.Current) { var name = Name.BuildName(n1); for (long i = 0; i < reps; i++) { result = name.ToString(); } result = RemoveWhiteSpace(result); } else if (r == Refactorization.New) { var name = new SimpleName(n1); for (long i = 0; i < reps; i++) { result = name.ToString(); } } Assert.That(string.Equals(expectedResult, result, StringComparison.InvariantCultureIgnoreCase)); }
/// <summary> /// Decodes an LNode as a simple name. Logs an error if the decoding /// process fails. /// </summary> /// <param name="node">A node to decode as a simple name.</param> /// <param name="name">The name described by <paramref name="node"/>.</param> /// <returns> /// <c>true</c> if <paramref name="node"/> can be decoded as a simple /// name; otherwise, <c>false</c>. /// </returns> public bool AssertDecodeSimpleName(LNode node, out SimpleName name) { if (node.IsId) { name = new SimpleName(node.Name.Name); return(true); } else if (node.IsCall) { var nameNode = node.Target; int arity; if (!FeedbackHelpers.AssertIsId(nameNode, Log) || !FeedbackHelpers.AssertArgCount(node, 1, Log) || !AssertDecodeInt32(node.Args[0], out arity)) { name = null; return(false); } name = new SimpleName(nameNode.Name.Name, arity); return(true); } else { FeedbackHelpers.LogSyntaxError( Log, node, FeedbackHelpers.QuoteEven( "expected a simple name, which can either be a simple id (e.g., ", "Name", ") or a call to an id that specifies the number of generic parameters (e.g., ", "Name(2)", ").")); name = null; return(false); } }
/// <summary> /// Constructs a new parse tree for a property declaration (VB6). /// </summary> /// <param name="attributes">The attributes on the declaration.</param> /// <param name="modifiers">The modifiers on the declaration.</param> /// <param name="keywordLocation">The location of the keyword.</param> /// <param name="name">The name of the property.</param> /// <param name="parameters">The parameters of the property.</param> /// <param name="asLocation">The location of the 'As', if any.</param> /// <param name="resultTypeAttributes">The attributes on the result type.</param> /// <param name="resultType">The result type, if any.</param> /// <param name="implementsList">The implements list.</param> /// <param name="accessors">The property accessors.</param> /// <param name="statements">The property statements (VB6)</param> /// <param name="endDeclaration">The End Property declaration, if any.</param> /// <param name="span">The location of the parse tree.</param> /// <param name="comments">The comments for the parse tree.</param> public PropertyDeclaration( AttributeBlockCollection attributes, ModifierCollection modifiers, Location keywordLocation, SimpleName name, ParameterCollection parameters, Location asLocation, AttributeBlockCollection resultTypeAttributes, TypeName resultType, NameCollection implementsList, GetAccessorDeclaration getAccessor, SetAccessorDeclaration setAccessor, EndBlockDeclaration endDeclaration, Span span, IList <Comment> comments ) : base( TreeType.PropertyDeclaration, attributes, modifiers, keywordLocation, name, null, parameters, asLocation, resultTypeAttributes, resultType, implementsList, null, null, endDeclaration, span, comments) { GetAccessor = getAccessor; SetAccessor = setAccessor; }
protected SignatureDeclaration( TreeType type, AttributeBlockCollection attributes, ModifierCollection modifiers, Location keywordLocation, SimpleName name, TypeParameterCollection typeParameters, ParameterCollection parameters, Location asLocation, AttributeBlockCollection resultTypeAttributes, TypeName resultType, Span span, IList <Comment> comments ) : base( type, attributes, modifiers, span, comments ) { SetParent(name); SetParent(typeParameters); SetParent(parameters); SetParent(resultType); SetParent(resultTypeAttributes); _KeywordLocation = keywordLocation; _Name = name; _TypeParameters = typeParameters; _Parameters = parameters; _AsLocation = asLocation; _ResultTypeAttributes = resultTypeAttributes; _ResultType = resultType; }
public QueryVyberReldp09DavkaInfo(string lpszOwnerName, string lpszUsersName) : base(lpszOwnerName, lpszUsersName, TABLE_NAME, 1600) { AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("UD", TableUzivReldpDavkaInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( SimpleName.Create("firma_id"), AliasName.Create("ddavka_reldp_id", "davka_reldp_id"), SimpleName.Create("uzivatel_id"), AliasName.Create("vydano_dat", "vydano_dat", "MAX({0})"), AliasName.Create("info_davka", "info_davka", "MAX({0})") )); AddTable(QueryTableDefInfo.GetQueryAliasDefInfo("PP", TablePracReldp09DataPracInfo.GetDictValue(lpszOwnerName, lpszUsersName)). AddColumns( AliasName.Create("eldp_rok", "eldp_rok", "MAX({0})") )); AddTableJoin(QueryJoinDefInfo.GetQueryFirstJoinDefInfo("UD", "PP"). AddColumn("firma_id", "firma_id"). AddColumn("ddavka_reldp_id", "davka_reldp_id"). AddColumn("uzivatel_id", "uzivatel_id")); AddClause("GROUP BY UD.firma_id, UD.ddavka_reldp_id, UD.uzivatel_id"); }
void case_531() #line 3825 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; var sn = new SimpleName (lt.Value, (int) yyVals[0+yyTop], lt.Location); yyVal = sn; lbag.AddLocation (sn.TypeArguments, Lexer.GetGenericDimensionLocations ()); }
void case_822() #line 5682 "cs-parser.jay" { Error_SyntaxError (yyToken); var lt =(LocatedToken) yyVals[-1+yyTop]; var sn = new SimpleName (lt.Value, lt.Location); current_block.AddStatement(new StatementErrorExpression (sn)); yyVal = null; }
void case_367() #line 3058 "cs-parser.jay" { var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new SimpleName (lt.Value, (int) yyVals[0+yyTop], lt.Location); }
void case_62() #line 761 "cs-parser.jay" { Error_SyntaxError (yyToken); var lt = (LocatedToken) yyVals[-1+yyTop]; var tne = new SimpleName (lt.Value, null, lt.Location); yyVal = new List<Attribute> () { new Attribute (null, tne, null, GetLocation (yyVals[-1+yyTop]), false) }; }
internal static bool TypeIsNamedMember(ITypeDefinition type, SimpleName name) { foreach (ICustomAttribute attr in type.Attributes) { if (TypeHelper.GetTypeName(attr.Type) == NamespaceHelper.SystemDiagnosticsContractsCodeContractString + ".StringVccAttr") { List<IMetadataExpression> args = new List<IMetadataExpression>(attr.Arguments); if (args.Count == 2) { IMetadataConstant attrStr = args[0] as IMetadataConstant; IMetadataConstant memberName = args[1] as IMetadataConstant; if (memberName != null && (string)attrStr.Value == "member_name" && ((string)memberName.Value) == name.Name.Value) return true; } } } return false; }
private LabeledStatement ParseLabeledStatement(SimpleName label, TokenSet followers) //^ requires this.currentToken == Token.Colon; //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile; { SourceLocationBuilder slb = new SourceLocationBuilder(label.SourceLocation); this.GetNextToken(); Statement statement; if (Parser.StatementStart[this.currentToken]) { statement = this.ParseStatement(followers); } else { statement = new EmptyStatement(false, this.scanner.SourceLocationOfLastScannedToken); this.SkipTo(followers, Error.ExpectedSemicolon); } //^ assert followers[this.currentToken] || this.currentToken == Token.EndOfFile; slb.UpdateToSpan(statement.SourceLocation); LabeledStatement result = new LabeledStatement(new NameDeclaration(label.Name, label.SourceLocation), statement, slb); //^ assume followers[this.currentToken] || this.currentToken == Token.EndOfFile; return result; }
private LabeledStatement ParseLabel(SimpleName rootName, TokenSet followers) //^ requires this.currentToken == Token.Colon; //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile; { NameDeclaration labelName = new NameDeclaration(rootName.Name, rootName.SourceLocation); //^ assume this.rootClass != null; this.rootClass.AddLabel(rootName); SourceLocationBuilder slb = new SourceLocationBuilder(rootName.SourceLocation); slb.UpdateToSpan(this.scanner.CurrentSourceLocation); this.GetNextToken(); LabeledStatement result = new LabeledStatement(labelName, new EmptyStatement(false, SourceDummy.SourceLocation), slb); this.SkipOverTo(Token.EndOfLine, followers); return result; }
public override object Visit (SimpleName simpleName) { var result = new IdentifierExpression (); result.AddChild (Identifier.Create (simpleName.Name, Convert (simpleName.Location)), Roles.Identifier); AddTypeArguments (result, simpleName); return result; }
private Expression ParseImplementedInterfacePlusName(ref NameDeclaration name, bool allowThis, TokenSet followers) //^ ensures result is SimpleName || result is QualifiedName; //^ ensures result is QualifiedName ==> (((QualifiedName)result).Qualifier is SimpleName || //^ ((QualifiedName)result).Qualifier is QualifiedName || ((QualifiedName)result).Qualifier is GenericTypeInstanceExpression); { Expression implementedInterface = new SimpleName(name, name.SourceLocation, false); while (this.currentToken == Token.Dot || this.currentToken == Token.LessThan) //^ invariant implementedInterface is SimpleName || implementedInterface is QualifiedName; //The following invariant does not hold, it seems. Fix it. //^ invariant implementedInterface is QualifiedName ==> (((QualifiedName)implementedInterface).Qualifier is SimpleName || //^ ((QualifiedName)implementedInterface).Qualifier is QualifiedName || ((QualifiedName)implementedInterface).Qualifier is GenericTypeInstanceExpression); { if (this.currentToken == Token.LessThan) { //^ assume implementedInterface is SimpleName || implementedInterface is QualifiedName; TypeExpression genericType = new NamedTypeExpression(implementedInterface); SourceLocationBuilder ctx = new SourceLocationBuilder(implementedInterface.SourceLocation); List<TypeExpression> typeArguments = this.ParseTypeArguments(ctx, false, followers|Token.Dot|Token.LeftBrace); implementedInterface = new GenericTypeInstanceExpression(genericType, typeArguments, ctx); } this.Skip(Token.Dot); if (this.currentToken == Token.This && allowThis) { name = this.GetNameDeclarationFor("Item", this.scanner.SourceLocationOfLastScannedToken); } else { if (!Parser.IdentifierOrNonReservedKeyword[this.currentToken]) this.SkipTo(followers|Parser.IdentifierOrNonReservedKeyword|Token.LeftBrace, Error.ExpectedIdentifier); name = this.ParseNameDeclaration(); } SourceLocationBuilder ctx1 = new SourceLocationBuilder(implementedInterface.SourceLocation); ctx1.UpdateToSpan(name.SourceLocation); implementedInterface = new QualifiedName(implementedInterface, new SimpleName(name, name.SourceLocation, false), ctx1); } return implementedInterface; }
public VccScopedName(Expression qualifier, SimpleName simpleName, ISourceLocation sourceLocation) : base(qualifier, simpleName, sourceLocation) { }
// // Query parameter reference can include transparent parameters // protected override Expression GetParameterReferenceExpression (string name, Location loc) { Expression expr = base.GetParameterReferenceExpression (name, loc); if (expr != null) return expr; TransparentParameter tp = parameters [0] as TransparentParameter; while (tp != null) { if (tp.Identifier == name) break; TransparentParameter tp_next = tp.Parent [0] as TransparentParameter; if (tp_next == null) { if (tp.Parent.GetParameterIndexByName (name) >= 0) break; } tp = tp_next; } if (tp != null) { expr = new SimpleName (parameters[0].Name, loc); TransparentParameter tp_cursor = (TransparentParameter) parameters[0]; while (tp_cursor != tp) { tp_cursor = (TransparentParameter) tp_cursor.Parent[0]; expr = new MemberAccess (expr, tp_cursor.Name); } return new MemberAccess (expr, name); } return null; }
public ATypeNameExpression MakeTypeNameExpression(Location loc) { string[] names = Name.Split(new [] {'.'}); ATypeNameExpression exp = null; for (var i = 0; i < names.Length; i++) { var name = names[i]; if (exp == null) { exp = new SimpleName (name, loc); } else { exp = new MemberAccess(exp, name, loc); } } return exp; }
/// <summary> /// Allocates an expression that denotes a template type parameter. /// </summary> /// <param name="simpleName">The name of the template type parameter.</param> public VccTemplateTypeParameterExpression(SimpleName simpleName) : base(simpleName) { }
protected override Expression DoResolve (ResolveContext ec) { Expression clone = source.Clone (new CloneContext ()); clone = clone.Resolve (ec); if (clone == null) return null; // // A useful feature for the REPL: if we can resolve the expression // as a type, Describe the type; // if (ec.Module.Evaluator.DescribeTypeExpressions && !(ec.CurrentAnonymousMethod is AsyncInitializer)) { var old_printer = ec.Report.SetPrinter (new SessionReportPrinter ()); Expression tclone; try { // Note: clone context cannot be shared otherwise block mapping would leak tclone = source.Clone (new CloneContext ()); tclone = tclone.Resolve (ec, ResolveFlags.Type); if (ec.Report.Errors > 0) tclone = null; } finally { ec.Report.SetPrinter (old_printer); } if (tclone is TypeExpr) { Arguments args = new Arguments (1); args.Add (new Argument (new TypeOf ((TypeExpr) clone, Location))); return new Invocation (new SimpleName ("Describe", Location), args).Resolve (ec); } } // This means its really a statement. if (clone.Type.Kind == MemberKind.Void || clone is DynamicInvocation || clone is Assign) { return clone; } source = clone; var host = (Method) ec.MemberContext.CurrentMemberDefinition; if (host.ParameterInfo.IsEmpty) { eclass = ExprClass.Value; type = InternalType.FakeInternalType; return this; } target = new SimpleName (host.ParameterInfo[0].Name, Location); return base.DoResolve (ec); }
public static AnonymousTypeClass Create (TypeContainer parent, IList<AnonymousTypeParameter> parameters, Location loc) { string name = ClassNamePrefix + parent.Module.CounterAnonymousTypes++; ParametersCompiled all_parameters; TypeParameters tparams = null; SimpleName[] t_args; if (parameters.Count == 0) { all_parameters = ParametersCompiled.EmptyReadOnlyParameters; t_args = null; } else { t_args = new SimpleName[parameters.Count]; tparams = new TypeParameters (); Parameter[] ctor_params = new Parameter[parameters.Count]; for (int i = 0; i < parameters.Count; ++i) { AnonymousTypeParameter p = parameters[i]; for (int ii = 0; ii < i; ++ii) { if (parameters[ii].Name == p.Name) { parent.Compiler.Report.Error (833, parameters[ii].Location, "`{0}': An anonymous type cannot have multiple properties with the same name", p.Name); p = new AnonymousTypeParameter (null, "$" + i.ToString (), p.Location); parameters[i] = p; break; } } t_args[i] = new SimpleName ("<" + p.Name + ">__T", p.Location); tparams.Add (new TypeParameter (i, new MemberName (t_args[i].Name, p.Location), null, null, Variance.None)); ctor_params[i] = new Parameter (t_args[i], p.Name, Parameter.Modifier.NONE, null, p.Location); } all_parameters = new ParametersCompiled (ctor_params); } // // Create generic anonymous type host with generic arguments // named upon properties names // AnonymousTypeClass a_type = new AnonymousTypeClass (parent.Module, new MemberName (name, tparams, loc), parameters, loc); Constructor c = new Constructor (a_type, name, Modifiers.PUBLIC | Modifiers.DEBUGGER_HIDDEN, null, all_parameters, loc); c.Block = new ToplevelBlock (parent.Module.Compiler, c.ParameterInfo, loc); // // Create fields and constructor body with field initialization // bool error = false; for (int i = 0; i < parameters.Count; ++i) { AnonymousTypeParameter p = parameters [i]; Field f = new Field (a_type, t_args [i], Modifiers.PRIVATE | Modifiers.READONLY | Modifiers.DEBUGGER_HIDDEN, new MemberName ("<" + p.Name + ">", p.Location), null); if (!a_type.AddField (f)) { error = true; continue; } c.Block.AddStatement (new StatementExpression ( new SimpleAssign (new MemberAccess (new This (p.Location), f.Name), c.Block.GetParameterReference (i, p.Location)))); ToplevelBlock get_block = new ToplevelBlock (parent.Module.Compiler, p.Location); get_block.AddStatement (new Return ( new MemberAccess (new This (p.Location), f.Name), p.Location)); Property prop = new Property (a_type, t_args [i], Modifiers.PUBLIC, new MemberName (p.Name, p.Location), null); prop.Get = new Property.GetMethod (prop, 0, null, p.Location); prop.Get.Block = get_block; a_type.AddMember (prop); } if (error) return null; a_type.AddConstructor (c); return a_type; }
void case_366() #line 3053 "cs-parser.jay" { var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new SimpleName (lt.Value, (TypeArguments)yyVals[0+yyTop], lt.Location); }
public virtual void Visit(SimpleName node) { DefaultVisit(node); }
void case_380() #line 3155 "cs-parser.jay" { var lt = (LocatedToken) yyVals[-2+yyTop]; yyVal = new SimpleName (lt.Value, (TypeArguments) yyVals[-1+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); }
public ProjectionHelper(Expression qualifier, SimpleName simpleName, IFieldDefinition definition, ISourceLocation sourceLocation) : base(qualifier, simpleName, sourceLocation) { this.definition = definition; }
void case_863() #line 5794 "cs-parser.jay" { if (yyVals[-1+yyTop] is VarExpr) yyVals[-1+yyTop] = new SimpleName ("var", ((VarExpr) yyVals[-1+yyTop]).Location); yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); }
public virtual object Visit (SimpleName simpleName) { return null; }
private Expression ParseLambda(SimpleName parameterName, TokenSet followers) //^ requires this.currentToken == Token.Lambda; //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile; { NameDeclaration paramName = new NameDeclaration(parameterName.Name, parameterName.SourceLocation); SourceLocationBuilder slb = new SourceLocationBuilder(parameterName.SourceLocation); LambdaParameter parameter = new LambdaParameter(false, false, null, paramName, parameterName.SourceLocation); List<LambdaParameter> parameters = new List<LambdaParameter>(1); parameters.Add(parameter); //^ assume this.currentToken == Token.Lambda; //follows from the precondition return this.ParseLambda(parameters, slb, followers); }
internal GosubStatement(SimpleName targetLabel, ISourceLocation sourceLocation, RootClassDeclaration rootClass) : base(sourceLocation) { this.targetLabel = targetLabel; this.rootClass = rootClass; }
private NamespaceReferenceExpression ParseImportedNamespaceName(NameDeclaration name, TokenSet followers) //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile; { Expression expression = new SimpleName(name, name.SourceLocation, false); SourceLocationBuilder sctx = new SourceLocationBuilder(expression.SourceLocation); if (this.currentToken == Token.DoubleColon) { this.GetNextToken(); SimpleName simpleName = this.ParseSimpleName(followers|Token.Dot); sctx.UpdateToSpan(simpleName.SourceLocation); expression = new AliasQualifiedName(expression, simpleName, sctx.GetSourceLocation()); } while (this.currentToken == Token.Dot) //^ invariant expression is SimpleName || expression is QualifiedName || expression is AliasQualifiedName; { this.GetNextToken(); SimpleName simpleName = this.ParseSimpleName(followers|Token.Dot); sctx.UpdateToSpan(simpleName.SourceLocation); expression = new QualifiedName(expression, simpleName, sctx.GetSourceLocation()); } NamespaceReferenceExpression result = new NamespaceReferenceExpression(expression, sctx.GetSourceLocation()); this.SkipTo(followers); return result; }
private void ParseAttributes(ref List<SourceCustomAttribute>/*?*/ sourceAttributes, bool globalAttributes, TokenSet followers) { while (this.currentToken == Token.LeftBracket) { int position = this.scanner.CurrentDocumentPosition(); this.GetNextToken(); AttributeTargets target = this.ParseAttributeTarget(); if (globalAttributes) { if (target != AttributeTargets.Assembly && target != AttributeTargets.Module) { this.scanner.RestoreDocumentPosition(position); this.currentToken = Token.None; this.GetNextToken(); return; } } while (true) { Expression expr = this.ParseExpression(followers|Token.Comma|Token.RightBracket); MethodCall/*?*/ mcall = expr as MethodCall; if (mcall != null && (mcall.MethodExpression is SimpleName || mcall.MethodExpression is QualifiedName || mcall.MethodExpression is AliasQualifiedName)) { AttributeTypeExpression type = new AttributeTypeExpression(mcall.MethodExpression); List<Expression> arguments = new List<Expression>(mcall.OriginalArguments); bool seenNamedArgument = false; for (int i = 0, n = arguments.Count; i < n; i++) { Assignment/*?*/ assignment = arguments[i] as Assignment; if (assignment == null) { if (seenNamedArgument) this.HandleError(arguments[i].SourceLocation, Error.NamedArgumentExpected); continue; } SimpleName/*?*/ name = assignment.Target.Expression as SimpleName; if (name == null) { this.HandleError(assignment.Target.SourceLocation, Error.ExpectedIdentifier); name = new SimpleName(Dummy.Name, assignment.Target.SourceLocation, false); } seenNamedArgument = true; arguments[i] = new NamedArgument(name, assignment.Source, assignment.SourceLocation); } if (sourceAttributes == null) sourceAttributes = new List<SourceCustomAttribute>(1); sourceAttributes.Add(new SourceCustomAttribute(target, type, arguments, mcall.SourceLocation)); } else if (expr is SimpleName || expr is QualifiedName || expr is AliasQualifiedName) { AttributeTypeExpression type = new AttributeTypeExpression(expr); if (sourceAttributes == null) sourceAttributes = new List<SourceCustomAttribute>(1); sourceAttributes.Add(new SourceCustomAttribute(target, type, new List<Expression>(0), expr.SourceLocation)); } else { this.HandleError(expr.SourceLocation, Error.ExpectedIdentifier); } if (this.currentToken != Token.Comma) break; this.GetNextToken(); } this.Skip(Token.RightBracket); } if (sourceAttributes != null) sourceAttributes.TrimExcess(); }
private SimpleName ParseSimpleName(TokenSet followers) //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile; { IName name; ISourceLocation sourceLocation = this.scanner.SourceLocationOfLastScannedToken; if (Parser.IdentifierOrNonReservedKeyword[this.currentToken]) { name = this.GetNameFor(this.scanner.GetIdentifierString()); //^ assume this.currentToken != Token.EndOfFile; this.GetNextToken(); } else { name = Dummy.Name; this.HandleError(Error.ExpectedIdentifier); } SimpleName result = new SimpleName(name, sourceLocation, false); this.SkipTo(followers); return result; }
private Statement ParseAssignmentOrCall(SimpleName rootName, TokenSet followers) //^ requires this.currentToken == Token.Dot || this.currentToken == Token.Equals || this.currentToken == Token.LeftBracket || this.currentToken == Token.LeftParens; //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile; { Expression expression = rootName; SourceLocationBuilder slb = new SourceLocationBuilder(rootName.SourceLocation); while (true) { switch (this.currentToken) { case Token.Dot: { this.GetNextToken(); SimpleName simpleName = this.ParseSimpleName(followers|Token.Dot|Token.Equals|Token.LeftBracket|Token.LeftParens|Token.EndOfLine); slb.UpdateToSpan(simpleName.SourceLocation); expression = new QualifiedName(expression, simpleName, slb); continue; } case Token.LeftBracket: { this.GetNextToken(); IEnumerable<Expression> indices = this.ParseExpressions(slb, Token.RightBracket, followers|Token.Dot|Token.Equals|Token.LeftBracket|Token.LeftParens|Token.EndOfLine); expression = new Indexer(expression, indices, slb); continue; } case Token.LeftParens: { this.GetNextToken(); IEnumerable<Expression> indices = this.ParseExpressions(slb, Token.RightParens, followers|Token.Dot|Token.Equals|Token.LeftBracket|Token.LeftParens|Token.EndOfLine); expression = new MethodCall(expression, indices, slb); //TODO: change this to VBMethodCall continue; } } break; } if (this.currentToken == Token.Equals) { this.GetNextToken(); Expression source = this.ParseExpression(followers|Token.EndOfLine); SmallBasicSimpleName/*?*/ target = expression as SmallBasicSimpleName; if (target != null) target.expressionToInferTargetTypeFrom = source; slb.UpdateToSpan(source.SourceLocation); expression = new SmallBasicAssignment(new TargetExpression(expression), source, slb); } this.SkipOverTo(Token.EndOfLine, followers); return new ExpressionStatement(expression); }