예제 #1
0
        public override void ExitCond(HS_Gen1Parser.CondContext context)
        {
            if (_debug)
            {
                _logger.Cond(context, CompilerContextAction.Exit);
            }

            // Link to the compiler generated begin call of the last open cond group.
            LinkDatum();

            // Add the final expression of the cond construct. Not sure why the official Blam Script compiler adds these.
            ushort typeOpcode = _opcodes.GetTypeInfo(_condReturnType).Opcode;
            var expression = new ScriptExpression
            {
                Index = _currentIndex,
                Opcode = typeOpcode,
                ReturnType = typeOpcode,
                Type = ScriptExpressionType.Expression,
                Next = DatumIndex.Null,
                StringOffset = context.GetCorrectTextPosition(_missingCarriageReturnPositions),
                Value = new LongExpressionValue(0),
                LineNumber = 0
            };
            AddExpressionIncrement(expression);

            // Open the first group.
            int firstGroupIndex = _condIndeces.Pop();
            OpenDatum(firstGroupIndex);
        }
예제 #2
0
        public override void EnterCond(HS_Gen1Parser.CondContext context)
        {
            if (_debug)
            {
                _logger.Cond(context, CompilerContextAction.Enter);
            }

            // Tell the groups what type to expect.
            _condReturnType = _expectedTypes.PopType();

            // Push the index to the first group, so that we can open it later on.
            _condIndeces.Push(_expressions.Count);
        }
예제 #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="HS_Gen1Parser.cond"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitCond([NotNull] HS_Gen1Parser.CondContext context)
 {
 }