projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
experiments
[pspp]
/
src
/
language
/
lexer
/
lexer.c
diff --git
a/src/language/lexer/lexer.c
b/src/language/lexer/lexer.c
index 3c46fa70ebb787689a81244559ec2477f874eec4..d501cf8993ca8a2d1ac77e175c9f0483608950df 100644
(file)
--- a/
src/language/lexer/lexer.c
+++ b/
src/language/lexer/lexer.c
@@
-69,7
+69,6
@@
struct lex_token
call. */
size_t token_pos; /* Offset into src->buffer of token start. */
size_t token_len; /* Length of source for token in bytes. */
call. */
size_t token_pos; /* Offset into src->buffer of token start. */
size_t token_len; /* Length of source for token in bytes. */
- int first_line; /* Line number at token_pos. */
/* For a token obtained through macro expansion, this is just this token.
/* For a token obtained through macro expansion, this is just this token.
@@
-221,7
+220,10
@@
struct lex_source
size_t journal_pos; /* First byte not yet output to journal. */
size_t seg_pos; /* First byte not yet scanned as token. */
size_t journal_pos; /* First byte not yet output to journal. */
size_t seg_pos; /* First byte not yet scanned as token. */
- int n_newlines; /* Number of new-lines up to seg_pos. */
+ /* Offset into 'buffer' of starts of lines. */
+ size_t *lines;
+ size_t n_lines, allocated_lines;
+
bool suppress_next_newline;
/* Tokens.
bool suppress_next_newline;
/* Tokens.
@@
-1241,6
+1243,8
@@
static int
lex_token_get_last_line_number (const struct lex_source *src,
const struct lex_token *token)
{
lex_token_get_last_line_number (const struct lex_source *src,
const struct lex_token *token)
{
+ size_t end = token->token_pos + token->token_len
+ return lex_source_ofs_to_line_number (src,
if (token->first_line == 0)
return 0;
else
if (token->first_line == 0)
return 0;
else