private void appendLabel(SequentialStatement statement) { if (statement.Label != null) { writer.Append(statement.Label).Append(" : "); } }
private string GetSequentialCode(VHDLCompilerInterface compiler, SequentialStatement st) { SequentialStatementObserver observer = new SequentialStatementObserver(st, logger); observer.Observe(compiler); return(observer.code); }
private int GetWaitCount(SequentialStatement SeqStatement) { int WaitCount = 0; if (SeqStatement is WaitStatement) { return(1); } foreach (VhdlElement el in SeqStatement.GetAllStatements()) { if (el is SequentialStatement) { WaitCount += GetWaitCount(el as SequentialStatement); } } return(WaitCount); }
private void appendExitOrNextStatement(SequentialStatement statement, KeywordEnum keyword, LoopStatement loop, Expression condition) { appendLabel(statement); writer.Append(keyword.ToString()); if (loop != null) { string label = loop.Label; if (label == null) { //FIXME: unify handling of null values throw new ArgumentNullException("Loop label is null"); } writer.Append(' ').Append(label); } if (condition != null) { writer.Append(' ').Append(KeywordEnum.WHEN.ToString()).Append(' '); output.writeExpression(condition); } writer.Append(';').NewLine(); }
/// <summary> /// Writes a sequential statement. /// </summary> /// <param name="statement">the statment</param> public virtual void writeSeqentialStatement(SequentialStatement statement) { getSequentialStatementVisitor().visit(statement); }
public override void visit(SequentialStatement statement) { VhdlOutputHelper.handleAnnotationsBefore(statement, writer); base.visit(statement); VhdlOutputHelper.handleAnnotationsAfter(statement, writer); }
/// <summary> /// Получение элемента семантического дерева по его смещению /// </summary> /// <param name="parent"></param> /// <param name="offset"></param> /// <returns></returns> public VhdlElement GetElementByOffset(VhdlElement parent, int offset) { if ((parent == null) || (file == null)) { return(null); } if (((parent is IDeclarativeRegion) == false) && ((parent is SequentialStatement) == false)) { return(parent); } if (parent is IDeclarativeRegion) { IDeclarativeRegion decl = parent as IDeclarativeRegion; List <object> objects = decl.Scope.GetLocalListOfObjects(); if (objects.Count >= 1) { foreach (object obj in objects) { if (parent == obj) { continue; } if (obj is VhdlElement) { PositionInformation pos = GetPositionInformation(obj as VhdlElement); if ((pos != null) && (pos.Begin.Index <= offset) && (pos.End.Index >= offset)) { (obj as VhdlElement).Parent = (parent as IDeclarativeRegion); return(GetElementByOffset(obj as VhdlElement, offset)); } if (pos == null) { (obj as VhdlElement).Parent = (parent as IDeclarativeRegion); return(obj as VhdlElement); } } } } } if (parent is SequentialStatement) { SequentialStatement stat = parent as SequentialStatement; List <VhdlElement> objects = stat.GetAllStatements(); if (objects.Count >= 1) { foreach (VhdlElement obj in objects) { if (parent == obj) { continue; } if (obj == null) { continue; } PositionInformation pos = GetPositionInformation(obj as VhdlElement); if ((pos != null) && (pos.Begin.Index <= offset) && (pos.End.Index >= offset)) { (obj as VhdlElement).Parent = ((parent as SequentialStatement).Parent); return(GetElementByOffset(obj as VhdlElement, offset)); } if (pos == null) { (obj as VhdlElement).Parent = (parent as IDeclarativeRegion); return(obj as VhdlElement); } } } } return(parent); }
public SequentialStatementObserver(SequentialStatement statement, Logger logger) { this.logger = logger; this.statement = statement; }