Skip to content

Commit 949428c

Browse files
authored
use input_part_prefix to generate code properly (kyuridenamida#242)
1 parent a6b6cd4 commit 949428c

File tree

15 files changed

+3
-23
lines changed

15 files changed

+3
-23
lines changed

atcodertools/codegen/code_generators/universal_generator/d.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ insert_space_around_operators = false
33

44
# global変数宣言時の接頭辞
55
global_prefix = ""
6-
#input_part_prefix = "auto input = stdin.byLine.map!split.joiner;"
6+
input_part_prefix = "auto input = stdin.byLine.map!split.joiner;"
77
newline_after_input = true
88

99
# ループ

atcodertools/codegen/code_generators/universal_generator/java.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ insert_space_around_operators = false
33

44
# global変数宣言時の接頭辞
55
global_prefix = "static "
6-
#input_part_prefix = "final Scanner sc = new Scanner(System.in);"
6+
input_part_prefix = "final Scanner sc = new Scanner(System.in);"
77

88
# ループ
99
[loop]

atcodertools/codegen/code_generators/universal_generator/rust.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ insert_space_around_operators = false
33

44
# global変数宣言時の接頭辞
55
global_prefix = ""
6-
#input_part_prefix = "let con = read_string();\nlet mut scanner = Scanner::new(&con);"
6+
input_part_prefix = "let con = read_string();\nlet mut scanner = Scanner::new(&con);"
77

88
# ループ
99
[loop]

atcodertools/tools/templates/default_template.d

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ void solve({{ formal_arguments }}){
2525
{% endif %}
2626
// Generated by {{ atcodertools.version }} {{ atcodertools.url }} (tips: You use the default template now. You can remove this line by using your custom template)
2727
int main(){
28-
auto input = stdin.byLine.map!split.joiner;
29-
3028
{% if prediction_success %}
3129
{{ input_part }}
3230
solve({{ actual_arguments }});

atcodertools/tools/templates/default_template.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class Main {
1414

1515
// Generated by {{ atcodertools.version }} {{ atcodertools.url }} (tips: You use the default template now. You can remove this line by using your custom template)
1616
public static void main(String[] args) throws Exception {
17-
final Scanner sc = new Scanner(System.in);
1817
{% if prediction_success %}
1918
{{ input_part }}
2019
solve({{ actual_arguments }});

atcodertools/tools/templates/default_template.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ fn solve({{ formal_arguments }}) {
1818

1919
// Generated by {{ atcodertools.version }} {{ atcodertools.url }} (tips: You use the default template now. You can remove this line by using your custom template)
2020
fn main() {
21-
let con = read_string();
22-
let mut scanner = Scanner::new(&con);
2321
{% if prediction_success %}
2422
{{input_part}}
2523
// In order to avoid potential stack overflow, spawn a new thread.

tests/resources/test_codegen/template.d

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ void solve(${formal_arguments}){
88
}
99

1010
int main(){
11-
auto input = stdin.byLine.map!split.joiner;
12-
1311
${input_part}
1412
solve(${actual_arguments});
1513
return 0;

tests/resources/test_codegen/template.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
class Main {
55
public static void main(String[] args) throws Exception {
6-
final Scanner sc = new Scanner(System.in);
76
${input_part}
87
solve(${actual_arguments});
98
}

tests/resources/test_codegen/template.rust

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ fn solve(${formal_arguments}) {
55
}
66

77
fn main() {
8-
let con = read_string();
9-
let mut scanner = Scanner::new(&con);
108
${input_part}
119
solve(${actual_arguments});
1210
}

tests/resources/test_codegen/template_jinja.d

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ void solve({{ formal_arguments }}){
2424

2525
{% endif %}
2626
int main(){
27-
auto input = stdin.byLine.map!split.joiner;
28-
2927
{% if prediction_success %}
3028
{{ input_part }}
3129
solve({{ actual_arguments }});

0 commit comments

Comments
 (0)