mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-25 20:42:07 +00:00
Cleanup code of rbglink
Follow Linux kernel coding style. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "extern/err.h"
|
||||
|
||||
#include "link/script.h"
|
||||
|
||||
int yylex();
|
||||
@@ -27,7 +28,10 @@ void yyerror(char *);
|
||||
extern int yylineno;
|
||||
%}
|
||||
|
||||
%union { int32_t i; char s[512]; }
|
||||
%union {
|
||||
int32_t i;
|
||||
char s[512];
|
||||
}
|
||||
|
||||
%token<i> INTEGER
|
||||
%token<s> STRING
|
||||
@@ -49,55 +53,65 @@ extern int yylineno;
|
||||
lines:
|
||||
/* empty */
|
||||
| lines line NEWLINE
|
||||
;
|
||||
;
|
||||
|
||||
line:
|
||||
/* empty */
|
||||
| statement
|
||||
;
|
||||
;
|
||||
|
||||
statement:
|
||||
/* Statements to set the current section */
|
||||
SECTION_NONBANKED {
|
||||
SECTION_NONBANKED
|
||||
{
|
||||
script_SetCurrentSectionType($1, 0);
|
||||
}
|
||||
| SECTION_NONBANKED INTEGER {
|
||||
| SECTION_NONBANKED INTEGER
|
||||
{
|
||||
script_fatalerror("Trying to assign a bank to a non-banked section.\n");
|
||||
}
|
||||
|
||||
| SECTION_BANKED {
|
||||
| SECTION_BANKED
|
||||
{
|
||||
script_fatalerror("Banked section without assigned bank.\n");
|
||||
}
|
||||
| SECTION_BANKED INTEGER {
|
||||
| SECTION_BANKED INTEGER
|
||||
{
|
||||
script_SetCurrentSectionType($1, $2);
|
||||
}
|
||||
|
||||
/* Commands to adjust the address inside the current section */
|
||||
| COMMAND_ALIGN INTEGER {
|
||||
| COMMAND_ALIGN INTEGER
|
||||
{
|
||||
script_SetAlignment($2);
|
||||
}
|
||||
| COMMAND_ALIGN {
|
||||
| COMMAND_ALIGN
|
||||
{
|
||||
script_fatalerror("ALIGN keyword needs an argument.\n");
|
||||
}
|
||||
| COMMAND_ORG INTEGER {
|
||||
| COMMAND_ORG INTEGER
|
||||
{
|
||||
script_SetAddress($2);
|
||||
}
|
||||
| COMMAND_ORG {
|
||||
| COMMAND_ORG
|
||||
{
|
||||
script_fatalerror("ORG keyword needs an argument.\n");
|
||||
}
|
||||
|
||||
/* Section name */
|
||||
| STRING {
|
||||
| STRING
|
||||
{
|
||||
script_OutputSection($1);
|
||||
}
|
||||
|
||||
/* Include file */
|
||||
| COMMAND_INCLUDE STRING {
|
||||
| COMMAND_INCLUDE STRING
|
||||
{
|
||||
script_IncludeFile($2);
|
||||
}
|
||||
|
||||
/* End */
|
||||
;
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
|
||||
Reference in New Issue
Block a user