Skip to content

Commit 92f5cbc

Browse files
committed
Format code based on rules
1 parent df6bde0 commit 92f5cbc

File tree

10 files changed

+941
-1045
lines changed

10 files changed

+941
-1045
lines changed

ext/rbs_extension/lexer.h

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -2,95 +2,95 @@
22
#define RBS__LEXER_H
33

44
enum TokenType {
5-
NullType, /* (Nothing) */
6-
pEOF, /* EOF */
7-
ErrorToken, /* Error */
8-
9-
pLPAREN, /* ( */
10-
pRPAREN, /* ) */
11-
pCOLON, /* : */
12-
pCOLON2, /* :: */
13-
pLBRACKET, /* [ */
14-
pRBRACKET, /* ] */
15-
pLBRACE, /* { */
16-
pRBRACE, /* } */
17-
pHAT, /* ^ */
18-
pARROW, /* -> */
19-
pFATARROW, /* => */
20-
pCOMMA, /* , */
21-
pBAR, /* | */
22-
pAMP, /* & */
23-
pSTAR, /* * */
24-
pSTAR2, /* ** */
25-
pDOT, /* . */
26-
pDOT3, /* ... */
27-
pBANG, /* ! */
28-
pQUESTION, /* ? */
29-
pLT, /* < */
30-
pEQ, /* = */
31-
32-
kALIAS, /* alias */
33-
kATTRACCESSOR, /* attr_accessor */
34-
kATTRREADER, /* attr_reader */
35-
kATTRWRITER, /* attr_writer */
36-
kBOOL, /* bool */
37-
kBOT, /* bot */
38-
kCLASS, /* class */
39-
kDEF, /* def */
40-
kEND, /* end */
41-
kEXTEND, /* extend */
42-
kFALSE, /* false */
43-
kIN, /* in */
44-
kINCLUDE, /* include */
45-
kINSTANCE, /* instance */
46-
kINTERFACE, /* interface */
47-
kMODULE, /* module */
48-
kNIL, /* nil */
49-
kOUT, /* out */
50-
kPREPEND, /* prepend */
51-
kPRIVATE, /* private */
52-
kPUBLIC, /* public */
53-
kSELF, /* self */
54-
kSINGLETON, /* singleton */
55-
kTOP, /* top */
56-
kTRUE, /* true */
57-
kTYPE, /* type */
58-
kUNCHECKED, /* unchecked */
59-
kUNTYPED, /* untyped */
60-
kVOID, /* void */
61-
kUSE, /* use */
62-
kAS, /* as */
63-
k__TODO__, /* __todo__ */
64-
kATRBS, /* @rbs */
65-
kSKIP, /* skip */
66-
kRETURN, /* return */
67-
68-
tLIDENT, /* Identifiers starting with lower case */
69-
tUIDENT, /* Identifiers starting with upper case */
70-
tULIDENT, /* Identifiers starting with `_` followed by upper case */
71-
tULLIDENT, /* Identifiers starting with `_` followed by lower case */
72-
tGIDENT, /* Identifiers starting with `$` */
73-
tAIDENT, /* Identifiers starting with `@` */
74-
tA2IDENT, /* Identifiers starting with `@@` */
75-
tBANGIDENT, /* Identifiers ending with `!` */
76-
tEQIDENT, /* Identifiers ending with `=` */
77-
tQIDENT, /* Quoted identifier */
78-
pAREF_OPR, /* [] */
79-
tOPERATOR, /* Operator identifier */
80-
81-
tCOMMENT, /* Comment */
82-
tLINECOMMENT, /* Comment of all line */
83-
tINLINECOMMENT, /* Comment in inline decl starting with -- */
84-
85-
tTRIVIA, /* Trivia tokens -- space and new line */
86-
87-
tDQSTRING, /* Double quoted string */
88-
tSQSTRING, /* Single quoted string */
89-
tINTEGER, /* Integer */
90-
tSYMBOL, /* Symbol */
91-
tDQSYMBOL, /* Double quoted symbol */
92-
tSQSYMBOL, /* Single quoted symbol */
93-
tANNOTATION, /* Annotation */
5+
NullType, /* (Nothing) */
6+
pEOF, /* EOF */
7+
ErrorToken, /* Error */
8+
9+
pLPAREN, /* ( */
10+
pRPAREN, /* ) */
11+
pCOLON, /* : */
12+
pCOLON2, /* :: */
13+
pLBRACKET, /* [ */
14+
pRBRACKET, /* ] */
15+
pLBRACE, /* { */
16+
pRBRACE, /* } */
17+
pHAT, /* ^ */
18+
pARROW, /* -> */
19+
pFATARROW, /* => */
20+
pCOMMA, /* , */
21+
pBAR, /* | */
22+
pAMP, /* & */
23+
pSTAR, /* * */
24+
pSTAR2, /* ** */
25+
pDOT, /* . */
26+
pDOT3, /* ... */
27+
pBANG, /* ! */
28+
pQUESTION, /* ? */
29+
pLT, /* < */
30+
pEQ, /* = */
31+
32+
kALIAS, /* alias */
33+
kATTRACCESSOR, /* attr_accessor */
34+
kATTRREADER, /* attr_reader */
35+
kATTRWRITER, /* attr_writer */
36+
kBOOL, /* bool */
37+
kBOT, /* bot */
38+
kCLASS, /* class */
39+
kDEF, /* def */
40+
kEND, /* end */
41+
kEXTEND, /* extend */
42+
kFALSE, /* false */
43+
kIN, /* in */
44+
kINCLUDE, /* include */
45+
kINSTANCE, /* instance */
46+
kINTERFACE, /* interface */
47+
kMODULE, /* module */
48+
kNIL, /* nil */
49+
kOUT, /* out */
50+
kPREPEND, /* prepend */
51+
kPRIVATE, /* private */
52+
kPUBLIC, /* public */
53+
kSELF, /* self */
54+
kSINGLETON, /* singleton */
55+
kTOP, /* top */
56+
kTRUE, /* true */
57+
kTYPE, /* type */
58+
kUNCHECKED, /* unchecked */
59+
kUNTYPED, /* untyped */
60+
kVOID, /* void */
61+
kUSE, /* use */
62+
kAS, /* as */
63+
k__TODO__, /* __todo__ */
64+
kATRBS, /* @rbs */
65+
kSKIP, /* skip */
66+
kRETURN, /* return */
67+
68+
tLIDENT, /* Identifiers starting with lower case */
69+
tUIDENT, /* Identifiers starting with upper case */
70+
tULIDENT, /* Identifiers starting with `_` followed by upper case */
71+
tULLIDENT, /* Identifiers starting with `_` followed by lower case */
72+
tGIDENT, /* Identifiers starting with `$` */
73+
tAIDENT, /* Identifiers starting with `@` */
74+
tA2IDENT, /* Identifiers starting with `@@` */
75+
tBANGIDENT, /* Identifiers ending with `!` */
76+
tEQIDENT, /* Identifiers ending with `=` */
77+
tQIDENT, /* Quoted identifier */
78+
pAREF_OPR, /* [] */
79+
tOPERATOR, /* Operator identifier */
80+
81+
tCOMMENT, /* Comment */
82+
tLINECOMMENT, /* Comment of all line */
83+
tINLINECOMMENT, /* Comment in inline decl starting with -- */
84+
85+
tTRIVIA, /* Trivia tokens -- space and new line */
86+
87+
tDQSTRING, /* Double quoted string */
88+
tSQSTRING, /* Single quoted string */
89+
tINTEGER, /* Integer */
90+
tSYMBOL, /* Symbol */
91+
tDQSYMBOL, /* Double quoted symbol */
92+
tSQSYMBOL, /* Single quoted symbol */
93+
tANNOTATION, /* Annotation */
9494
};
9595

