File tree Expand file tree Collapse file tree 3 files changed +14
-12
lines changed Expand file tree Collapse file tree 3 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 33 */
44
55private import codeql.regex.RegexTreeView
6+ private import codeql.util.Numbers
67
78/**
89 * Classes and predicates that create an NFA and various algorithms for working with it.
@@ -1330,18 +1331,6 @@ module Make<RegexTreeViewSig TreeImpl> {
13301331 else result = "\\u" + to4digitHex ( any ( int i | i .toUnicode ( ) = char ) )
13311332 }
13321333
1333- /**
1334- * Gets a 4-digit hex representation of `i`.
1335- */
1336- bindingset [ i]
1337- string to4digitHex ( int i ) {
1338- result =
1339- "0123456789abcdef" .charAt ( i .bitShiftRight ( 12 ) .bitAnd ( 15 ) ) +
1340- "0123456789abcdef" .charAt ( i .bitShiftRight ( 8 ) .bitAnd ( 15 ) ) +
1341- "0123456789abcdef" .charAt ( i .bitShiftRight ( 4 ) .bitAnd ( 15 ) ) +
1342- "0123456789abcdef" .charAt ( i .bitAnd ( 15 ) )
1343- }
1344-
13451334 /** Holds if `char` is easily printable char, or whitespace. */
13461335 private predicate isPrintable ( string char ) {
13471336 exists ( ascii ( char ) )
Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ version: 0.1.2-dev
33groups : shared
44library : true
55dependencies :
6+ codeql/util : ${workspace}
67warnOnImplicitThis : true
Original file line number Diff line number Diff line change @@ -100,6 +100,18 @@ private int toHex(string hex) {
100100 result = 15 and hex = [ "f" , "F" ]
101101}
102102
103+ /**
104+ * Gets a 4-digit hex representation of `i`.
105+ */
106+ bindingset [ i]
107+ string to4digitHex ( int i ) {
108+ result =
109+ "0123456789abcdef" .charAt ( i .bitShiftRight ( 12 ) .bitAnd ( 15 ) ) +
110+ "0123456789abcdef" .charAt ( i .bitShiftRight ( 8 ) .bitAnd ( 15 ) ) +
111+ "0123456789abcdef" .charAt ( i .bitShiftRight ( 4 ) .bitAnd ( 15 ) ) +
112+ "0123456789abcdef" .charAt ( i .bitAnd ( 15 ) )
113+ }
114+
103115/**
104116 * Gets the value of 16 to the power of `n`. Holds only for `n` in the range
105117 * 0..7 (inclusive).
You can’t perform that action at this time.
0 commit comments