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.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cuchaz/enigma/analysis/SourceIndex.java b/src/cuchaz/enigma/analysis/SourceIndex.java
index 398a50d..7981f87 100644
--- a/src/cuchaz/enigma/analysis/SourceIndex.java
+++ b/src/cuchaz/enigma/analysis/SourceIndex.java
@@ -57,10 +57,24 @@ public class SourceIndex
57 { 57 {
58 throw new IllegalArgumentException( "Invalid region: " + region ); 58 throw new IllegalArgumentException( "Invalid region: " + region );
59 } 59 }
60 return new Token( 60 Token token = new Token(
61 toPos( region.getBeginLine(), region.getBeginColumn() ), 61 toPos( region.getBeginLine(), region.getBeginColumn() ),
62 toPos( region.getEndLine(), region.getEndColumn() ) 62 toPos( region.getEndLine(), region.getEndColumn() )
63 ); 63 );
64
65 // HACKHACK: sometimes node regions are off by one
66 // I think this is a bug in Procyon, but it's easy to work around
67 if( !Character.isJavaIdentifierStart( m_source.charAt( token.start ) ) )
68 {
69 token.start++;
70 token.end++;
71 if( !Character.isJavaIdentifierStart( m_source.charAt( token.start ) ) )
72 {
73 throw new IllegalArgumentException( "Region " + region + " does not describe valid token: '" + m_source.substring( token.start, token.end ) + "'" );
74 }
75 }
76
77 return token;
64 } 78 }
65 79
66 public void add( AstNode node, Entry entry ) 80 public void add( AstNode node, Entry entry )