@@ -57,8 +57,6 @@ public boolean checkForMatch(char currentByte, int index, int endPoint, String[]
5757 }
5858
5959 public boolean checkForMatchSingle (char currentByte , int index , int endPoint , String match , String content ) {
60-
61-
6260 if (match .length () != 0 && currentByte == match .charAt (0 )) { // If the first character matches
6361 boolean potentialMatch = true ;
6462
@@ -99,27 +97,6 @@ public String checkForMatchMultiOpen(char currentByte, int index, int endPoint,
9997 return null ;
10098 }
10199
102- public boolean checkForMatchMultiClose (char currentByte , int index , int endPoint , String [][] matches , String content ) {
103- for (int i = 0 ; i < matches .length ; i ++) { // For each match
104- if (currentByte == matches [i ][1 ].charAt (0 )) { // If the first character matches
105- boolean potentialMatch = true ;
106-
107- for (int j = 0 ; j < matches [i ][1 ].length (); j ++) { // Check if the rest match
108- if (index + j <= endPoint && matches [i ][1 ].charAt (j ) != content .charAt (index + j )) {
109- potentialMatch = false ;
110- break ;
111- }
112- }
113-
114- if (potentialMatch ) {
115- return true ;
116- }
117- }
118- }
119-
120- return false ;
121- }
122-
123100 public boolean isWhitespace (char currentByte ) {
124101 if (currentByte != ' ' && currentByte != '\t' && currentByte != '\n' && currentByte != '\r' ) {
125102 return false ;
@@ -129,12 +106,8 @@ public boolean isWhitespace(char currentByte) {
129106 }
130107
131108 /**
132- * Reimplementation of scc https://github.com/boyter/scc/ ported from
109+ * Reimplementation of scc https://github.com/boyter/scc/ 1.9.0 ported from
133110 * Go into Java and specific for the searchcode project.
134- *
135- * NB this does not perform the jump ahead portion of the scc where bytes
136- * already looked at are jumped in order to make it simpler to understand
137- * which means it is probably slower than the Go version.
138111 */
139112 public SlocCount countStats (String contents , String languageName ) {
140113 if (contents == null || contents .isEmpty ()) {
@@ -201,6 +174,7 @@ public SlocCount countStats(String contents, String languageName) {
201174 }
202175
203176 if (this .checkForMatchSingle (contents .charAt (index ), index , endPoint , endComments .get (endComments .size ()-1 ), contents )) {
177+ index += endComments .get (endComments .size ()-1 ).length () - 1 ;
204178 endComments .remove (endComments .size ()-1 );
205179
206180 if (endComments .size () == 0 ) {
0 commit comments