summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-27 07:52:03 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-06-27 07:52:03 (GMT)
commit5a37057b0ca1b7314f7f338134efc5100dc9223f (patch) (side-by-side diff)
tree5cc64a0724ab2b82ec80b26567a5444eb4adcd88 /src
parent896d1c311129610bffbcc0c596926d8a1d6f1cc5 (diff)
downloadgrecs-5a37057b0ca1b7314f7f338134efc5100dc9223f.tar.gz
grecs-5a37057b0ca1b7314f7f338134efc5100dc9223f.tar.bz2
Adjust string locations only if requested by the caller.
* src/grecs.h (grecs_adjust_string_locations): New extern. * src/parser.c (grecs_adjust_string_locations): New variable. * src/grecs-lex.l: Adjust string locations only if grecs_adjust_string_locations is set.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/grecs-lex.l6
-rw-r--r--src/grecs.h1
-rw-r--r--src/parser.c1
3 files changed, 6 insertions, 2 deletions
diff --git a/src/grecs-lex.l b/src/grecs-lex.l
index adff8a1..455203c 100644
--- a/src/grecs-lex.l
+++ b/src/grecs-lex.l
@@ -342,8 +342,10 @@ ident()
static void
qstring_locus_fixup()
{
- yylloc.beg.col++;
- yylloc.end.col--;
+ if (grecs_adjust_string_locations) {
+ yylloc.beg.col++;
+ yylloc.end.col--;
+ }
}
grecs_value_t *
diff --git a/src/grecs.h b/src/grecs.h
index 1581791..0b0d129 100644
--- a/src/grecs.h
+++ b/src/grecs.h
@@ -71,6 +71,7 @@ typedef struct grecs_locus {
} grecs_locus_t;
extern grecs_locus_t grecs_locus;
+extern int grecs_adjust_string_locations;
enum grecs_data_type {
grecs_type_void,
diff --git a/src/parser.c b/src/parser.c
index 4e315e5..d3ee19a 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -26,6 +26,7 @@ int grecs_error_count;
int grecs_default_port = 0;
int grecs_trace_flags = 0;
+int grecs_adjust_string_locations;
#ifndef GRECS_DEFAULT_PARSER
# define GRECS_DEFAULT_PARSER grecs_grecs_parser

Return to:

Send suggestions and report system problems to the System administrator.