Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
h3m_ffd: done
Browse files Browse the repository at this point in the history
  • Loading branch information
corwinn committed Feb 26, 2023
1 parent a618054 commit 86be1f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions h3r_ffd_formal_description
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

**** END LICENCE BLOCK ****/

Why?
Because, now I could write a tool (a parser-generator) that can write the
.h3m, .foo, .bar, ... parsers, in C, C++, C#, ..., instead of me.

node : generalization: each token of the description
comment : "//" & "/**/"
object : starts with a {keyword} (and the preceding {comment}s and
Expand All @@ -56,7 +60,7 @@ keywords:
"struct" - defines a {node} of {node}s - sequential data grouped together
and bound to a {symbol}; it does not have expr support yet <=> no
use-case yet; the word "sequential" here is kind of misplaced -
perhaps the five desriptions will change its meaning to sequential
perhaps the five descriptions will change its meaning to sequential
description;
The initial empty space for the {node} list is mandatory.
"format" - defines the root {node} of your data format - this is where the
Expand Down Expand Up @@ -101,16 +105,16 @@ expression: a script being evaluated when needed (always enclosed in ()):

{symbol}1<>{symbol}2 - marks symbol1 to be a key at a field
of type symbol2; symbol resolution applies in order to find
symbol2 (should this happen to lead to too much confision a
symbol2 (should this happen to lead to too much confusion a
lookup by struct.field_name shall be used instead); these
lookup (hash) tables are almost always 1, rarely 2 - at the
file formats I have dealt with, so this "type" lookup should
be ok for starters - just make sure to use distinct name for
the table type.
The <> implies two data flow directions: 1 - the key value
is read from the stream at the current offset; 2 - fields
refering the key will not get its value, but the table value
this keys is refering to.
referring the key will not get its value, but the table
value this keys is referring to.

char-set: ASCII; bytes that shall reward you with an exception:
[0;10), [11;13), [14;31], [127;255]
Expand Down
2 changes: 2 additions & 0 deletions parse_map_ffd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// run:
// #01 - ~40 min.; tons of errors; parsed: 3137/6167 maps; good
// #02 - ~50 min.; ... ; parsed: 4758/6167 ... ; ...
// #03 - ~44 min.; ... ; parsed: shame on me/6167 ... ; regression
// #04 - ~57 min.; ... ; parsed: 6167/6167 ... ; done

#include "h3r_os_error.h"
H3R_ERR_DEFINE_UNHANDLED
Expand Down

0 comments on commit 86be1f7

Please sign in to comment.