Prefer def

This commit is contained in:
Christoffer Lerno
2023-06-02 11:31:07 +02:00
committed by Christoffer Lerno
parent b30d130d92
commit 3e54d13b62
66 changed files with 156 additions and 148 deletions

View File

@@ -95,9 +95,9 @@ int comment_level = 0;
"char" { count(); return(CHAR); }
"const" { count(); return(CONST); }
"continue" { count(); return(CONTINUE); }
"def" { count(); return(DEF); }
"default" { count(); return(DEFAULT); }
"defer" { count(); return(DEFER); }
"define" { count(); return(DEFINE); }
"distinct" { count(); return(DISTINCT); }
"do" { count(); return(DO); }
"double" { count(); return(DOUBLE); }
@@ -137,7 +137,6 @@ int comment_level = 0;
"tlocal" { count(); return(TLOCAL); }
"true" { count(); return(TRUE); }
"try" { count(); return(TRY); }
"typedef" { count(); return(TYPEDEF); }
"typeid" { count(); return(TYPEID); }
"uint" { count(); return(UINT); }
"uint128" { count(); return(UINT128); }

View File

@@ -17,7 +17,7 @@ void yyerror(char *s);
%token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
%token SUB_ASSIGN SHL_ASSIGN SHR_ASSIGN AND_ASSIGN
%token XOR_ASSIGN OR_ASSIGN VAR NUL ELVIS NEXTCASE ANYFAULT
%token TYPEDEF MODULE IMPORT DEFINE EXTERN
%token MODULE IMPORT DEF EXTERN
%token CHAR SHORT INT LONG FLOAT DOUBLE CONST VOID USZ ISZ UPTR IPTR ANY
%token ICHAR USHORT UINT ULONG BOOL INT128 UINT128 FLOAT16 FLOAT128 BFLOAT16
%token TYPEID BITSTRUCT STATIC BANGBANG AT_CONST_IDENT HASH_TYPE_IDENT
@@ -1110,9 +1110,6 @@ typedef_type
| type opt_generic_parameters
;
typedef_declaration
: TYPEDEF TYPE_IDENT opt_attributes '=' opt_distinct_inline typedef_type ';'
;
multi_declaration
@@ -1166,8 +1163,9 @@ define_ident
;
define_declaration
: DEFINE define_ident ';'
| DEFINE define_attribute ';'
: DEF define_ident ';'
| DEF define_attribute ';'
| DEF TYPE_IDENT opt_attributes '=' opt_distinct_inline typedef_type ';'
;
tl_ct_if
@@ -1233,7 +1231,6 @@ top_level
| fault_declaration
| enum_declaration
| macro_declaration
| typedef_declaration
| define_declaration
| static_declaration
| bitstruct_declaration

View File

@@ -231,8 +231,8 @@ fn void hello() throws Errors
return;
}
typedef Foo* as Bar;
typedef fn void(int, Foo*) as Zoo;
def Foo* as Bar;
def fn void(int, Foo*) as Zoo;

View File

@@ -103,7 +103,7 @@ const uint SDL_WINDOWPOS_UNDEFINED = UndefinedDisplay(x);
#define SDL_WINDOWPOS_ISCENTERED(X) \
(((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
typedef enum
def enum
{
SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
@@ -115,7 +115,7 @@ typedef enum
/**
* \brief An opaque handle to an OpenGL context.
*/
typedef void *SDL_GLContext;
def void *SDL_GLContext;
enum GLAttr
@@ -149,14 +149,14 @@ enum GLAttr
GL_CONTEXT_NO_ERROR
}
typedef enum
def enum
{
SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
} SDL_GLprofile;
typedef enum
def enum
{
SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
@@ -164,13 +164,13 @@ typedef enum
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
} SDL_GLcontextFlag;
typedef enum
def enum
{
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
} SDL_GLcontextReleaseFlag;
typedef enum
def enum
{
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
@@ -810,7 +810,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
*
* \sa SDL_HitTest
*/
typedef enum
def enum
{
SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */
@@ -829,7 +829,7 @@ typedef enum
*
* \sa SDL_SetWindowHitTest
*/
typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
def SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
const SDL_Point *area,
void *data);