aboutsummaryrefslogtreecommitdiffstats
path: root/libcmd
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2019-10-06 14:36:17 +0100
committerFreeArtMan <dos21h@gmail.com>2019-10-06 14:36:17 +0100
commit786bd1e76c6806a4c9272814f9ffe7d901998e4e (patch)
tree8b1e38e48a766c5a8dbad7f00ffb63d09376426c /libcmd
parent8a8e0941dd2ab5f089662362a30c91e16de18ce0 (diff)
downloadihe-786bd1e76c6806a4c9272814f9ffe7d901998e4e.tar.gz
ihe-786bd1e76c6806a4c9272814f9ffe7d901998e4e.zip
Fix seek command, tested/works relative seek, and hex positioning support
Diffstat (limited to 'libcmd')
-rw-r--r--libcmd/cmd_parse.c57
-rw-r--r--libcmd/cmd_parse.ragel2
2 files changed, 27 insertions, 32 deletions
diff --git a/libcmd/cmd_parse.c b/libcmd/cmd_parse.c
index 91e1e8b..9d831cf 100644
--- a/libcmd/cmd_parse.c
+++ b/libcmd/cmd_parse.c
@@ -39,50 +39,45 @@ static const char _cmd_actions[] = {
};
static const char _cmd_key_offsets[] = {
- 0, 0, 3, 6, 22, 29, 40, 53,
- 64, 75
+ 0, 0, 3, 6, 18, 21, 28, 38,
+ 46, 53
};
static const char _cmd_trans_keys[] = {
34, 39, 92, 32, 34, 92, 32, 34,
- 44, 46, 47, 48, 9, 10, 33, 43,
- 49, 57, 58, 90, 95, 126, 33, 35,
- 43, 46, 90, 95, 126, 33, 35, 43,
- 46, 47, 48, 57, 58, 90, 95, 126,
- 33, 46, 47, 98, 120, 35, 43, 48,
- 57, 58, 90, 95, 126, 33, 46, 47,
- 35, 43, 48, 57, 58, 90, 95, 126,
- 33, 35, 43, 46, 47, 48, 49, 50,
- 90, 95, 126, 33, 35, 43, 46, 47,
- 48, 57, 58, 64, 65, 70, 71, 90,
- 95, 96, 97, 102, 103, 126, 0
+ 46, 48, 9, 10, 33, 47, 49, 57,
+ 58, 126, 33, 35, 126, 33, 35, 47,
+ 48, 57, 58, 126, 33, 46, 98, 120,
+ 35, 47, 48, 57, 58, 126, 33, 46,
+ 35, 47, 48, 57, 58, 126, 33, 35,
+ 47, 48, 49, 50, 126, 33, 35, 47,
+ 48, 57, 58, 64, 65, 70, 71, 96,
+ 97, 102, 103, 126, 0
};
static const char _cmd_single_lengths[] = {
- 0, 3, 3, 6, 1, 1, 5, 3,
+ 0, 3, 3, 4, 1, 1, 4, 2,
1, 1
};
static const char _cmd_range_lengths[] = {
- 0, 0, 0, 5, 3, 5, 4, 4,
- 5, 9
+ 0, 0, 0, 4, 1, 3, 3, 3,
+ 3, 7
};
static const char _cmd_index_offsets[] = {
- 0, 0, 4, 8, 20, 25, 32, 42,
- 50, 57
+ 0, 0, 4, 8, 17, 20, 25, 33,
+ 39, 44
};
static const char _cmd_indicies[] = {
1, 2, 3, 0, 0, 0, 0, 2,
- 4, 0, 4, 6, 5, 7, 4, 5,
- 8, 5, 5, 2, 5, 5, 5, 5,
- 9, 5, 5, 5, 6, 5, 5, 9,
- 5, 6, 5, 11, 12, 5, 8, 5,
- 5, 10, 5, 6, 5, 5, 8, 5,
- 5, 10, 5, 5, 5, 14, 5, 5,
- 13, 5, 5, 5, 15, 5, 15, 5,
- 5, 15, 5, 13, 0
+ 4, 0, 6, 7, 4, 5, 8, 5,
+ 2, 5, 5, 9, 5, 5, 6, 5,
+ 9, 5, 6, 11, 12, 5, 8, 5,
+ 10, 5, 6, 5, 8, 5, 10, 5,
+ 5, 14, 5, 13, 5, 5, 15, 5,
+ 15, 5, 15, 5, 13, 0
};
static const char _cmd_trans_targs[] = {
@@ -139,7 +134,7 @@ int parse_cmd( cmd_tok_t *tl, const char *str, size_t str_size )
*/
-#line 143 "cmd_parse.c"
+#line 138 "cmd_parse.c"
{
cs = cmd_start;
ts = 0;
@@ -149,7 +144,7 @@ int parse_cmd( cmd_tok_t *tl, const char *str, size_t str_size )
#line 83 "cmd_parse.ragel"
-#line 153 "cmd_parse.c"
+#line 148 "cmd_parse.c"
{
int _klen;
unsigned int _trans;
@@ -170,7 +165,7 @@ _resume:
#line 1 "NONE"
{ts = p;}
break;
-#line 174 "cmd_parse.c"
+#line 169 "cmd_parse.c"
}
}
@@ -283,7 +278,7 @@ _eof_trans:
}
}
break;
-#line 287 "cmd_parse.c"
+#line 282 "cmd_parse.c"
}
}
@@ -296,7 +291,7 @@ _again:
#line 1 "NONE"
{ts = 0;}
break;
-#line 300 "cmd_parse.c"
+#line 295 "cmd_parse.c"
}
}
diff --git a/libcmd/cmd_parse.ragel b/libcmd/cmd_parse.ragel
index 8cd8717..7bae484 100644
--- a/libcmd/cmd_parse.ragel
+++ b/libcmd/cmd_parse.ragel
@@ -45,7 +45,7 @@ int print_token( char *s, char *e, int tok)
'"';
quote = '"' (any-'"')* '"';
#seperate = ';';
- word = ([a-zA-Z0-9!#$%&'()*+`./:;<=>?@{}|~_])*;
+ word = ([a-zA-Z0-9!#$%&'()*+-`./:;<=>?@{}|~_])*;
sp = ([' ','\t','\n']);
main := |*