Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use input_part_prefix to generate code properly #242

Merged
merged 1 commit into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ insert_space_around_operators = false

# global変数宣言時の接頭辞
global_prefix = ""
#input_part_prefix = "auto input = stdin.byLine.map!split.joiner;"
input_part_prefix = "auto input = stdin.byLine.map!split.joiner;"
newline_after_input = true

# ループ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ insert_space_around_operators = false

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

# ループ
[loop]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ insert_space_around_operators = false

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

# ループ
[loop]
Expand Down
2 changes: 0 additions & 2 deletions atcodertools/tools/templates/default_template.d
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ void solve({{ formal_arguments }}){
{% endif %}
// Generated by {{ atcodertools.version }} {{ atcodertools.url }} (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
auto input = stdin.byLine.map!split.joiner;

{% if prediction_success %}
{{ input_part }}
solve({{ actual_arguments }});
Expand Down
1 change: 0 additions & 1 deletion atcodertools/tools/templates/default_template.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class Main {

// Generated by {{ atcodertools.version }} {{ atcodertools.url }} (tips: You use the default template now. You can remove this line by using your custom template)
public static void main(String[] args) throws Exception {
final Scanner sc = new Scanner(System.in);
{% if prediction_success %}
{{ input_part }}
solve({{ actual_arguments }});
Expand Down
2 changes: 0 additions & 2 deletions atcodertools/tools/templates/default_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ fn solve({{ formal_arguments }}) {

// Generated by {{ atcodertools.version }} {{ atcodertools.url }} (tips: You use the default template now. You can remove this line by using your custom template)
fn main() {
let con = read_string();
let mut scanner = Scanner::new(&con);
{% if prediction_success %}
{{input_part}}
// In order to avoid potential stack overflow, spawn a new thread.
Expand Down
2 changes: 0 additions & 2 deletions tests/resources/test_codegen/template.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ void solve(${formal_arguments}){
}

int main(){
auto input = stdin.byLine.map!split.joiner;

${input_part}
solve(${actual_arguments});
return 0;
Expand Down
1 change: 0 additions & 1 deletion tests/resources/test_codegen/template.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

class Main {
public static void main(String[] args) throws Exception {
final Scanner sc = new Scanner(System.in);
${input_part}
solve(${actual_arguments});
}
Expand Down
2 changes: 0 additions & 2 deletions tests/resources/test_codegen/template.rust
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ fn solve(${formal_arguments}) {
}

fn main() {
let con = read_string();
let mut scanner = Scanner::new(&con);
${input_part}
solve(${actual_arguments});
}
Expand Down
2 changes: 0 additions & 2 deletions tests/resources/test_codegen/template_jinja.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ void solve({{ formal_arguments }}){

{% endif %}
int main(){
auto input = stdin.byLine.map!split.joiner;

{% if prediction_success %}
{{ input_part }}
solve({{ actual_arguments }});
Expand Down
1 change: 0 additions & 1 deletion tests/resources/test_codegen/template_jinja.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Main {
static final String NO = "{{ no_str }}";
{% endif %}
public static void main(String[] args) throws Exception {
final Scanner sc = new Scanner(System.in);
{{ input_part }}
solve({{ actual_arguments }});
}
Expand Down
2 changes: 0 additions & 2 deletions tests/resources/test_codegen/template_jinja.rust
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ fn solve({{ formal_arguments }}) {
{% endif %}

fn main() {
let con = read_string();
let mut scanner = Scanner::new(&con);
{% if prediction_success %}
{{input_part}}
solve({{ actual_arguments }});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ void solve({{ formal_arguments }}){

{% endif %}
int main(){
auto input = stdin.byLine.map!split.joiner;

{% if prediction_success %}
{{ input_part }}
solve({{ actual_arguments }});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class Main {
{% endif %}

public static void main(String[] args) throws Exception {
final Scanner sc = new Scanner(System.in);
{% if prediction_success %}
{{ input_part }}
solve({{ actual_arguments }});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ fn solve({{ formal_arguments }}) {
{% endif %}

fn main() {
let con = read_string();
let mut scanner = Scanner::new(&con);
{% if prediction_success %}
{{input_part}}
// In order to avoid potential stack overflow, spawn a new thread.
Expand Down