Skip to content
This repository was archived by the owner on Oct 3, 2021. It is now read-only.

Commit 0d00e9c

Browse files
committed
Update the spelling of variables and classes to CamelCase
1 parent 47af595 commit 0d00e9c

File tree

4 files changed

+81
-81
lines changed

4 files changed

+81
-81
lines changed

java/java-ranger-regression/printtokens_eqchk/impl/printTokens2.java renamed to java/java-ranger-regression/printtokens_eqchk/impl/PrintTokens2.java

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import java.io.IOException;
22

3-
public class printTokens2 {
3+
public class PrintTokens2 {
44

55
public static char[] buffer = new char[81];
66
public static int output = 0;
77

88
public static final int error = 0;
99
public static final int keyword = 1;
10-
public static final int spec_symbol = 2;
10+
public static final int specSymbol = 2;
1111
public static final int identifier = 3;
12-
public static final int num_constant = 41;
13-
public static final int str_constant = 42;
14-
public static final int char_constant = 43;
12+
public static final int numConstant = 41;
13+
public static final int strConstant = 42;
14+
public static final int charConstant = 43;
1515
public static final int comment = 5;
1616
public static final int end = 6;
1717

@@ -30,16 +30,16 @@ public static void mainProcess(char i0, char i1, char i2,
3030
str[5] = i5;
3131
str[6] = i6;
3232
str[7] = i7;
33-
token_stream tp = open_token_stream(str);
33+
TokenStream tp = openTokenStream(str);
3434
boolean continueIndex = false;
3535
while(!continueIndex) {
36-
char[] token = get_token(tp);
37-
print_token(token);
38-
continueIndex = is_end_token(tp);
36+
char[] token = getToken(tp);
37+
printToken(token);
38+
continueIndex = isEndToken(tp);
3939
}
4040
}
4141

42-
private static boolean is_end_token(token_stream tp) {
42+
private static boolean isEndToken(TokenStream tp) {
4343
try {
4444
boolean eof = tp.EOFStream();
4545
return eof;
@@ -50,11 +50,11 @@ private static boolean is_end_token(token_stream tp) {
5050
return false;
5151
}
5252

53-
private static void print_token(char[] token) {
54-
int type = token_type(token);
55-
if(type == spec_symbol) {
56-
print_spec_symbol(token);
57-
output += spec_symbol;
53+
private static void printToken(char[] token) {
54+
int type = tokenType(token);
55+
if(type == specSymbol) {
56+
printSpecSymbol(token);
57+
output += specSymbol;
5858
}
5959
else if(type == error) {
6060
System.out.print("error, \"");
@@ -75,31 +75,31 @@ else if(type == identifier) {
7575
System.out.print("\".\n");
7676
output += identifier;
7777
}
78-
else if(type == num_constant) {
78+
else if(type == numConstant) {
7979
System.out.print("numeric,");
8080
System.out.print(token);
8181
System.out.print(".\n");
82-
output += num_constant;
82+
output += numConstant;
8383
}
84-
else if(type == str_constant) {
84+
else if(type == strConstant) {
8585
System.out.print("string,");
8686
System.out.print(token);
8787
System.out.print(".\n");
88-
output += str_constant;
88+
output += strConstant;
8989
}
90-
else if(type == char_constant) {
90+
else if(type == charConstant) {
9191
System.out.print("character, \"");
9292
System.out.print(token);
9393
System.out.print("\".\n");
94-
output += char_constant;
94+
output += charConstant;
9595
}
9696
else if(type == end) {
9797
System.out.print("eof.\n");
9898
output += end;
9999
}
100100
}
101101

102-
private static void print_spec_symbol(char[] token) {
102+
private static void printSpecSymbol(char[] token) {
103103
if(token[0] == '(') {
104104
System.out.println("lparen.");
105105
}
@@ -123,43 +123,43 @@ else if(token[0] == '`') {
123123
}
124124
}
125125

126-
private static int token_type(char[] token) {
127-
boolean _spec_symbol = is_spec_symbol(token);
128-
if(_spec_symbol) {
129-
return spec_symbol;
126+
private static int tokenType(char[] token) {
127+
boolean _specSymbol = isSpecSymbol(token);
128+
if(_specSymbol) {
129+
return specSymbol;
130130
}
131-
boolean _keyword = is_keyword(token);
131+
boolean _keyword = isKeyword(token);
132132
if(_keyword) {
133133
return keyword;
134134
}
135-
boolean _identifier = is_identifier(token);
135+
boolean _identifier = isIdentifier(token);
136136
if(_identifier) {
137137
return identifier;
138138
}
139-
boolean _num_constant = is_num_constant(token);
140-
if(_num_constant) {
141-
return num_constant;
139+
boolean _numConstant = isNumConstant(token);
140+
if(_numConstant) {
141+
return numConstant;
142142
}
143-
boolean _str_constant = is_str_constant(token);
144-
if(_str_constant) {
145-
return str_constant;
143+
boolean _strConstant = isStrConstant(token);
144+
if(_strConstant) {
145+
return strConstant;
146146
}
147-
boolean _char_constant = is_char_constant(token);
148-
if(_char_constant) {
149-
return char_constant;
147+
boolean _charConstant = isCharConstant(token);
148+
if(_charConstant) {
149+
return charConstant;
150150
}
151-
boolean _comment = is_comment(token);
151+
boolean _comment = isComment(token);
152152
if(_comment) {
153153
return comment;
154154
}
155-
boolean _eof_token = is_eof_token(token);
155+
boolean _eof_token = isEOFToken(token);
156156
if(_eof_token) {
157157
return end;
158158
}
159159
return error;
160160
}
161161

162-
private static boolean is_comment(char[] token) {
162+
private static boolean isComment(char[] token) {
163163
if(token[0] == 59) {
164164
return true;
165165
}
@@ -168,7 +168,7 @@ private static boolean is_comment(char[] token) {
168168
}
169169
}
170170

171-
private static boolean is_char_constant(char[] token) {
171+
private static boolean isCharConstant(char[] token) {
172172
if(token[0] == '#') {
173173
char ch = token[1];
174174
boolean _isalpha = isalpha(ch);
@@ -184,7 +184,7 @@ private static boolean is_char_constant(char[] token) {
184184
}
185185
}
186186

187-
private static boolean is_str_constant(char[] token) {
187+
private static boolean isStrConstant(char[] token) {
188188
int i = 1;
189189
if(token[0] == '"') {
190190
while(token[i] != '\0') {
@@ -202,7 +202,7 @@ private static boolean is_str_constant(char[] token) {
202202
}
203203
}
204204

205-
private static boolean is_num_constant(char[] token) {
205+
private static boolean isNumConstant(char[] token) {
206206
int i = 1;
207207
char ch = token[0];
208208
boolean _isdigit = isdigit(ch);
@@ -224,7 +224,7 @@ private static boolean is_num_constant(char[] token) {
224224
}
225225
}
226226

227-
private static boolean is_keyword(char[] token) {
227+
private static boolean isKeyword(char[] token) {
228228
if(token[0] == 'a') {
229229
if(token[1] == 'n') {
230230
if(token[2] == 'd') {
@@ -273,7 +273,7 @@ else if(token[0] == '=') {
273273
return false;
274274
}
275275

276-
private static boolean is_identifier(char[] token) {
276+
private static boolean isIdentifier(char[] token) {
277277
int i = 1;
278278
char ch = token[0];
279279
boolean _isalpha = isalpha(ch);
@@ -301,7 +301,7 @@ private static boolean is_identifier(char[] token) {
301301
}
302302
}
303303

304-
private static char[] get_token(token_stream tp) {
304+
private static char[] getToken(TokenStream tp) {
305305
char[] ch1 = new char[2];
306306
ch1[0] = '\0';
307307
ch1[1] = '\0';
@@ -310,7 +310,7 @@ private static char[] get_token(token_stream tp) {
310310
j = j + 1;
311311
}
312312

313-
char ch = get_char(tp);
313+
char ch = getChar(tp);
314314
boolean continueIndex = false;
315315
if(ch == ' ') {
316316
continueIndex = true;
@@ -319,7 +319,7 @@ else if(ch == '\n') {
319319
continueIndex = true;
320320
}
321321
while(continueIndex) {
322-
ch = get_char(tp);
322+
ch = getChar(tp);
323323
continueIndex = false;
324324
if(ch == ' ') {
325325
continueIndex = true;
@@ -330,12 +330,12 @@ else if(ch == '\n') {
330330
}
331331
int i = 0;
332332
buffer[i] = ch;
333-
boolean _is_eof_token = is_eof_token(buffer);
334-
if(_is_eof_token) {
333+
boolean _isEOFToken = isEOFToken(buffer);
334+
if(_isEOFToken) {
335335
return buffer;
336336
}
337-
boolean _is_spec_symbol = is_spec_symbol(buffer);
338-
if(_is_spec_symbol) {
337+
boolean _isSpecSymbol = isSpecSymbol(buffer);
338+
if(_isSpecSymbol) {
339339
return buffer;
340340
}
341341
int id = 0;
@@ -346,29 +346,29 @@ else if(ch == 59) {
346346
id = 2;
347347
}
348348

349-
ch = get_char(tp);
350-
continueIndex = is_token_end(id, ch);
349+
ch = getChar(tp);
350+
continueIndex = isTokenEnd(id, ch);
351351
while(!continueIndex) {
352352
i = i + 1;
353353
if(i <= 80){
354354
buffer[i] = ch;
355355
}
356-
ch = get_char(tp);
357-
continueIndex = is_token_end(id, ch);
356+
ch = getChar(tp);
357+
continueIndex = isTokenEnd(id, ch);
358358
}
359359

360360
ch1[0] = ch;
361361

362-
_is_eof_token = is_eof_token(ch1);
363-
if(_is_eof_token) {
364-
ch = unget_char(ch, tp);
362+
_isEOFToken = isEOFToken(ch1);
363+
if(_isEOFToken) {
364+
ch = ungetChar(ch, tp);
365365
return buffer;
366366
}
367367
else {
368368

369-
_is_spec_symbol = is_spec_symbol(ch1);
370-
if(_is_spec_symbol) {
371-
ch = unget_char(ch, tp);
369+
_isSpecSymbol = isSpecSymbol(ch1);
370+
if(_isSpecSymbol) {
371+
ch = ungetChar(ch, tp);
372372
return buffer;
373373
}
374374
}
@@ -383,7 +383,7 @@ else if(ch == 59) {
383383

384384
else if(id == 0) {
385385
if(ch == 59) {
386-
ch = unget_char(ch, tp);
386+
ch = ungetChar(ch, tp);
387387
return buffer;
388388
}
389389
}
@@ -426,26 +426,26 @@ private static boolean isalpha(char ch) {
426426
}
427427
}
428428

429-
private static char unget_char(char ch, token_stream tp) {
429+
private static char ungetChar(char ch, TokenStream tp) {
430430
try {
431431
tp.unreader(ch);
432432
}
433433
catch(IOException e) {
434-
System.out.println("unget_char error!");
434+
System.out.println("ungetChar error!");
435435
}
436436
return ch;
437437
}
438438
/*
439439
*
440440
*
441441
*/
442-
private static boolean is_token_end(int id, char ch) {
442+
private static boolean isTokenEnd(int id, char ch) {
443443
char[] ch1 = new char[2];
444444
ch1[0] = ch;
445445
ch1[1] = '\0';
446446

447-
boolean _is_eof_token = is_eof_token(ch1);
448-
if(_is_eof_token) {
447+
boolean _isEOFToken = isEOFToken(ch1);
448+
if(_isEOFToken) {
449449
return true;
450450
}
451451

@@ -470,8 +470,8 @@ else if(id == 2) {
470470
}
471471
}
472472

473-
boolean _is_spec_symbol = is_spec_symbol(ch1);
474-
if(_is_spec_symbol) {
473+
boolean _isSpecSymbol = isSpecSymbol(ch1);
474+
if(_isSpecSymbol) {
475475
return true;
476476
}
477477
else if(ch == ' ') {
@@ -489,7 +489,7 @@ else if(ch == 59) {
489489

490490
}
491491

492-
private static boolean is_spec_symbol(char[] token) {
492+
private static boolean isSpecSymbol(char[] token) {
493493
if(token[0] == '(') {
494494
return true;
495495
}
@@ -516,7 +516,7 @@ else if(token[0] == ',') {
516516
}
517517
}
518518

519-
private static boolean is_eof_token(char[] token) {
519+
private static boolean isEOFToken(char[] token) {
520520
if(token[0] == '\0') {
521521
return true;
522522
}
@@ -525,20 +525,20 @@ private static boolean is_eof_token(char[] token) {
525525
}
526526
}
527527

528-
private static char get_char(token_stream tp) {
528+
private static char getChar(TokenStream tp) {
529529
try {
530530
char ch = tp.read();
531531
return ch;
532532
}
533533
catch(IOException e) {
534-
System.out.println("get_char error");
534+
System.out.println("getChar error");
535535
}
536536
return '\0';
537537
}
538538

539-
private static token_stream open_token_stream(char[] str) {
539+
private static TokenStream openTokenStream(char[] str) {
540540
IntReader intReader = new IntReader(str);
541-
token_stream stream_ptr = new token_stream(intReader);
542-
return stream_ptr;
541+
TokenStream streamPtr = new TokenStream(intReader);
542+
return streamPtr;
543543
}
544544
}

0 commit comments

Comments
 (0)