public static IYieldBreakStatement YieldBreak(this IBlockStatementParent blockParent) { var yieldResult = new YieldBreakStatement(blockParent); blockParent.Add(yieldResult); return(yieldResult); }
public static IUsingBlockStatement Using(this IBlockStatementParent parent, ILocalDeclarationsStatement resourceAcquisition) { var usingStatement = new UsingBlockStatement(parent, resourceAcquisition); parent.Add(usingStatement); return(usingStatement); }
public static IYieldReturnStatement YieldReturn(this IBlockStatementParent blockParent, IExpression returnValue) { var yieldResult = new YieldReturnStatement(blockParent, returnValue); blockParent.Add(yieldResult); return(yieldResult); }
public static IUsingExpressionBlockStatement Using(this IBlockStatementParent parent, IExpression resourceAcquisition) { var usingStatement = new UsingExpressionBlockStatement(parent, resourceAcquisition); parent.Add(usingStatement); return(usingStatement); }
public static ILockStatement Lock(this IBlockStatementParent parent, IExpression monitorLock) { var lockStatement = new LockStatement(parent, monitorLock); parent.Add(lockStatement); return(lockStatement); }
public static IThrowStatement Throw(this IBlockStatementParent parent, IExpression throwTarget) { var throwStatement = new ThrowStatement(parent, throwTarget); parent.Add(throwStatement); return(throwStatement); }
public static ITryStatement TryCatch(this IBlockStatementParent parent, TypedName exceptionType) { var result = new TryStatement(parent); result.Catch(exceptionType); parent.Add(result); return(result); }
public static ITryStatement TryCatch(this IBlockStatementParent parent) { var result = new TryStatement(parent); result.HasCatchAll = true; parent.Add(result); return(result); }
public static IUsingBlockStatement Using(this IBlockStatementParent parent, ILocalMember resourceAcquisition, params ILocalMember[] siblings) { var decl = resourceAcquisition.GetDeclarationStatement(siblings); var usingStatement = new UsingBlockStatement(parent, decl); parent.Add(usingStatement); return(usingStatement); }
/// <summary> /// Creates a new <see cref="EnumerateSetBreakableBlockStatement"/> /// with the <paramref name="parent"/> provided. /// </summary> /// <param name="parent">The <see cref="IBlockStatementParent"/> /// which contains the <see cref="IEnumerateSetBreakableBlockStatement"/>. /// </param> /// <param name="localName">The <see cref="String"/> value denoting /// the name of the local for the set enumeration block statement.</param> public EnumerateSetBreakableBlockStatement(IBlockStatementParent parent, string localName) : base(parent) { var local = this.Locals.Add(localName, null, LocalTypingKind.Implicit); local.AutoDeclare = false; this.Local = local; }
public EnumerateSetBreakableBlockStatement(IBlockStatementParent parent, TypedName localNameAndType) : base(parent) { var local = this.Locals.Add(localNameAndType); local.AutoDeclare = false; this.Local = local; }
public static ITryStatement TryFinally(this IBlockStatementParent parent) { var result = new TryStatement(parent); result.HasFinally = true; parent.Add(result); return(result); }
public static IExplicitStringLiteralStatement Literal(this IBlockStatementParent block, string literal) { IExplicitStringLiteralStatement result = new ExplicitStringLiteralStatement(block) { Literal = literal }; block.Add(result); return(result); }
public static Dictionary <SyntacticalDFAState, SyntacticalDFAStateJumpData> ObtainStateJumpDetails( IEnumerable <SyntacticalDFAState> statesNeedingLabels, IBlockStatementParent owner, string labelPattern, string statePattern, Func <SyntacticalDFAState, bool> isMultiOverride, IEnumerable <SyntacticalDFAState> singularStates, params object[] furtherReplacements) { return(ObtainStateJumpDetailsInternal(statesNeedingLabels, owner, labelPattern, statePattern, isMultiOverride, singularStates, furtherReplacements) .OrderBy(k => k.State.StateValue) .ToDictionary(k => k.State, v => v)); }
private static IEnumerable <SyntacticalDFAStateJumpData> ObtainStateJumpDetailsInternal( IEnumerable <SyntacticalDFAState> statesNeedingLabels, IBlockStatementParent owner, string labelPattern, string statePattern, Func <SyntacticalDFAState, bool> isMultiOverride, IEnumerable <SyntacticalDFAState> singularStates, params object[] furtherReplacements) { if (singularStates != null && isMultiOverride != null) { foreach (var state in singularStates) { if (isMultiOverride(state)) { yield return new SyntacticalDFAStateJumpData() { State = state, Label = new Lazy <ILabelStatement>(() => owner.DefineLabel(string.Format(string.Format(labelPattern, statePattern), ((object)state.StateValue).AsEnumerable().Concat(furtherReplacements).ToArray()))), BlockContainer = new BlockStatementParentContainer(owner) } } } } ; foreach (var state in statesNeedingLabels.OrderBy(k => k.StateValue)) { yield return(new SyntacticalDFAStateJumpData() { State = state, Label = new Lazy <ILabelStatement>(() => owner.DefineLabel(string.Format(string.Format(labelPattern, statePattern), ((object)state.StateValue).AsEnumerable().Concat(furtherReplacements).ToArray()))), BlockContainer = new BlockStatementParentContainer(owner) }); } }
private void BuildCullAmbiguities(ParserCompiler compiler, ParserBuilder parserBuilder, IIntermediateCliManager identityManager) { bool lexicallyAmbiguousModel = compiler._GrammarSymbols.AmbiguousSymbols.Count() > 0; if (!lexicallyAmbiguousModel) { return; } var runningAmbiguities = this._cullAmbiguities.Locals.Add( new TypedName("runningAmbiguities", compiler.LexicalSymbolModel.ValidSymbols), new DefaultValueExpression(compiler.LexicalSymbolModel.ValidSymbols)); var resultAmbiguities = this._cullAmbiguities.Locals.Add( new TypedName("resultAmbiguities", compiler.LexicalSymbolModel.ValidSymbols), new DefaultValueExpression(compiler.LexicalSymbolModel.ValidSymbols)); var unambiguousSource = this._cullAmbiguities.Parameters["unambiguousSource"]; this._cullAmbiguities.Comment("Remove the ambiguities that are currently present, a larger multiple-symbol ambiguity may trump what was there due to the follow-union."); this._cullAmbiguities.Assign((IMemberReferenceExpression)unambiguousSource.GetReference(), AssignmentOperation.BitwiseExclusiveOrAssign, unambiguousSource.GetReference().BitwiseAnd(_AllAmbiguitiesField.GetReference())); bool first = true; foreach (var ambiguity in compiler._GrammarSymbols.AmbiguousSymbols) { var ambiguityDetail = compiler.AmbiguityDetail[ambiguity]; IBlockStatementParent target = this._cullAmbiguities; if (first) { first = false; } else { target = target.If(runningAmbiguities.GetReference().BitwiseAnd(ambiguityDetail.AmbiguityKeyReference.GetReference()).InequalTo(ambiguityDetail.AmbiguityKeyReference.GetReference())); } var assignmentCheck = target.If(unambiguousSource.BitwiseAnd(ambiguityDetail.AmbiguityKeyReference).EqualTo(ambiguityDetail.AmbiguityKeyReference)); assignmentCheck.Assign(runningAmbiguities.GetReference(), AssignmentOperation.BitwiseOrAssign, ambiguityDetail.AmbiguityKeyReference.GetReference()); assignmentCheck.Assign(resultAmbiguities.GetReference(), AssignmentOperation.BitwiseOrAssign, ambiguityDetail.AmbiguityReference.GetReference()); } _cullAmbiguities.Return(resultAmbiguities.GetReference()); }
public ConditionContinuationStatement(IBlockStatementParent parent) : base(parent) { }
/// <summary> /// Creates a new <see cref="TypedLocalMember"/> /// with the <paramref name="name"/>, <paramref name="parent"/> and <paramref name="localType"/> /// provided. /// </summary> /// <param name="name"></param> /// <param name="parent"></param> /// <param name="localType"></param> public TypedLocalMember(string name, IBlockStatementParent parent, IType localType) : base(name, parent, LocalTypingKind.Explicit) { this.LocalType = localType; }
public static ILockStatement Lock(this IBlockStatementParent parent, ILocalMember localMember) { return(parent.Lock(localMember.GetReference())); }
public static IYieldReturnStatement YieldReturn(this IBlockStatementParent blockParent, IStructPropertyMember returnValue) { return(blockParent.YieldReturn((IExpression)returnValue.GetReference())); }
/// <summary> /// Creates a new <see cref="ConditionBlockStatement"/> with /// the <paramref name="parent"/> which contains it. /// </summary> /// <param name="parent">The <see cref="IBlockStatementParent"/> which /// contains the <see cref="ConditionBlockStatement"/>.</param> public ConditionBlockStatement(IBlockStatementParent parent) : base(parent) { }
public SwitchStatement(IBlockStatementParent parent) { this.Parent = parent; }
/// <summary> /// Creates a new <see cref="WhileStatement"/> with the <paramref name="parent"/> and /// <paramref name="condition"/> provided. /// </summary> /// <param name="parent"> /// The <see cref="IBlockStatementParent"/> which contains the <see cref="WhileStatement"/>. /// </param> /// <param name="condition"> /// The <see cref="IExpression"/> which must evaluate to true for the block of the /// <see cref="WhileStatement"/> to be evaluated. /// </param> public WhileStatement(IBlockStatementParent parent, IExpression condition) : base(parent) { this.Condition = condition; }
public BlockStatementScopeLabelDictionary(IBlockStatementParent initialPoint) { this.initialPoint = initialPoint; }
public IterationBlockBaseStatement(IBlockStatementParent parent, IExpression condition, IEnumerable <IStatementExpression> iterations) : base(parent) { this.Condition = condition; this.Iterations = new MalleableStatementExpressionCollection(iterations); }
public static IYieldReturnStatement YieldReturn(this IBlockStatementParent blockParent, IParameterReferenceExpression returnValue) { return(blockParent.YieldReturn((IExpression)returnValue)); }
public static IYieldReturnStatement YieldReturn(this IBlockStatementParent blockParent, INaryOperandExpression returnValue) { return(blockParent.YieldReturn((IExpression)returnValue)); }
public static ILockStatement Lock(this IBlockStatementParent parent, IStructFieldMember fieldMember) { return(parent.Lock(fieldMember.GetReference())); }
public static IThrowStatement Throw(this IBlockStatementParent parent) { return(parent.Throw(null)); }
public static IYieldReturnStatement YieldReturn(this IBlockStatementParent blockParent, ulong returnValue) { return(blockParent.YieldReturn((IExpression)returnValue.ToPrimitive())); }