Skip to content

Commit

Permalink
Merge pull request #19 from pallene-lang/trim-whitespace
Browse files Browse the repository at this point in the history
Trim whitespace and add editorconfig
  • Loading branch information
singul4ri7y authored Aug 11, 2024
2 parents 91e7fb3 + 98783f6 commit 3884483
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 31 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig is awesome: http://EditorConfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100

[spec/translator_spec.lua]
trim_trailing_whitespace = false

[*.md]
max_line_length = off

[{Makefile,makefile}]
indent_style = tab
indent_size = 8

[COMMIT_EDITMSG]
max_line_length=72
10 changes: 5 additions & 5 deletions spec/tracebacks/anon_lua/module.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
* Copyright (c) 2024, The Pallene Developers
* Pallene Tracer is licensed under the MIT license.
* Please refer to the LICENSE and AUTHORS files for details
* SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/

/* Static use of the library would suffice. */
Expand All @@ -15,7 +15,7 @@
pt_fnstack_t *fnstack = lua_touserdata(L, \
lua_upvalueindex(1))
#else
#define MODULE_GET_FNSTACK
#define MODULE_GET_FNSTACK
#endif // PT_DEBUG

/* ---------------- LUA INTERFACE FUNCTIONS ---------------- */
Expand Down Expand Up @@ -71,10 +71,10 @@ int module_fn_1_lua(lua_State *L) {

/* In Lua interface frames, we always have a finalizer object pushed to the stack by
`FIB_LUA_FRAMEENTER()`. */
if(luai_unlikely(top < 1))
if(luai_unlikely(top < 1))
luaL_error(L, "Expected atleast 1 parameters");

if(luai_unlikely(lua_isfunction(L, 1) == 0))
if(luai_unlikely(lua_isfunction(L, 1) == 0))
luaL_error(L, "Expected parameter 1 to be a function");

/* Now dispatch to an actual C function. */
Expand Down
14 changes: 7 additions & 7 deletions spec/tracebacks/depth_recursion/module.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
* Copyright (c) 2024, The Pallene Developers
* Pallene Tracer is licensed under the MIT license.
* Please refer to the LICENSE and AUTHORS files for details
* SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/

/* Static use of the library would suffice. */
Expand All @@ -15,7 +15,7 @@
pt_fnstack_t *fnstack = lua_touserdata(L, \
lua_upvalueindex(1))
#else
#define MODULE_GET_FNSTACK
#define MODULE_GET_FNSTACK
#endif // PT_DEBUG

/* ---------------- LUA INTERFACE FUNCTIONS ---------------- */
Expand Down Expand Up @@ -46,7 +46,7 @@ void module_fn(lua_State *L, int depth) {

lua_pushvalue(L, 1);

if(depth == 0)
if(depth == 0)
lua_pushinteger(L, depth);
else lua_pushinteger(L, depth - 1);

Expand All @@ -63,14 +63,14 @@ int module_fn_lua(lua_State *L) {
MODULE_LUA_FRAMEENTER(module_fn_lua);

/* Look at the macro definitions. */
if(luai_unlikely(top < 2))
if(luai_unlikely(top < 2))
luaL_error(L, "Expected atleast 2 parameters");

/* ---- `lua_fn` ---- */
if(luai_unlikely(lua_isfunction(L, 1) == 0))
if(luai_unlikely(lua_isfunction(L, 1) == 0))
luaL_error(L, "Expected the first parameter to be a function");

if(luai_unlikely(lua_isinteger(L, 2) == 0))
if(luai_unlikely(lua_isinteger(L, 2) == 0))
luaL_error(L, "Expected the second parameter to be an integer");

int depth = lua_tointeger(L, 2);
Expand Down
10 changes: 5 additions & 5 deletions spec/tracebacks/dispatch/module.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
* Copyright (c) 2024, The Pallene Developers
* Pallene Tracer is licensed under the MIT license.
* Please refer to the LICENSE and AUTHORS files for details
* SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/

/* Static use of the library would suffice. */
Expand All @@ -15,7 +15,7 @@
pt_fnstack_t *fnstack = lua_touserdata(L, \
lua_upvalueindex(1))
#else
#define MODULE_GET_FNSTACK
#define MODULE_GET_FNSTACK
#endif // PT_DEBUG

/* ---------------- LUA INTERFACE FUNCTIONS ---------------- */
Expand Down Expand Up @@ -71,10 +71,10 @@ int module_fn_1_lua(lua_State *L) {

/* In Lua interface frames, we always have a finalizer object pushed to the stack by
`FIB_LUA_FRAMEENTER()`. */
if(luai_unlikely(top < 1))
if(luai_unlikely(top < 1))
luaL_error(L, "Expected atleast 1 parameters");

if(luai_unlikely(lua_isfunction(L, 1) == 0))
if(luai_unlikely(lua_isfunction(L, 1) == 0))
luaL_error(L, "Expected parameter 1 to be a function");

/* Now dispatch to an actual C function. */
Expand Down
10 changes: 5 additions & 5 deletions spec/tracebacks/ellipsis/module.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
* Copyright (c) 2024, The Pallene Developers
* Pallene Tracer is licensed under the MIT license.
* Please refer to the LICENSE and AUTHORS files for details
* SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/

/* Static use of the library would suffice. */
Expand All @@ -15,7 +15,7 @@
pt_fnstack_t *fnstack = lua_touserdata(L, \
lua_upvalueindex(1))
#else
#define MODULE_GET_FNSTACK
#define MODULE_GET_FNSTACK
#endif // PT_DEBUG

/* ---------------- LUA INTERFACE FUNCTIONS ---------------- */
Expand Down Expand Up @@ -59,11 +59,11 @@ int module_fn_lua(lua_State *L) {
MODULE_LUA_FRAMEENTER(module_fn_lua);

/* Look at the macro definitions. */
if(luai_unlikely(top < 1))
if(luai_unlikely(top < 1))
luaL_error(L, "Expected atleast 1 parameters");

/* ---- `lua_fn` ---- */
if(luai_unlikely(lua_isfunction(L, 1) == 0))
if(luai_unlikely(lua_isfunction(L, 1) == 0))
luaL_error(L, "Expected the first parameter to be a function");

/* Dispatch. */
Expand Down
6 changes: 3 additions & 3 deletions spec/tracebacks/multimod/module_a.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
* Copyright (c) 2024, The Pallene Developers
* Pallene Tracer is licensed under the MIT license.
* Please refer to the LICENSE and AUTHORS files for details
* SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/

#define PT_IMPLEMENTATION
Expand All @@ -29,7 +29,7 @@ int some_mod_fn_lua(lua_State *L) {
MODULE_LUA_FRAMEENTER(some_mod_fn_lua);

/* Look at the macro definition. */
if(luai_unlikely(top < 1))
if(luai_unlikely(top < 1))
luaL_error(L, "Expected atleast 1 argument");

if(luai_unlikely(lua_isfunction(L, 1) == 0))
Expand Down
4 changes: 2 additions & 2 deletions spec/tracebacks/multimod/module_b.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
* Copyright (c) 2024, The Pallene Developers
* Pallene Tracer is licensed under the MIT license.
* Please refer to the LICENSE and AUTHORS files for details
* SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/

#define PT_IMPLEMENTATION
Expand Down
2 changes: 1 addition & 1 deletion spec/tracebacks/multimod/module_include.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
pt_fnstack_t *fnstack = lua_touserdata(L, \
lua_upvalueindex(1))
#else
#define MODULE_GET_FNSTACK
#define MODULE_GET_FNSTACK
#endif // PT_DEBUG

/* ---------------- LUA INTERFACE FUNCTIONS ---------------- */
Expand Down
6 changes: 3 additions & 3 deletions spec/tracebacks/singular/module.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
* Copyright (c) 2024, The Pallene Developers
* Pallene Tracer is licensed under the MIT license.
* Please refer to the LICENSE and AUTHORS files for details
* SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/

/* Static use of the library would suffice. */
Expand All @@ -15,7 +15,7 @@
pt_fnstack_t *fnstack = lua_touserdata(L, \
lua_upvalueindex(1))
#else
#define MODULE_GET_FNSTACK
#define MODULE_GET_FNSTACK
#endif // PT_DEBUG

/* ---------------- FOR C INTERFACE FUNCTIONS ---------------- */
Expand Down

0 comments on commit 3884483

Please sign in to comment.