Created
July 20, 2020 18:16
-
-
Save ntrel/6db8c36391b6eeb007a2178f8900a869 to your computer and use it in GitHub Desktop.
Grepping for inclusive and exclusive range checks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: maybe some false positives for both | |
# inclusive range: 65 lines | |
$ gg -E '\b(\w+) >=?.+&&\s*\1\s*<=' | |
cmd/v/help/help.v:15: if (b >= `a` && b <= `z`) || b == `-` || (b >= `0` && b <= `9`) { | |
examples/vpwgen.v:15: if c >= `0` && c <= `~` { | |
thirdparty/fontstash/stb_truetype.h:1128: STBTT_assert(n >= 1 && n <= 4); | |
thirdparty/fontstash/stb_truetype.h:1163: STBTT_assert(offsize >= 1 && offsize <= 4); | |
thirdparty/fontstash/stb_truetype.h:1173: if (b0 >= 32 && b0 <= 246) return b0 - 139; | |
thirdparty/fontstash/stb_truetype.h:1174: else if (b0 >= 247 && b0 <= 250) return (b0 - 247)*256 + stbtt__buf_get8(b) + 108; | |
thirdparty/fontstash/stb_truetype.h:1175: else if (b0 >= 251 && b0 <= 254) return -(b0 - 251)*256 - stbtt__buf_get8(b) - 108; | |
thirdparty/fontstash/stb_truetype.h:1233: STBTT_assert(offsize >= 1 && offsize <= 4); | |
thirdparty/fontstash/stb_truetype.h:2942: STBTT_assert(x1 >= x && x1 <= x+1); | |
thirdparty/fontstash/stb_truetype.h:2949: STBTT_assert(x0 >= x && x0 <= x+1 && x1 >= x && x1 <= x+1); | |
thirdparty/fontstash/stb_truetype.h:4228: if (s0 >= 0.0 && s0 <= 1.0) | |
thirdparty/fontstash/stb_truetype.h:4230: if (d > 0.0 && s1 >= 0.0 && s1 <= 1.0) { | |
thirdparty/fontstash/stb_truetype.h:4239: if (s0 >= 0.0 && s0 <= 1.0) | |
thirdparty/fontstash/stb_truetype.h:4485: if (t >= 0.0f && t <= 1.0f) | |
thirdparty/sokol/sokol_app.h:7143: if ((keysym >= 0x0020 && keysym <= 0x007e) || | |
thirdparty/sokol/sokol_app.h:7144: (keysym >= 0x00a0 && keysym <= 0x00ff)) | |
thirdparty/stb_image/stb_image.h:1590: STBI_ASSERT(req_comp >= 1 && req_comp <= 4); | |
thirdparty/stb_image/stb_image.h:1639: STBI_ASSERT(req_comp >= 1 && req_comp <= 4); | |
thirdparty/stb_image/stb_image.h:1885: if (k >= -128 && k <= 127) | |
thirdparty/stb_image/stb_image.h:2963: if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) { | |
thirdparty/stb_image/stb_image.h:5118: STBI_ASSERT(bits >= 0 && bits <= 8); | |
thirdparty/stb_image/stb_image.h:7143: return c >= '0' && c <= '9'; | |
tutorials/building-a-simple-web-blog-with-vweb.md:288: select from Article where id >= 100 && id <= 200 | |
vlib/builtin/int.v:452: return c >= `A` && c <= `Z` | |
vlib/builtin/string.v:1205: return c >= `0` && c <= `9` | |
vlib/builtin/string.v:1209: return c.is_digit() || (c >= `a` && c <= `f`) || (c >= `A` && c <= `F`) | |
vlib/builtin/string.v:1213: return c >= `0` && c <= `7` | |
vlib/builtin/string.v:1221: return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) | |
vlib/net/websocket/examples/utf8.h:122:#define RANGE(s, e) (c >= s && c <= e) | |
vlib/net/websocket/examples/utf8.h:125:#define EGNAR(s, e) ((c >= s + 1 && c <= e) || c == s) | |
vlib/net/websocket/utf8.v:56: if (c >= 0x00 + 1 && c <= 0x7F) || c == 0x00 { | |
vlib/net/websocket/utf8.v:62: is_tail := c >= 0x80 && c <= 0xBF | |
vlib/net/websocket/utf8.v:64: if s.index == 1 && s.seq(c >= 0xC2 && c <= 0xDF, false, is_tail) { | |
vlib/net/websocket/utf8.v:68: if s.index == 2 && s.seq(c == 0xE0, c >= 0xA0 && c <= 0xBF, is_tail) { | |
vlib/net/websocket/utf8.v:71: if s.index == 3 && s.seq(c >= 0xE1 && c <= 0xEC, c >= 0x80 && c <= 0xBF, is_tail) { | |
vlib/net/websocket/utf8.v:74: if s.index == 4 && s.seq(c == 0xED, c >= 0x80 && c <= 0x9F, is_tail) { | |
vlib/net/websocket/utf8.v:77: if s.index == 5 && s.seq(c >= 0xEE && c <= 0xEF, c >= 0x80 && c <= 0xBF, is_tail) { | |
vlib/net/websocket/utf8.v:81: if s.index == 6 && s.seq(c == 0xF0, c >= 0x90 && c <= 0xBF, is_tail) { | |
vlib/net/websocket/utf8.v:84: if s.index == 7 && s.seq(c >= 0xF1 && c <= 0xF3, c >= 0x80 && c <= 0xBF, is_tail) { | |
vlib/net/websocket/utf8.v:87: if s.index == 8 && s.seq(c == 0xF4, c >= 0x80 && c <= 0x8F, is_tail) { | |
vlib/net/websocket/ws.v:257: } else if payload_len > 125 && payload_len <= 0xffff { | |
vlib/net/websocket/ws.v:267: } else if payload_len > 0xffff && payload_len <= 0xffffffffffffffff { // 65535 && 18446744073709551615 | |
vlib/regex/regex.v:133: if tmp >= 0x00 && tmp <= 25 { return true } | |
vlib/regex/regex.v:135: if tmp >= 0x00 && tmp <= 25 { return true } | |
vlib/regex/regex.v:137: if tmp >= 0x00 && tmp <= 9 { return true } | |
vlib/regex/regex.v:181: return tmp >= 0x00 && tmp <= 25 | |
vlib/regex/regex.v:187: return tmp >= 0x00 && tmp <= 25 | |
vlib/regex/regex.v:538: else if ch >= re.cc[cc_i].ch0 && ch <= re.cc[cc_i].ch1 { | |
vlib/strconv/atof.v:148: return (x >= c_zero && x <= c_nine) == true | |
vlib/strconv/format.v:98: else if c >= `0` && c <= `9` { | |
vlib/strconv/format.v:395: } else if ch >= `1` && ch <= `9` { | |
vlib/strconv/format.v:522: } else if ch == `.` && fc_ch1 >= `1` && fc_ch1 <= `9` { | |
vlib/strconv/format.v:544: if ch >= `1` && ch <= `9` { | |
vlib/strconv/format.v:560: if ch >= `0` && ch <= `9` { | |
vlib/strconv/format.v:576: if ch >= `0` && ch <= `9` { | |
vlib/strconv/format.v:587: if ch >= `0` && ch <= `9` { | |
vlib/strconv/utilities.v:261: else if c >= `0` && c <= `9` { | |
vlib/time/private_test.v:15: assert (diff >=0 && diff <=1) == true | |
vlib/v/ast/scope.v:149: return pos >= s.start_pos && pos <= s.end_pos | |
vlib/v/gen/cgen.v:1580: //!(f >= `a` && f <= `d`) { | |
vlib/v/gen/cgen.v:3952: if idx >= 1 && idx <= 17 { | |
vlib/v/gen/str.v:60: } else if (fup >= 'E' && fup <= 'G') { // floating point | |
vlib/v/util/scanning.v:5: return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) || c == `_` | |
vlib/v/util/scanning.v:10: return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) || c == `_` || c.is_digit() | |
vlib/v/util/scanning.v:20: if c >= `A` && c <= `Z` { | |
# exclusive range: 33 lines | |
$ gg -E '\b(\w+) >=?.+&&\s*\1\s*<[^=]' | |
examples/path_tracing.v:229: if d > 0 && d < t { | |
thirdparty/fontstash/stb_truetype.h:1232: STBTT_assert(i >= 0 && i < count); | |
thirdparty/fontstash/stb_truetype.h:1950: if (glyph_index >= start && glyph_index < end) { | |
thirdparty/fontstash/stb_truetype.h:2367: if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount) | |
thirdparty/fontstash/stb_truetype.h:2510: if (glyph1class >= 0 && glyph1class < class1Count && glyph2class >= 0 && glyph2class < class2Count) { | |
thirdparty/fontstash/stb_truetype.h:3001: if (x_top >= 0 && x_bottom >= 0 && x_top < len && x_bottom < len) { | |
thirdparty/fontstash/stb_truetype.h:3009: STBTT_assert(x >= 0 && x < len); | |
thirdparty/fontstash/stb_truetype.h:4299: if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) { | |
thirdparty/fontstash/stb_truetype.h:4311: if (y > ay && y < by && x > ax) { | |
thirdparty/fontstash/stb_truetype.h:4325: if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) { | |
thirdparty/fontstash/stb_truetype.h:4472: //if (sx > STBTT_min(x0,x1)-min_dist && sx < STBTT_max(x0,x1)+min_dist && | |
thirdparty/fontstash/stb_truetype.h:4473: // sy > STBTT_min(y0,y1)-min_dist && sy < STBTT_max(y0,y1)+min_dist) | |
thirdparty/fontstash/stb_truetype.h:4496: if (sx > box_x0-min_dist && sx < box_x1+min_dist && sy > box_y0-min_dist && sy < box_y1+min_dist) { | |
thirdparty/fontstash/stb_truetype.h:4601: } else if (ch >= 0xd800 && ch < 0xdc00) { | |
thirdparty/fontstash/stb_truetype.h:4612: } else if (ch >= 0xdc00 && ch < 0xe000) { | |
thirdparty/stb_image/stb_image.h:1976: STBI_ASSERT(n >= 0 && n < (int) (sizeof(stbi__bmask)/sizeof(*stbi__bmask))); | |
thirdparty/stb_image/stb_image.h:5116: STBI_ASSERT(v >= 0 && v < 256); | |
vlib/builtin/float.v:13: if abs_x >= 0.0001 && abs_x < 1.0e6 { | |
vlib/builtin/float.v:48: if abs_x >= 0.0001 && abs_x < 1.0e6 { | |
vlib/builtin/utf8.v:215: if r >= 0xcc80 && r < 0xcdb0 { // diacritical marks | |
vlib/builtin/utf8.v:220: if (r >= 0xe1aab0 && r < 0xe1ac80) // diacritical marks extended | |
vlib/builtin/utf8.v:221: || (r >= 0xe1b780 && r < 0xe1b880) // diacritical marks supplement | |
vlib/builtin/utf8.v:222: || (r >= 0xe28390 && r < 0xe28480) // diacritical marks for symbols | |
vlib/builtin/utf8.v:223: || (r >= 0xefb8a0 && r < 0xefb8b0) { // half marks | |
vlib/encoding/utf8/utf8_util.v:50: }if ch_len > 1 && ch_len < 5{ | |
vlib/encoding/utf8/utf8_util.v:180: else if ch_len > 1 && ch_len < 5{ | |
vlib/math/bits.v:46: return (sign >= 0 && f > max_f64) || (sign <= 0 && f < -max_f64) | |
vlib/regex/regex.v:488: for cc_i >= 0 && cc_i < re.cc.len && re.cc[cc_i].cc_type != cc_end { | |
vlib/regex/regex.v:532: for cc_i >= 0 && cc_i < re.cc.len && re.cc[cc_i].cc_type != cc_end { | |
vlib/regex/regex.v:1507: if pc >= 0 && pc < re.prog.len { | |
vlib/regex/regex.v:2118: if rep > 0 && rep < re.prog[pc].rep_min { | |
vlib/regex/regex.v:2125: else if rep >= re.prog[pc].rep_min && rep < re.prog[pc].rep_max { | |
vlib/v/tests/sizeof_test.v:5: assert r > 5.6e-45 && r < 5.7e-45 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment