Commit 830d220c authored by Daniel Salzman's avatar Daniel Salzman

zscanner: store record comment into scanner.buffer

parent 8b312d86
......@@ -134,9 +134,9 @@ struct scanner {
uint32_t item_length_position;
/*! Auxiliary pointer to item length. */
uint8_t *item_length_location;
/*! Auxiliary buffer length. */
/*! Auxiliary buffer length. Is zero if no comment after a valid record. */
uint32_t buffer_length;
/*! Auxiliary buffer for data storing. */
/*! Auxiliary buffer. Contains a comment after a valid record. */
uint8_t buffer[MAX_RDATA_LENGTH];
/*! Auxiliary buffer for current included file name. */
char include_filename[MAX_RDATA_LENGTH];
......@@ -246,7 +246,7 @@ struct scanner {
uint8_t r_data[MAX_RDATA_LENGTH];
/*
* Example: a. IN 60 MX 1 b.
* Example: a. IN 60 MX 1 b. ; A comment
*
* r_owner_length = 3
* r_owner = 016100
......@@ -255,6 +255,8 @@ struct scanner {
* r_type = 15
* r_data_length = 5
* r_data = 0001016200
* buffer_length = 11
* buffer = " A comment"
*/
};
......
......@@ -41,13 +41,26 @@
s->multiline = false;
}
action _comment {
if (s->buffer_length < sizeof(s->buffer) - 1) {
s->buffer[s->buffer_length++] = fc;
}
}
action _comment_exit {
s->buffer[s->buffer_length++] = 0;
}
action _rest_init {
s->buffer[0] = 0;
s->buffer_length = 0;
}
action _rest_error {
WARN(ZS_BAD_REST);
fhold; fgoto err_line;
}
newline = '\n' $_newline;
comment = ';' . (^newline)*;
comment = (';' . (^newline)* $_comment) %_comment_exit;
# White space separation. With respect to parentheses and included comments.
sep = ( [ \t] # Blank characters.
......@@ -56,7 +69,7 @@
| ')' $_check_multiline_end # End of multiline.
)+; # Apply more times.
rest = (sep? :> comment?) $!_rest_error; # Useless text after record.
rest = (sep? :> comment?) >_rest_init $!_rest_error; # Comments.
# Artificial machines which are used for next state transition only!
all_wchar = [ \t\n;()];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment