summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/analysis/SourceIndex.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuchaz/enigma/analysis/SourceIndex.java')
-rw-r--r--src/cuchaz/enigma/analysis/SourceIndex.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cuchaz/enigma/analysis/SourceIndex.java b/src/cuchaz/enigma/analysis/SourceIndex.java
index b3fb751..8f751ef 100644
--- a/src/cuchaz/enigma/analysis/SourceIndex.java
+++ b/src/cuchaz/enigma/analysis/SourceIndex.java
@@ -32,9 +32,15 @@ public class SourceIndex {
32 private Multimap<EntryReference<Entry,Entry>,Token> m_referenceToTokens; 32 private Multimap<EntryReference<Entry,Entry>,Token> m_referenceToTokens;
33 private Map<Entry,Token> m_declarationToToken; 33 private Map<Entry,Token> m_declarationToToken;
34 private List<Integer> m_lineOffsets; 34 private List<Integer> m_lineOffsets;
35 private boolean m_ignoreBadTokens;
35 36
36 public SourceIndex(String source) { 37 public SourceIndex(String source) {
38 this(source, true);
39 }
40
41 public SourceIndex(String source, boolean ignoreBadTokens) {
37 m_source = source; 42 m_source = source;
43 m_ignoreBadTokens = ignoreBadTokens;
38 m_tokenToReference = Maps.newTreeMap(); 44 m_tokenToReference = Maps.newTreeMap();
39 m_referenceToTokens = HashMultimap.create(); 45 m_referenceToTokens = HashMultimap.create();
40 m_declarationToToken = Maps.newHashMap(); 46 m_declarationToToken = Maps.newHashMap();
@@ -83,7 +89,7 @@ public class SourceIndex {
83 // System.out.println( String.format( "%s \"%s\" region: %s", node.getNodeType(), name, region ) ); 89 // System.out.println( String.format( "%s \"%s\" region: %s", node.getNodeType(), name, region ) );
84 90
85 // if the token has a $ in it, something's wrong. Ignore this token 91 // if the token has a $ in it, something's wrong. Ignore this token
86 if (name.lastIndexOf('$') >= 0) { 92 if (name.lastIndexOf('$') >= 0 && m_ignoreBadTokens) {
87 // DEBUG 93 // DEBUG
88 System.err.println(String.format("WARNING: %s \"%s\" is probably a bad token. It was ignored", node.getNodeType(), name)); 94 System.err.println(String.format("WARNING: %s \"%s\" is probably a bad token. It was ignored", node.getNodeType(), name));
89 return null; 95 return null;