|
satyr 0.43
|
Parser location in input file. More...
#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | sr_location |
| A location of a parser in the input stream. More... | |
Functions | |
| void | sr_location_init (struct sr_location *location) |
| int | sr_location_cmp (struct sr_location *location1, struct sr_location *location2, bool compare_messages) |
| char * | sr_location_to_string (struct sr_location *location) |
| void | sr_location_add (struct sr_location *location, int add_line, int add_column) |
| void | sr_location_add_ext (int *line, int *column, int add_line, int add_column) |
| void | sr_location_eat_char (struct sr_location *location, char c) |
| void | sr_location_eat_char_ext (int *line, int *column, char c) |
Parser location in input file.
Definition in file location.h.
| void sr_location_add | ( | struct sr_location * | location, |
| int | add_line, | ||
| int | add_column ) |
Adds a line and a column to specific location.
| location | The structure to be modified. It must be a valid pointer. |
| add_line | Starts from 1. It means that if add_line is 1, the line member of the location structure is not changed. |
| add_column | Starts from 0. |
References sr_location_add().
Referenced by sr_location_add().
| void sr_location_add_ext | ( | int * | line, |
| int * | column, | ||
| int | add_line, | ||
| int | add_column ) |
Adds a line column pair to another line column pair.
| add_line | Starts from 1. It means that if add_line is 1, the line is not changed. |
| add_column | Starts from 0. |
References sr_location_add_ext().
Referenced by sr_location_add_ext().
| int sr_location_cmp | ( | struct sr_location * | location1, |
| struct sr_location * | location2, | ||
| bool | compare_messages ) |
Compare two locations.
| location1 | It must be non-NULL pointer. It's not modified by calling this function. |
| location2 | It must be non-NULL pointer. It's not modified by calling this function. |
| compare_messages | Indicates whether to compare messages in the locations as well. |
'Less' and 'greater' take lines into account first. If a location1 line is lower than location2 line, location1 is considered 'less' than location2. If the lines are the same, columns are compared. When compare_messages is true and lines and columns are equal, the locations' messages are compared according to the lexicographical order.
References sr_location_cmp().
Referenced by sr_location_cmp().
| void sr_location_eat_char | ( | struct sr_location * | location, |
| char | c ) |
Updates the line and column of the location by moving "after" the char c. If c is a newline character, the line number is increased and the column is set to 0. Otherwise the column is increased by 1.
References sr_location_eat_char().
Referenced by sr_location_eat_char().
| void sr_location_eat_char_ext | ( | int * | line, |
| int * | column, | ||
| char | c ) |
Updates the line and the column by moving "after" the char c. If c is a newline character, the line number is increased and the column is set to 0. Otherwise the column is increased.
| line | Must be a valid pointer. |
| column | Must be a valid pointer. |
References sr_location_eat_char_ext().
Referenced by sr_location_eat_char_ext().
| void sr_location_init | ( | struct sr_location * | location | ) |
Initializes all members of the location struct to their default values. No memory is allocated or released by this function.
References sr_location_init().
Referenced by sr_location_init().
| char * sr_location_to_string | ( | struct sr_location * | location | ) |
Creates a string representation of location. User must delete the returned string using g_free().
References sr_location_to_string().
Referenced by sr_location_to_string().