@@ -45,6 +45,8 @@ public class PdeKeywords {
45
45
46
46
private static final Map <String , Integer > KNOWN_TOKEN_TYPES = new HashMap <>();
47
47
private static final Pattern ALPHA = Pattern .compile ("\\ w" );
48
+
49
+ private boolean needReload = true ;
48
50
49
51
static {
50
52
KNOWN_TOKEN_TYPES .put ("RESERVED_WORD" , TokenTypes .RESERVED_WORD );
@@ -99,6 +101,23 @@ public void reload() {
99
101
Base .showError ("Problem loading keywords" , "Could not load keywords.txt,\n please re-install Arduino." , e );
100
102
System .exit (1 );
101
103
}
104
+
105
+ needReload = false ;
106
+ }
107
+
108
+ public boolean reloadIfNeed () {
109
+
110
+ if (needReload ) {
111
+ reload ();
112
+ return true ;
113
+ }else {
114
+ return false ;
115
+ }
116
+
117
+ }
118
+
119
+ public void setNeedReload (boolean needReload ) {
120
+ this .needReload = needReload ;
102
121
}
103
122
104
123
private void parseKeywordsTxt (File input ) throws Exception {
@@ -129,6 +148,7 @@ private void parseKeywordsTxt(File input) throws Exception {
129
148
if (pieces .length >= 3 ) {
130
149
parseHTMLReferenceFileName (pieces [2 ], keyword );
131
150
}
151
+
132
152
if (pieces .length >= 4 ) {
133
153
parseRSyntaxTextAreaTokenType (pieces [3 ], keyword );
134
154
}
@@ -173,9 +193,11 @@ private void parseRSyntaxTextAreaTokenType(String tokenTypeAsString, String keyw
173
193
}
174
194
175
195
private void parseHTMLReferenceFileName (String piece , String keyword ) {
176
- String htmlFilename = piece .trim ();
177
- if (htmlFilename .length () > 0 ) {
178
- keywordToReference .put (keyword , htmlFilename );
196
+ if (piece != null && keyword != null && !piece .isEmpty ()) {
197
+ String htmlFilename = piece .trim ();
198
+ if (htmlFilename .length () > 0 ) {
199
+ keywordToReference .put (keyword , htmlFilename );
200
+ }
179
201
}
180
202
}
181
203
0 commit comments