aboutsummaryrefslogtreecommitdiff
path: root/src/html.lex.l
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-04-26 12:42:11 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-04-26 12:42:11 +0300
commitd50fc04ded36255465184a16c70eb4c50acdb199 (patch)
tree02a568794c2a211621d1fe39868eaad7963bdc43 /src/html.lex.l
parent099a946ad4465c42db4737b247f1e89bd03c83ae (diff)
downloadtagr-d50fc04ded36255465184a16c70eb4c50acdb199.tar.gz
tagr-d50fc04ded36255465184a16c70eb4c50acdb199.tar.bz2
Introduce formats in preprocessor variables.
* configure.ac: Version 1.9.90 * NEWS: Likewise. * etc/Makefile.am (EXTRA_DIST): Add logfilter.awk uptmpl.sed * etc/logfilter.awk: New file * etc/uptmpl.sed: New file * etc/tagr.tmpl: Update * etc/upgrade.awk: Add copyleft header * gnulib.modules: Add fprintftime. * src/graph.c (rate_unit): Change to "Bytes per Second". (number_suffix, number_suffix_count): Move to grid.c * src/html.gram.y: Work with formats. * src/html.lex.l: Likewise. * src/output.c (update_output): Store NOW as a number and provide a formatting function for it. * src/tagr.h (union value, value_format_fn): New types. (pp_value_t): New members: fmt, format (add_numeric_value, add_string_value): Change return type. (init_value): New proto.
Diffstat (limited to 'src/html.lex.l')
-rw-r--r--src/html.lex.l27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/html.lex.l b/src/html.lex.l
index 9f323dd..931bfc1 100644
--- a/src/html.lex.l
+++ b/src/html.lex.l
@@ -44,7 +44,7 @@ N [0-9]+
44 if (find_value (yytext+1, &yylval.value)) 44 if (find_value (yytext+1, &yylval.value))
45 { 45 {
46 yyerror ("unknown identifier"); 46 yyerror ("unknown identifier");
47 yylval.value.type = unspecified_value; 47 init_value (&yylval.value, unspecified_value, NULL);
48 } 48 }
49 return IDENT; 49 return IDENT;
50} 50}
@@ -53,7 +53,7 @@ N [0-9]+
53 if (find_value (yytext+2, &yylval.value)) 53 if (find_value (yytext+2, &yylval.value))
54 { 54 {
55 yyerror ("unknown identifier"); 55 yyerror ("unknown identifier");
56 yylval.value.type = unspecified_value; 56 init_value (&yylval.value, unspecified_value, NULL);
57 } 57 }
58 return IDENT; 58 return IDENT;
59} 59}
@@ -63,7 +63,7 @@ N [0-9]+
63 if (find_value (yytext+2, &yylval.value)) 63 if (find_value (yytext+2, &yylval.value))
64 { 64 {
65 yyerror ("unknown identifier"); 65 yyerror ("unknown identifier");
66 yylval.value.type = unspecified_value; 66 init_value (&yylval.value, unspecified_value, NULL);
67 } 67 }
68 else 68 else
69 { 69 {
@@ -71,6 +71,27 @@ N [0-9]+
71 } 71 }
72 return IDENT; 72 return IDENT;
73} 73}
74\$\({NAME}:[^)]+\) {
75 pp_value_t val;
76 char *p = strchr (yytext, ':');
77 *p++ = 0;
78 if (find_value (yytext+2, &val))
79 {
80 yyerror ("unknown identifier");
81 init_value (&yylval.value, unspecified_value, NULL);
82 }
83 else
84 {
85 size_t len = strlen (p) - 1;
86 init_value (&yylval.value, val.type, &val.v);
87 yylval.value.prec = val.prec;
88 yylval.value.format = val.format;
89 yylval.value.fmt = xmalloc (len + 1);
90 memcpy (yylval.value.fmt, p, len);
91 yylval.value.fmt[len] = 0;
92 }
93 return IDENT;
94}
74\$\{ return OBRACE; 95\$\{ return OBRACE;
75\$\} return CBRACE; 96\$\} return CBRACE;
76<EVAL>[ \t]+ ; 97<EVAL>[ \t]+ ;

Return to:

Send suggestions and report system problems to the System administrator.