Esempio n. 1
0
            public override Unit VisitPrimaryExpression(CParser.PrimaryExpressionContext context)
            {
                if (context.Identifier() != null)
                {
                    _builder.ResetCurrentLexeme(context.SourceInterval.a, context.SourceInterval.a);
                    var mark = _builder.Mark();
                    base.VisitChildren(context);
                    _builder.Done(mark, SpringReferenceNodeElement.NODE_TYPE, context);
                }
                else
                {
                    VisitChildren(context);
                }

                return(Unit.Instance);
            }
Esempio n. 2
0
        protected ObjectDef EmitPrimaryExpression(CParser.PrimaryExpressionContext primaryExpression)
        {
            ObjectDef returnObjectDef = null;

            if (primaryExpression.Identifier() != null)
            {
                ;   // TODO: load from identifier
            }
            else if (primaryExpression.Constant() != null)
            {
                returnObjectDef = EmitConstant(primaryExpression.Constant());
            }
            else if (primaryExpression.StringLiteral() != null)
            {
                ;
            }

            return(returnObjectDef);
        }
Esempio n. 3
0
        public override void ExitPrimaryExpression(CParser.PrimaryExpressionContext context)
        {
            if (context.Identifier() != null)
            {
                //Identifier

                SafeCall(context, () => CExpression.PushIdentifier(context.Identifier().GetText()));
            }
            else if (context.Constant() != null)
            {
                //Constant
                SafeCall(context, () => CExpression.PushConstant(context.Constant().GetText()));
            }
            else if (context.StringLiteral().Count > 0)
            {
                //StringLiteral+
                var literals = context.StringLiteral().Select(lit => lit.GetText());
                SafeCall(context, () => CExpression.PushString(literals));
            }
            else if (context.compoundStatement() != null)
            {
                //'__extension__'? '(' compoundStatement ')'
                SematicError(context, "GCC blocks extention not supported");
            }
            else if (context.GetText().Contains("__builtin_va_arg"))
            {
                //'__builtin_va_arg' '(' unaryExpression ',' typeName ')'
                SematicError(context, "var args not supported");
            }
            else if (context.genericSelection() != null)
            {
                //genericSelection
                SematicError(context, "generic selection not supported");
            }
            else if (context.GetText().StartsWith("__builtin_offsetof"))
            {
                //'__builtin_offsetof' '(' typeName ',' unaryExpression ')'
                SematicError(context, "offsetof not supported");
            }
        }
Esempio n. 4
0
 public override void EnterPrimaryExpression([NotNull] CParser.PrimaryExpressionContext context)
 {
     base.EnterPrimaryExpression(context);
     //typeList.Add(context.Identifier().GetText());
 }