summaryrefslogtreecommitdiff
path: root/tree.h
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2021-01-17 12:18:01 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2021-01-17 12:18:01 -0500
commit16fc477e1d18fee40f807770f02c77c01d2fe852 (patch)
tree7cd35c767aa4690bfd211516428f58fea685252d /tree.h
parentfcfa53053d5607b03f75f2f8ced61874161ddc7c (diff)
Pattern matching: check
Diffstat (limited to 'tree.h')
-rw-r--r--tree.h79
1 files changed, 38 insertions, 41 deletions
diff --git a/tree.h b/tree.h
index 9de31aa..c4f86b9 100644
--- a/tree.h
+++ b/tree.h
@@ -1,7 +1,7 @@
typedef struct singleNode {
char pattern; // Character to match
- int pos; // Position (index) relative to the first node to match
- int identity; // What happens when this treeNode is the last to be matched
+ int pos; // Position of char to match relative to it's parent node.
+ int event; // What happens when this treeNode is the last to be matched
// 0: Invalid match: Match pattern is most likely incomplete (or escaped)
// 1: italics delimiter
// 2: bold delimiter
@@ -17,156 +17,153 @@ typedef struct singleNode {
// 12: automatic date (date will be formatted for groff on compile time)
// 13: manual date
// 14: indent text
- // 15: bold&italics delimiter with a -1 offset
- // 16: bold&italics delimiter with a -2 offset
+ // 15: bold&italics delimiter with a -1 offset
+ // 16: bold&italics delimiter with a -2 offset
+ // 17: asterisk escape sequence
+ // 18: underscore escape sequence
+ // 19: backtick escape sequence
int childsize;
struct singleNode *child[]; // Pointer array to other child nodes
} node ;
-typedef struct nodeRoot {
- int childsize;
- struct singleNode *child[];
-} root ;
-
-
// 8 depth {{{
node n_dfaaaaaa = {
- ':', 7, 11, 0,
+ ':', 1, 11, 0,
{}
};
// }}}
// 7 depth {{{
node n_dfaaaaa = {
- 'r', 6, 0, 1,
+ 'r', 1, 0, 1,
{&n_dfaaaaaa}
};
node n_dfcaaaa = {
- ':', 6, 10, 0,
+ ':', 1, 10, 0,
{}
};
// }}}
// 6 depth {{{
node n_dfaaaa = {
- 'o', 5, 0, 1,
+ 'o', 1, 0, 1,
{&n_dfaaaaa}
};
node n_dfbaaa = {
- ':', 5, 13, 0,
+ ':', 1, 13, 0,
{}
};
node n_dfbaab = {
- '\n', 5, 12, 0,
+ '\n', 1, 12, 0,
{}
};
node n_dfcaaa = {
- 'e', 5, 0, 1,
+ 'e', 1, 0, 1,
{&n_dfcaaaa}
};
// }}}
// 5 depth {{{
node n_dfaaa = {
- 'h', 4, 0, 1,
+ 'h', 2, 0, 1,
{&n_dfaaaa}
};
node n_dfbaa = {
- 'e', 4, 0, 2,
+ 'e', 2, 0, 2,
{&n_dfbaaa, &n_dfbaab}
};
node n_dfcaa = {
- 'l', 4, 0, 1,
+ 'l', 2, 0, 1,
{&n_dfcaaa}
};
// }}}
// 4 depth {{{
node n_dfca = {
- 'i', 2, 0, 1,
+ 'i', 1, 0, 1,
{&n_dfcaa}
};
node n_cbaa = {
- '\n', -1, 5, 0,
+ '\n', -3, 5, 0,
{}
};
node n_deaa = {
- '-', -3, 9, 0,
+ '-', -1, 9, 0,
{}
};
node n_dfaa = {
- 'u', 2, 0, 1,
+ 'u', 1, 0, 1,
{&n_dfaaa}
};
node n_dfba = {
- 'a', 2, 0, 1,
+ 'a', 1, 0, 1,
{&n_dfbaa}
};
// }}}
// 3 depth {{{
node n_dfc = {
- 't', 1, 0, 1,
+ 't', -2, 0, 1,
{&n_dfca}
};
node n_aba = {
- '_', -1, 15, 0,
+ '_', -2, 15, 0,
{}
};
node n_abb = {
- '*', 2, 3, 0,
+ '*', 1, 3, 0,
{}
};
node n_abc = {
- '_', 2, 3, 0,
+ '_', 1, 3, 0,
{}
};
node n_aca = {
- '_', -2, 16, 0,
+ '_', -1, 16, 0,
{}
};
node n_ada = {
- '_', 2, 3, 0,
+ '_', 1, 3, 0,
{}
};
node n_bba = {
- '_', 2, 3, 0,
+ '_', 1, 3, 0,
{}
};
node n_cba = {
- '`', 2, 0, 1,
+ '`', 1, 0, 1,
{&n_cbaa}
};
node n_dea = {
- '-', -2, 0, 1,
+ '-', -1, 0, 1,
{&n_deaa}
};
node n_dfa = {
- 'a', 1, 0, 1,
+ 'a', -2, 0, 1,
{&n_dfaa}
};
node n_dfb = {
- 'd', 1, 0, 1,
+ 'd', -2, 0, 1,
{&n_dfba}
};
// }}}
@@ -178,7 +175,7 @@ node n_df = {
};
node n_aa = {
- '\\', -1, 0, 0,
+ '\\', -1, 17, 0,
{}
};
@@ -198,7 +195,7 @@ node n_ad = {
};
node n_ba = {
- '\\', -1, 0, 0,
+ '\\', -1, 18, 0,
{}
};
@@ -208,7 +205,7 @@ node n_bb = {
};
node n_ca = {
- '\\', -1, 0, 0,
+ '\\', -1, 19, 0,
{}
};
@@ -265,8 +262,8 @@ node n_d = {
};
// }}}
-root tree_root = {
- 4,
+node main_root = {
+ '@', 0, 0, 4,
{&n_a, &n_b, &n_c, &n_d}
};