Rizin
unix-like reverse engineering framework and cli tools
point.h File Reference
#include "tree_sitter/api.h"

Go to the source code of this file.

Macros

#define POINT_ZERO   ((TSPoint) {0, 0})
 
#define POINT_MAX   ((TSPoint) {UINT32_MAX, UINT32_MAX})
 

Functions

static TSPoint point__new (unsigned row, unsigned column)
 
static TSPoint point_add (TSPoint a, TSPoint b)
 
static TSPoint point_sub (TSPoint a, TSPoint b)
 
static bool point_lte (TSPoint a, TSPoint b)
 
static bool point_lt (TSPoint a, TSPoint b)
 
static bool point_gt (TSPoint a, TSPoint b)
 
static bool point_gte (TSPoint a, TSPoint b)
 
static bool point_eq (TSPoint a, TSPoint b)
 
static TSPoint point_min (TSPoint a, TSPoint b)
 
static TSPoint point_max (TSPoint a, TSPoint b)
 

Macro Definition Documentation

◆ POINT_MAX

#define POINT_MAX   ((TSPoint) {UINT32_MAX, UINT32_MAX})

Definition at line 7 of file point.h.

◆ POINT_ZERO

#define POINT_ZERO   ((TSPoint) {0, 0})

Definition at line 6 of file point.h.

Function Documentation

◆ point__new()

static TSPoint point__new ( unsigned  row,
unsigned  column 
)
inlinestatic

Definition at line 9 of file point.h.

9  {
10  TSPoint result = {row, column};
11  return result;
12 }
Definition: api.h:55

Referenced by point_add(), and point_sub().

◆ point_add()

static TSPoint point_add ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 14 of file point.h.

14  {
15  if (b.row > 0)
16  return point__new(a.row + b.row, b.column);
17  else
18  return point__new(a.row, a.column + b.column);
19 }
static TSPoint point__new(unsigned row, unsigned column)
Definition: point.h:9
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41

References a, b, and point__new().

Referenced by length_add(), ts_node_edit(), ts_node_end_point(), ts_tree_cursor_goto_first_child_for_point(), and ts_tree_edit().

◆ point_eq()

static bool point_eq ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 44 of file point.h.

44  {
45  return a.row == b.row && a.column == b.column;
46 }

References a, and b.

◆ point_gt()

static bool point_gt ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 36 of file point.h.

36  {
37  return (a.row > b.row) || (a.row == b.row && a.column > b.column);
38 }

References a, and b.

Referenced by ts_query_cursor__advance().

◆ point_gte()

static bool point_gte ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 40 of file point.h.

40  {
41  return (a.row > b.row) || (a.row == b.row && a.column >= b.column);
42 }

References a, and b.

Referenced by ts_tree_cursor_goto_first_child_for_point().

◆ point_lt()

static bool point_lt ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 32 of file point.h.

32  {
33  return (a.row < b.row) || (a.row == b.row && a.column < b.column);
34 }

References a, and b.

Referenced by ts_node__descendant_for_point_range(), and ts_query_cursor__advance().

◆ point_lte()

static bool point_lte ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 28 of file point.h.

28  {
29  return (a.row < b.row) || (a.row == b.row && a.column <= b.column);
30 }

References a, and b.

Referenced by ts_node__descendant_for_point_range(), ts_node_descendants_of_type_wasm(), and ts_query_cursor__first_in_progress_capture().

◆ point_max()

static TSPoint point_max ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 55 of file point.h.

55  {
56  if (a.row > b.row || (a.row == b.row && a.column > b.column))
57  return a;
58  else
59  return b;
60 }

References a, and b.

◆ point_min()

static TSPoint point_min ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 48 of file point.h.

48  {
49  if (a.row < b.row || (a.row == b.row && a.column < b.column))
50  return a;
51  else
52  return b;
53 }

References a, and b.

◆ point_sub()

static TSPoint point_sub ( TSPoint  a,
TSPoint  b 
)
inlinestatic

Definition at line 21 of file point.h.

21  {
22  if (a.row > b.row)
23  return point__new(a.row - b.row, a.column);
24  else
25  return point__new(0, a.column - b.column);
26 }

References a, b, and point__new().

Referenced by length_sub(), ts_node_edit(), and ts_tree_edit().