9696
/**
@@ -128,12 +128,12 @@ typedef struct {
128128
* */
129129
typedef struct {
130130
VALUE string;
131-
int start_pos; /* The character position that defines the start of the input */
132-
int end_pos; /* The character position that defines the end of the input */
133-
position current; /* The current position */
134-
position start; /* The start position of the current token */
135-
bool first_token_of_line; /* This flag is used for tLINECOMMENT */
136-
unsigned int last_char; /* Last peeked character */
131+
int start_pos; /* The character position that defines the start of the input */
132+
int end_pos; /* The character position that defines the end of the input */
133+
position current; /* The current position */
134+
position start; /* The start position of the current token */
135+
bool first_token_of_line; /* This flag is used for tLINECOMMENT */
136+
unsigned int last_char; /* Last peeked character */
137137
} lexstate;
138138

139139
extern token NullToken;

ext/rbs_extension/lexstate.c

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5,91 +5,91 @@ static const char *RBS_TOKENTYPE_NAMES[] = {
55
"pEOF",
66
"ErrorToken",
77

8-
"pLPAREN", /* ( */
9-
"pRPAREN", /* ) */
10-
"pCOLON", /* : */
11-
"pCOLON2", /* :: */
12-
"pLBRACKET", /* [ */
13-
"pRBRACKET", /* ] */
14-
"pLBRACE", /* { */
15-
"pRBRACE", /* } */
16-
"pHAT", /* ^ */
17-
"pARROW", /* -> */
18-
"pFATARROW", /* => */
19-
"pCOMMA", /* , */
20-
"pBAR", /* | */
21-
"pAMP", /* & */
22-
"pSTAR", /* * */
23-
"pSTAR2", /* ** */
24-
"pDOT", /* . */
25-
"pDOT3", /* ... */
26-
"pBANG", /* ! */
27-
"pQUESTION", /* ? */
28-
"pLT", /* < */
29-
"pEQ", /* = */
30-
31-
"kALIAS", /* alias */
32-
"kATTRACCESSOR", /* attr_accessor */
33-
"kATTRREADER", /* attr_reader */
34-
"kATTRWRITER", /* attr_writer */
35-
"kBOOL", /* bool */
36-
"kBOT", /* bot */
37-
"kCLASS", /* class */
38-
"kDEF", /* def */
39-
"kEND", /* end */
40-
"kEXTEND", /* extend */
41-
"kFALSE", /* kFALSE */
42-
"kIN", /* in */
43-
"kINCLUDE", /* include */
44-
"kINSTANCE", /* instance */
45-
"kINTERFACE", /* interface */
46-
"kMODULE", /* module */
47-
"kNIL", /* nil */
48-
"kOUT", /* out */
49-
"kPREPEND", /* prepend */
50-
"kPRIVATE", /* private */
51-
"kPUBLIC", /* public */
52-
"kSELF", /* self */
53-
"kSINGLETON", /* singleton */
54-
"kTOP", /* top */
55-
"kTRUE", /* true */
56-
"kTYPE", /* type */
57-
"kUNCHECKED", /* unchecked */
58-
"kUNTYPED", /* untyped */
59-
"kVOID", /* void */
60-
"kUSE", /* use */
61-
"kAS", /* as */
62-
"k__TODO__", /* __todo__ */
63-
"kATRBS", /* @rbs */
64-
"kSKIP", /* skip */
65-
"kRETURN", /* return */
66-
67-
"tLIDENT", /* Identifiers starting with lower case */
68-
"tUIDENT", /* Identifiers starting with upper case */
69-
"tULIDENT", /* Identifiers starting with `_` */
8+
"pLPAREN", /* ( */
9+
"pRPAREN", /* ) */
10+
"pCOLON", /* : */
11+
"pCOLON2", /* :: */
12+
"pLBRACKET", /* [ */
13+
"pRBRACKET", /* ] */
14+
"pLBRACE", /* { */
15+
"pRBRACE", /* } */
16+
"pHAT", /* ^ */
17+
"pARROW", /* -> */
18+
"pFATARROW", /* => */
19+
"pCOMMA", /* , */
20+
"pBAR", /* | */
21+
"pAMP", /* & */
22+
"pSTAR", /* * */
23+
"pSTAR2", /* ** */
24+
"pDOT", /* . */
25+
"pDOT3", /* ... */
26+
"pBANG", /* ! */
27+
"pQUESTION", /* ? */
28+
"pLT", /* < */
29+
"pEQ", /* = */
30+
31+
"kALIAS", /* alias */
32+
"kATTRACCESSOR", /* attr_accessor */
33+
"kATTRREADER", /* attr_reader */
34+
"kATTRWRITER", /* attr_writer */
35+
"kBOOL", /* bool */
36+
"kBOT", /* bot */
37+
"kCLASS", /* class */
38+
"kDEF", /* def */
39+
"kEND", /* end */
40+
"kEXTEND", /* extend */
41+
"kFALSE", /* kFALSE */
42+
"kIN", /* in */
43+
"kINCLUDE", /* include */
44+
"kINSTANCE", /* instance */
45+
"kINTERFACE", /* interface */
46+
"kMODULE", /* module */
47+
"kNIL", /* nil */
48+
"kOUT", /* out */
49+
"kPREPEND", /* prepend */
50+
"kPRIVATE", /* private */
51+
"kPUBLIC", /* public */
52+
"kSELF", /* self */
53+
"kSINGLETON", /* singleton */
54+
"kTOP", /* top */
55+
"kTRUE", /* true */
56+
"kTYPE", /* type */
57+
"kUNCHECKED", /* unchecked */
58+
"kUNTYPED", /* untyped */
59+
"kVOID", /* void */
60+
"kUSE", /* use */
61+
"kAS", /* as */
62+
"k__TODO__", /* __todo__ */
63+
"kATRBS", /* @rbs */
64+
"kSKIP", /* skip */
65+
"kRETURN", /* return */
66+
67+
"tLIDENT", /* Identifiers starting with lower case */
68+
"tUIDENT", /* Identifiers starting with upper case */
69+
"tULIDENT", /* Identifiers starting with `_` */
7070
"tULLIDENT",
71-
"tGIDENT", /* Identifiers starting with `$` */
72-
"tAIDENT", /* Identifiers starting with `@` */
73-
"tA2IDENT", /* Identifiers starting with `@@` */
71+
"tGIDENT", /* Identifiers starting with `$` */
72+
"tAIDENT", /* Identifiers starting with `@` */
73+
"tA2IDENT", /* Identifiers starting with `@@` */
7474
"tBANGIDENT",
7575
"tEQIDENT",
76-
"tQIDENT", /* Quoted identifier */
77-
"pAREF_OPR", /* [] */
78-
"tOPERATOR", /* Operator identifier */
76+
"tQIDENT", /* Quoted identifier */
77+
"pAREF_OPR", /* [] */
78+
"tOPERATOR", /* Operator identifier */
7979

8080
"tCOMMENT",
8181
"tLINECOMMENT",
8282
"tINLINECOMMENT",
8383

8484
"tTRIVIA",
8585

86-
"tDQSTRING", /* Double quoted string */
87-
"tSQSTRING", /* Single quoted string */
88-
"tINTEGER", /* Integer */
89-
"tSYMBOL", /* Symbol */
86+
"tDQSTRING", /* Double quoted string */
87+
"tSQSTRING", /* Single quoted string */
88+
"tINTEGER", /* Integer */
89+
"tSYMBOL", /* Symbol */
9090
"tDQSYMBOL",
9191
"tSQSYMBOL",
92-
"tANNOTATION", /* Annotation */
92+
"tANNOTATION", /* Annotation */
9393
};
9494

9595
token NullToken = { NullType };
@@ -134,7 +134,7 @@ token next_token(lexstate *state, enum TokenType type) {
134134
}
135135

136136
token next_eof_token(lexstate *state) {
137-
if (state->current.byte_pos == RSTRING_LEN(state->string)+1) {
137+
if (state->current.byte_pos == RSTRING_LEN(state->string) + 1) {
138138
// End of String
139139
token t;
140140
t.type = pEOF;
@@ -168,7 +168,7 @@ void rbs_skip(lexstate *state) {
168168
}
169169

170170
void skipn(lexstate *state, size_t size) {
171-
for (size_t i = 0; i < size; i ++) {
171+
for (size_t i = 0; i < size; i++) {
172172
peek(state);
173173
rbs_skip(state);
174174
}

0 commit comments

Comments
 (0)