Skip to content

Commit c79d72f

Browse files
Create LICENSE.md (#8)
* Create LICENSE.md Added license. * Changed outputted Decklist format * Added a license This JAR is outdated, as newer versions have a license. So license was added. * Added License Source files now have licenses. Also renamed the notes file. Pull request was exceptionally self approved due to simplicity.
1 parent 9a6be40 commit c79d72f

25 files changed

+2171
-1137
lines changed

LICENSE.md

Lines changed: 675 additions & 0 deletions
Large diffs are not rendered by default.
12.2 KB
Binary file not shown.
File renamed without changes.

parser/EmptySemanticStackException.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright (C) 2021 Gabriel Toban Harris
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
117
package parser;
218

319
/**

parser/Lexeme_Types.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright (C) 2021 Gabriel Toban Harris
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
117
package parser;
218

319
/**

parser/Returned_Data.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright (C) 2021 Gabriel Toban Harris
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
117
package parser;
218

319
import java.util.Scanner;

parser/Semantic_Actions.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright (C) 2021 Gabriel Toban Harris
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
117
package parser;
218

319
/**

parser/Token.java

Lines changed: 90 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,90 @@
1-
package parser;
2-
3-
/**
4-
<b>
5-
Purpose: Types of Tokens to be created by {@link Tokenizer}.<br>
6-
Programmer: Gabriel Toban Harris <br>
7-
Date: 2021-07-26/2021-7-30/2021-8-23
8-
</b>
9-
*/
10-
11-
public class Token
12-
{
13-
/**
14-
* Type of Token this is.
15-
*/
16-
public final Lexeme_Types TYPE;
17-
18-
/**
19-
* Location of token in source file.
20-
*/
21-
public final long LINE_NUMBER;
22-
23-
/**
24-
* The value of the token.
25-
*/
26-
public final String LEXEME;
27-
28-
/**
29-
* Constructor of Token.
30-
*
31-
* @param TYPE of LEXEME
32-
* @param LINE_NUMBER location in source file
33-
* @param LEXEME content of lexeme which is then trimmed by {@link String#trim()}
34-
*/
35-
public Token(final Lexeme_Types TYPE, final long LINE_NUMBER, final String LEXEME)
36-
{
37-
this.TYPE = TYPE;
38-
this.LINE_NUMBER = LINE_NUMBER;
39-
this.LEXEME = LEXEME.trim();
40-
}
41-
42-
//getters
43-
/**
44-
* @return the {@link #TYPE}
45-
*/
46-
public Lexeme_Types get_type()
47-
{
48-
return this.TYPE;
49-
}
50-
51-
/**
52-
* @return the {@link #LINE_NUMBER}
53-
*/
54-
public long get_line_number()
55-
{
56-
return this.LINE_NUMBER;
57-
}
58-
59-
/**
60-
* @return the {@link #LEXEME}
61-
*/
62-
public String get_lexeme()
63-
{
64-
return this.LEXEME;
65-
}
66-
67-
/*
68-
* String version of class.
69-
*/
70-
public String toString()
71-
{
72-
return "[Lexeme type: " + this.get_type() + ", lexeme: " + get_lexeme() + ", line number: " + this.get_line_number() + "]";
73-
}
74-
}
1+
/*
2+
Copyright (C) 2021 Gabriel Toban Harris
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package parser;
18+
19+
/**
20+
<b>
21+
Purpose: Types of Tokens to be created by {@link Tokenizer}.<br>
22+
Programmer: Gabriel Toban Harris <br>
23+
Date: 2021-07-26/2021-7-30/2021-8-23
24+
</b>
25+
*/
26+
27+
public class Token
28+
{
29+
/**
30+
* Type of Token this is.
31+
*/
32+
public final Lexeme_Types TYPE;
33+
34+
/**
35+
* Location of token in source file.
36+
*/
37+
public final long LINE_NUMBER;
38+
39+
/**
40+
* The value of the token.
41+
*/
42+
public final String LEXEME;
43+
44+
/**
45+
* Constructor of Token.
46+
*
47+
* @param TYPE of LEXEME
48+
* @param LINE_NUMBER location in source file
49+
* @param LEXEME content of lexeme which is then trimmed by {@link String#trim()}
50+
*/
51+
public Token(final Lexeme_Types TYPE, final long LINE_NUMBER, final String LEXEME)
52+
{
53+
this.TYPE = TYPE;
54+
this.LINE_NUMBER = LINE_NUMBER;
55+
this.LEXEME = LEXEME.trim();
56+
}
57+
58+
//getters
59+
/**
60+
* @return the {@link #TYPE}
61+
*/
62+
public Lexeme_Types get_type()
63+
{
64+
return this.TYPE;
65+
}
66+
67+
/**
68+
* @return the {@link #LINE_NUMBER}
69+
*/
70+
public long get_line_number()
71+
{
72+
return this.LINE_NUMBER;
73+
}
74+
75+
/**
76+
* @return the {@link #LEXEME}
77+
*/
78+
public String get_lexeme()
79+
{
80+
return this.LEXEME;
81+
}
82+
83+
/*
84+
* String version of class.
85+
*/
86+
public String toString()
87+
{
88+
return "[Lexeme type: " + this.get_type() + ", lexeme: " + get_lexeme() + ", line number: " + this.get_line_number() + "]";
89+
}
90+
}

parser/Tokenizer.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright (C) 2021 Gabriel Toban Harris
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
117
package parser;
218

319
import java.util.Scanner;

parser/Tree_Assembler.java

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright (C) 2021 Gabriel Toban Harris
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
117
package parser;
218

319
import java.io.File;
@@ -22,7 +38,7 @@
2238
<b>
2339
Purpose: assembles the parts of a configuration file for simulating.<br>
2440
Programmer: Gabriel Toban Harris<br>
25-
Date: 2021-08-[4, 5]/2021-8-[7, 13]/2021-8-17/2021-8-19/2021-8-[22, 23]
41+
Date: 2021-08-[4, 5]/2021-8-[7, 13]/2021-8-17/2021-8-19/2021-8-[22, 23]/2021-11-14
2642
</b>
2743
*/
2844

@@ -1226,11 +1242,19 @@ public void print_out_decklist(final String PARTIAL_OUTPUT_DIRECTORY)
12261242
final File OUTPUT_FILE = Starting_Point.add_file_extension(true, Starting_Point.DECKLIST_EXTENSION, PARTIAL_OUTPUT_DIRECTORY);
12271243
try
12281244
{
1229-
OUTPUT_FILE.createNewFile();
1245+
OUTPUT_FILE.createNewFile(); //Try creating file first before bothering to assemble its contents.
1246+
1247+
final StringBuilder ASSEMBLE_DECKLIST = new StringBuilder("deck list:\n{\n");
1248+
for (Base_Card card : this.DECK)
1249+
{
1250+
ASSEMBLE_DECKLIST.append(card.NAME);
1251+
ASSEMBLE_DECKLIST.append(";\n");
1252+
}
1253+
ASSEMBLE_DECKLIST.append("}\n\n");
1254+
12301255
try (final PrintWriter DECKLIST_OUTPUT = new PrintWriter(OUTPUT_FILE))
12311256
{
1232-
for (Deck_Card card : this.DECK)
1233-
DECKLIST_OUTPUT.println(card);
1257+
DECKLIST_OUTPUT.print(ASSEMBLE_DECKLIST.toString());
12341258
}
12351259
}
12361260
catch (IOException ex)

0 commit comments

Comments
 (0)