private void FillQualifiedStatement(Tree tree) { if (tree == null) { return; } if (tree is QualifiedExpression) { QualifiedExpression qualified = (QualifiedExpression)tree; if (qualified.Qualifier == null) { qualified.Qualifier = Expression; } } if (tree.Children == null) { return; } foreach (Tree item in tree.Children) { FillQualifiedStatement(item); } }
protected internal virtual Parser <BlockSyntax> BlockShortform <T>() where T : StatementSyntax => from comments in CommentParser.AnyComment.Token().Many() from op in Parse.String("|>").Token() from exp in QualifiedExpression.Token().Positioned() from end in Parse.Char(';').Token() select new BlockSyntax { LeadingComments = comments.ToList(), Statements = new List <StatementSyntax>() { typeof(T) == typeof(ReturnStatementSyntax) ? new ReturnStatementSyntax(exp).SetPos <ReturnStatementSyntax>(exp.Transform) : new SingleStatementSyntax(exp) } } .SetStart(exp.Transform.pos) .SetEnd(exp.Transform.pos) .As <BlockSyntax>();
public override void VisitQualifiedExpression(QualifiedExpression qualifiedExpression) { qualifiedExpression.Expression?.Accept(this); var expressionType = expressionTypes_[qualifiedExpression.Expression]; foreach (var qualifier in qualifiedExpression.Qualifiers) { switch (qualifier) { case IndexQualifier indexQualifier: qualifier.Accept(this); if (expressionType.ElementType != null) expressionType = expressionType.ElementType; else { //indexing nonCollection throw new NotImplementedException(); } break; case AttributeQualifier attributeQualifier: var attribute = expressionType.GetAttribute(attributeQualifier.Attribute.AttributeName, false); if (attribute != null) { expressionType = attribute.Type; referencedSymbols_[attributeQualifier.Attribute] = attribute; } else { //unresolved attribute name throw new NotImplementedException(); } break; case GroupQualifier groupQualifier: TypeInfo findAncestor(TypeInfo typeInfo, string name) { if (typeInfo.Name.Equals(name, StringComparison.OrdinalIgnoreCase)) return typeInfo; foreach(var baseType in typeInfo.BaseTypes) { if (findAncestor(baseType, name) is TypeInfo result) return result; } return null; } //find ancestor var ancestorType = findAncestor(expressionType, groupQualifier.Entity.EntityName); if(ancestorType != null) { expressionType = ancestorType; } else { //cannot find ancestory type throw new NotImplementedException(); } break; default: throw new NotImplementedException(); } } expressionTypes_[qualifiedExpression] = expressionType; }
public static List <Signal> GetSensitivityList(QualifiedExpression expr) { return(GetSensitivityList(expr.Operand)); }
public virtual void VisitQualifiedExpression(QualifiedExpression qualifiedExpression) { DefaultVisit(qualifiedExpression); }
protected internal virtual Parser <IOption <ExpressionSyntax> > KeywordExpressionStatement(string keyword) => KeywordExpression(keyword) .Token() .Then(_ => QualifiedExpression.Token().XOptional()) .Then(x => Parse.Char(';').Token().Return(x));
public AbstractValue Evaluate(QualifiedExpression expr) { throw new NotImplementedException(); }