コード例 #1
0
ファイル: ClepsType.cs プロジェクト: shravanrn/Cleps
        public static ClepsType GetBasicOrVoidType(ClepsParser.TypenameAndVoidContext typenameAndVoidContext)
        {
            if (typenameAndVoidContext.VOID() != null)
            {
                return(GetVoidType());
            }

            return(GetBasicType(typenameAndVoidContext.typename()));
        }
コード例 #2
0
        public override object VisitTypenameAndVoid([NotNull] ClepsParser.TypenameAndVoidContext context)
        {
            if (context.typename() != null)
            {
                return(Visit(context.typename()));
            }

            var ret = VoidType.GetVoidType();

            return(ret);
        }
コード例 #3
0
        public override LLVMRegister VisitMemberFunctionDeclarationStatement([NotNull] ClepsParser.MemberFunctionDeclarationStatementContext context)
        {
            bool isStatic = context.STATIC() != null;

            ClepsParser.TypenameAndVoidContext returnTypeContext = context.functionDeclarationStatement().FunctionReturnType;
            ClepsType clepsReturnType = ClepsType.GetBasicOrVoidType(returnTypeContext);

            ClepsParser.FunctionParametersListContext parametersContext = context.functionDeclarationStatement().functionParametersList();
            string functionName = context.functionDeclarationStatement().FunctionName.GetText();

            return(VisitFunctionDeclarationBody(context, clepsReturnType, parametersContext, functionName, isStatic));
        }
コード例 #4
0
        public override int VisitMemberFunctionDeclarationStatement([NotNull] ClepsParser.MemberFunctionDeclarationStatementContext context)
        {
            bool   isStatic = context.STATIC() != null;
            var    functionDeclarationContext = context.functionDeclarationStatement();
            string functionName = functionDeclarationContext.FunctionName.Name.Text;

            ClepsParser.TypenameAndVoidContext functionReturnContext = functionDeclarationContext.FunctionReturnType;
            ClepsType clepsReturnType = ClepsType.GetBasicOrVoidType(functionReturnContext);

            ClepsParser.FunctionParametersListContext parameterContext = functionDeclarationContext.functionParametersList();
            var ret = GenerateMemberFunction(context, isStatic, functionName, clepsReturnType, parameterContext);

            return(ret);
        }
コード例 #5
0
ファイル: ClepsBaseListener.cs プロジェクト: shravanrn/Cleps
 /// <summary>
 /// Exit a parse tree produced by <see cref="ClepsParser.typenameAndVoid"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitTypenameAndVoid([NotNull] ClepsParser.TypenameAndVoidContext context)
 {
 }
コード例 #6
0
ファイル: ClepsBaseVisitor.cs プロジェクト: shravanrn/Cleps
 /// <summary>
 /// Visit a parse tree produced by <see cref="ClepsParser.typenameAndVoid"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitTypenameAndVoid([NotNull] ClepsParser.TypenameAndVoidContext context)
 {
     return(VisitChildren(context));
 }