Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,137 changes: 584 additions & 553 deletions javascript/extractor/src/com/semmle/jcorn/CustomParser.java

Large diffs are not rendered by default.

904 changes: 451 additions & 453 deletions javascript/extractor/src/com/semmle/jcorn/ESNextParser.java

Large diffs are not rendered by default.

251 changes: 145 additions & 106 deletions javascript/extractor/src/com/semmle/jcorn/Identifiers.java

Large diffs are not rendered by default.

37 changes: 17 additions & 20 deletions javascript/extractor/src/com/semmle/jcorn/Locutil.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
package com.semmle.jcorn;

import java.util.regex.Matcher;

import com.semmle.js.ast.Position;
import java.util.regex.Matcher;

/// locutil.js
public class Locutil {
/**
* The `getLineInfo` function is mostly useful when the
* `locations` option is off (for performance reasons) and you
* want to find the line/column position for a given character
* offset. `input` should be the code string that the offset refers
* into.
*/
public static Position getLineInfo(String input, int offset) {
Matcher lineBreakG = Whitespace.lineBreakG.matcher(input);
for (int line = 1, cur = 0;;) {
if (lineBreakG.find(cur) && lineBreakG.start() < offset) {
++line;
cur = lineBreakG.end();
} else {
return new Position(line, offset - cur, offset);
}
}
}
/**
* The `getLineInfo` function is mostly useful when the `locations` option is off (for performance
* reasons) and you want to find the line/column position for a given character offset. `input`
* should be the code string that the offset refers into.
*/
public static Position getLineInfo(String input, int offset) {
Matcher lineBreakG = Whitespace.lineBreakG.matcher(input);
for (int line = 1, cur = 0; ; ) {
if (lineBreakG.find(cur) && lineBreakG.start() < offset) {
++line;
cur = lineBreakG.end();
} else {
return new Position(line, offset - cur, offset);
}
}
}
}
Loading