Skip to content

Commit 3073a22

Browse files
committed
Update contribution guidelines
1 parent 487fe9b commit 3073a22

File tree

2 files changed

+88
-81
lines changed

2 files changed

+88
-81
lines changed

CONTRIBUTING.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ Avoid lines longer than about 120 characters. When wrapping lines, follow these
2020
Use tabs for indentions, NOT spaces. This allows for tab length to be set by the client,
2121
and also allows for quicker backspacing if deleting indentation.
2222

23+
The following settings should be used in your IDE:
24+
25+
- Do not expand tabs to spaces
26+
- Number of spaces per indent should be 4
27+
- Tab size should be 4
28+
2329
* Brace style
2430
Braces should be on the same line as the statement.
2531
if(condition) {

src/main/java/com/laytonsmith/core/compiler/TokenStream.java

Lines changed: 82 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -12,97 +12,98 @@
1212
*/
1313
public class TokenStream extends LinkedList<Token> {
1414

15-
private FileOptions fileOptions;
16-
private String rawFileOptions;
15+
private FileOptions fileOptions;
16+
private String rawFileOptions;
1717

18-
public TokenStream() {
19-
super();
20-
this.fileOptions = null;
21-
}
18+
public TokenStream() {
19+
super();
20+
this.fileOptions = null;
21+
}
2222

23-
public TokenStream(List<Token> list, FileOptions options) {
24-
super(list);
25-
this.fileOptions = options;
26-
}
23+
public TokenStream(List<Token> list, FileOptions options) {
24+
super(list);
25+
this.fileOptions = options;
26+
}
2727

28-
public TokenStream(List<Token> list, String fileOptions) {
29-
super(list);
30-
this.fileOptions = parseFileOptions(fileOptions);
31-
}
28+
public TokenStream(List<Token> list, String fileOptions) {
29+
super(list);
30+
this.fileOptions = parseFileOptions(fileOptions);
31+
}
3232

33-
public void setFileOptions(String fileOptions) {
34-
this.rawFileOptions = fileOptions;
35-
this.fileOptions = parseFileOptions(fileOptions);
36-
}
33+
public void setFileOptions(String fileOptions) {
34+
this.rawFileOptions = fileOptions;
35+
this.fileOptions = parseFileOptions(fileOptions);
36+
}
3737

38-
public void setFileOptions(FileOptions fileOptions) {
39-
this.fileOptions = fileOptions;
40-
}
38+
public void setFileOptions(FileOptions fileOptions) {
39+
this.fileOptions = fileOptions;
40+
}
4141

42-
public FileOptions getFileOptions() {
43-
return this.fileOptions;
44-
}
42+
public FileOptions getFileOptions() {
43+
return this.fileOptions;
44+
}
4545

46-
/**
47-
* Returns the file options as they were originally passed in. This should only be used in special cases (syntax
48-
* highlighters, etc)
49-
* @return
50-
*/
51-
public String getRawFileOptions() {
52-
return rawFileOptions;
53-
}
46+
/**
47+
* Returns the file options as they were originally passed in. This should only be used in special cases (syntax
48+
* highlighters, etc)
49+
*
50+
* @return
51+
*/
52+
public String getRawFileOptions() {
53+
return rawFileOptions;
54+
}
5455

55-
private static FileOptions parseFileOptions(String options) {
56-
//Only ; needs escaping. Everything else is just trimmed, and added to the map.
57-
Map<String, String> map = new HashMap<String, String>();
58-
boolean inKey = true;
59-
StringBuilder buffer = new StringBuilder();
60-
String keyName = "";
61-
for (int i = 0; i < options.length(); i++) {
62-
Character c = options.charAt(i);
63-
Character c2 = null;
64-
if (i < options.length() - 1) {
65-
c2 = options.charAt(i + 1);
66-
}
67-
if (inKey) {
68-
if (c == ':') {
69-
keyName = buffer.toString();
70-
buffer = new StringBuilder();
71-
inKey = false;
72-
} else if (c == ';') {
73-
//Self closed
74-
map.put(buffer.toString().trim().toLowerCase(), "true");
75-
buffer = new StringBuilder();
76-
keyName = "";
77-
//We don't reset the inKey parameter
78-
} else {
79-
buffer.append(c);
56+
private static FileOptions parseFileOptions(String options) {
57+
//Only ; needs escaping. Everything else is just trimmed, and added to the map.
58+
Map<String, String> map = new HashMap<String, String>();
59+
boolean inKey = true;
60+
StringBuilder buffer = new StringBuilder();
61+
String keyName = "";
62+
for (int i = 0; i < options.length(); i++) {
63+
Character c = options.charAt(i);
64+
Character c2 = null;
65+
if (i < options.length() - 1) {
66+
c2 = options.charAt(i + 1);
67+
}
68+
if (inKey) {
69+
if (c == ':') {
70+
keyName = buffer.toString();
71+
buffer = new StringBuilder();
72+
inKey = false;
73+
} else if (c == ';') {
74+
//Self closed
75+
map.put(buffer.toString().trim().toLowerCase(), "true");
76+
buffer = new StringBuilder();
77+
keyName = "";
78+
//We don't reset the inKey parameter
79+
} else {
80+
buffer.append(c);
81+
}
82+
} else {
83+
if (c == '\\' && c2 == ';') {
84+
buffer.append(';');
85+
i++;
86+
} else if (c == ';') {
87+
//We're done
88+
inKey = true;
89+
map.put(keyName.trim().toLowerCase(), buffer.toString());
90+
buffer = new StringBuilder();
91+
} else {
92+
buffer.append(c);
93+
}
94+
}
8095
}
81-
} else {
82-
if (c == '\\' && c2 == ';') {
83-
buffer.append(';');
84-
i++;
85-
} else if (c == ';') {
86-
//We're done
87-
inKey = true;
88-
map.put(keyName.trim().toLowerCase(), buffer.toString());
89-
buffer = new StringBuilder();
90-
} else {
91-
buffer.append(c);
92-
}
93-
}
94-
}
95-
if (buffer.length() > 0) {
96-
if (!inKey) {
97-
map.put(keyName.trim().toLowerCase(), buffer.toString());
98-
} else {
99-
if (!buffer.toString().trim().isEmpty()) {
100-
map.put(buffer.toString().trim().toLowerCase(), "true");
96+
if (buffer.length() > 0) {
97+
if (!inKey) {
98+
map.put(keyName.trim().toLowerCase(), buffer.toString());
99+
} else {
100+
if (!buffer.toString().trim().isEmpty()) {
101+
map.put(buffer.toString().trim().toLowerCase(), "true");
102+
}
103+
}
101104
}
102-
}
105+
FileOptions fo = new FileOptions(map);
106+
return fo;
103107
}
104-
FileOptions fo = new FileOptions(map);
105-
return fo;
106-
}
107108

108109
}

0 commit comments

Comments
 (0)