Fix user guide and generated parser comments for position row and col to be 1-based
This commit is contained in:
parent
cb914e8bb0
commit
c28aebddb4
@ -59,10 +59,10 @@ public alias <%= @grammar.prefix %>code_point_t = uint;
|
||||
*/
|
||||
public struct <%= @grammar.prefix %>position_t
|
||||
{
|
||||
/** Input text row (0-based). */
|
||||
/** Input text row (1-based). */
|
||||
uint row;
|
||||
|
||||
/** Input text column (0-based). */
|
||||
/** Input text column (1-based). */
|
||||
uint col;
|
||||
|
||||
/** Invalid position value. */
|
||||
|
||||
@ -45,10 +45,10 @@ typedef uint32_t <%= @grammar.prefix %>code_point_t;
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/** Input text row (0-based). */
|
||||
/** Input text row (1-based). */
|
||||
uint32_t row;
|
||||
|
||||
/** Input text column (0-based). */
|
||||
/** Input text column (1-based). */
|
||||
uint32_t col;
|
||||
} <%= @grammar.prefix %>position_t;
|
||||
|
||||
|
||||
@ -1346,7 +1346,7 @@ if (p_parse(context) == P_UNEXPECTED_TOKEN)
|
||||
{
|
||||
p_position_t error_position = p_position(context);
|
||||
fprintf(stderr, "Error: unexpected token at row %u column %u\n",
|
||||
error_position.row + 1, error_position.col + 1);
|
||||
error_position.row, error_position.col);
|
||||
}
|
||||
```
|
||||
|
||||
@ -1474,7 +1474,7 @@ if (p_parse(context) == P_UNEXPECTED_TOKEN)
|
||||
p_position_t error_position = p_position(context);
|
||||
fprintf(stderr, "Error: unexpected token `%s' at row %u column %u\n",
|
||||
p_token_names[context->token],
|
||||
error_position.row + 1, error_position.col + 1);
|
||||
error_position.row, error_position.col);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user