summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcmd/cmd_parse.c147
-rw-r--r--libcmd/cmd_parse.ragel2
2 files changed, 72 insertions, 77 deletions
diff --git a/libcmd/cmd_parse.c b/libcmd/cmd_parse.c
index 2c0089a..91e1e8b 100644
--- a/libcmd/cmd_parse.c
+++ b/libcmd/cmd_parse.c
@@ -32,85 +32,89 @@ int print_token( char *s, char *e, int tok)
#line 34 "cmd_parse.c"
static const char _cmd_actions[] = {
- 0, 1, 2, 1, 5, 1, 6, 1,
- 7, 1, 8, 1, 9, 1, 10, 1,
- 11, 1, 12, 1, 13, 2, 0, 1,
- 2, 3, 4
+ 0, 1, 0, 1, 1, 1, 6, 1,
+ 7, 1, 8, 1, 9, 1, 10, 2,
+ 2, 3, 2, 2, 4, 2, 2, 5
+
};
static const char _cmd_key_offsets[] = {
- 0, 0, 3, 6, 8, 10, 16, 30,
- 32, 37, 40, 42, 48
+ 0, 0, 3, 6, 22, 29, 40, 53,
+ 64, 75
};
static const char _cmd_trans_keys[] = {
- 34, 39, 92, 32, 34, 92, 48, 57,
- 48, 49, 48, 57, 65, 70, 97, 102,
- 32, 34, 39, 44, 46, 48, 9, 10,
- 49, 57, 65, 90, 97, 122, 48, 57,
- 46, 98, 120, 48, 57, 46, 48, 57,
- 48, 49, 48, 57, 65, 70, 97, 102,
- 39, 46, 95, 48, 57, 65, 90, 97,
- 122, 0
+ 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
};
static const char _cmd_single_lengths[] = {
- 0, 3, 3, 0, 0, 0, 6, 0,
- 3, 1, 0, 0, 3
+ 0, 3, 3, 6, 1, 1, 5, 3,
+ 1, 1
};
static const char _cmd_range_lengths[] = {
- 0, 0, 0, 1, 1, 3, 4, 1,
- 1, 1, 1, 3, 3
+ 0, 0, 0, 5, 3, 5, 4, 4,
+ 5, 9
};
static const char _cmd_index_offsets[] = {
- 0, 0, 4, 8, 10, 12, 16, 27,
- 29, 34, 37, 39, 43
+ 0, 0, 4, 8, 20, 25, 32, 42,
+ 50, 57
};
static const char _cmd_indicies[] = {
1, 2, 3, 0, 0, 0, 0, 2,
- 5, 4, 7, 6, 8, 8, 8, 6,
- 9, 0, 9, 9, 10, 11, 9, 12,
- 13, 13, 2, 5, 14, 10, 16, 17,
- 12, 15, 10, 12, 15, 7, 18, 8,
- 8, 8, 19, 13, 13, 13, 13, 13,
- 13, 20, 0
+ 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
};
static const char _cmd_trans_targs[] = {
- 1, 6, 0, 2, 6, 7, 6, 10,
- 11, 6, 3, 8, 9, 12, 6, 6,
- 4, 5, 6, 6, 6
+ 1, 3, 0, 2, 3, 4, 5, 6,
+ 7, 3, 3, 8, 9, 3, 8, 9
};
static const char _cmd_trans_actions[] = {
- 0, 3, 0, 0, 19, 0, 17, 0,
- 0, 5, 0, 24, 24, 0, 15, 9,
- 0, 0, 11, 7, 13
+ 0, 5, 0, 0, 7, 0, 0, 0,
+ 0, 11, 9, 21, 21, 13, 18, 15
};
static const char _cmd_to_state_actions[] = {
- 0, 0, 0, 0, 0, 0, 21, 0,
- 0, 0, 0, 0, 0
+ 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0
};
static const char _cmd_from_state_actions[] = {
- 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0
+ 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0
};
static const char _cmd_eof_trans[] = {
- 0, 0, 0, 5, 7, 7, 0, 15,
- 16, 16, 19, 20, 21
+ 0, 0, 0, 0, 10, 10, 11, 11,
+ 14, 14
};
-static const int cmd_start = 6;
-static const int cmd_first_final = 6;
+static const int cmd_start = 3;
+static const int cmd_first_final = 3;
static const int cmd_error = 0;
-static const int cmd_en_main = 6;
+static const int cmd_en_main = 3;
#line 62 "cmd_parse.ragel"
@@ -135,7 +139,7 @@ int parse_cmd( cmd_tok_t *tl, const char *str, size_t str_size )
*/
-#line 139 "cmd_parse.c"
+#line 143 "cmd_parse.c"
{
cs = cmd_start;
ts = 0;
@@ -145,7 +149,7 @@ int parse_cmd( cmd_tok_t *tl, const char *str, size_t str_size )
#line 83 "cmd_parse.ragel"
-#line 149 "cmd_parse.c"
+#line 153 "cmd_parse.c"
{
int _klen;
unsigned int _trans;
@@ -162,11 +166,11 @@ _resume:
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 ) {
switch ( *_acts++ ) {
- case 2:
+ case 1:
#line 1 "NONE"
{ts = p;}
break;
-#line 170 "cmd_parse.c"
+#line 174 "cmd_parse.c"
}
}
@@ -232,59 +236,54 @@ _eof_trans:
{
switch ( *_acts++ )
{
- case 3:
+ case 2:
#line 1 "NONE"
{te = p+1;}
break;
+ case 3:
+#line 52 "cmd_parse.ragel"
+ {act = 1;}
+ break;
case 4:
-#line 53 "cmd_parse.ragel"
- {act = 2;}
+#line 54 "cmd_parse.ragel"
+ {act = 3;}
break;
case 5:
+#line 56 "cmd_parse.ragel"
+ {act = 5;}
+ break;
+ case 6:
#line 55 "cmd_parse.ragel"
{te = p+1;{PR_TK_DBG("qstr = ");TADD(CMDT_QSTR, ts,te,te-ts);}}
break;
- case 6:
+ case 7:
#line 57 "cmd_parse.ragel"
{te = p+1;{PR_TK_DBG("sp = ");/*TADD(CMDT_SP, ts,te,te-ts);*/}}
break;
- case 7:
-#line 52 "cmd_parse.ragel"
- {te = p;p--;{PR_TK_DBG("hex = ");TADD(CMDT_HEX, ts,te,te-ts);}}
- break;
case 8:
#line 53 "cmd_parse.ragel"
{te = p;p--;{PR_TK_DBG("dec = ");TADD(CMDT_INT, ts,te,te-ts);}}
break;
case 9:
-#line 54 "cmd_parse.ragel"
- {te = p;p--;{PR_TK_DBG("bin = ");TADD(CMDT_BIN, ts,te,te-ts);}}
- break;
- case 10:
#line 56 "cmd_parse.ragel"
{te = p;p--;{PR_TK_DBG("word = ");TADD(CMDT_WORD, ts,te,te-ts);}}
break;
- case 11:
-#line 58 "cmd_parse.ragel"
- {te = p;p--;{PR_TK_DBG("float= ");TADD(CMDT_FLOAT, ts,te,te-ts);}}
- break;
- case 12:
-#line 53 "cmd_parse.ragel"
- {{p = ((te))-1;}{PR_TK_DBG("dec = ");TADD(CMDT_INT, ts,te,te-ts);}}
- break;
- case 13:
+ case 10:
#line 1 "NONE"
{ switch( act ) {
- case 0:
- {{cs = 0;goto _again;}}
+ case 1:
+ {{p = ((te))-1;}PR_TK_DBG("hex = ");TADD(CMDT_HEX, ts,te,te-ts);}
break;
- case 2:
- {{p = ((te))-1;}PR_TK_DBG("dec = ");TADD(CMDT_INT, ts,te,te-ts);}
+ case 3:
+ {{p = ((te))-1;}PR_TK_DBG("bin = ");TADD(CMDT_BIN, ts,te,te-ts);}
+ break;
+ case 5:
+ {{p = ((te))-1;}PR_TK_DBG("word = ");TADD(CMDT_WORD, ts,te,te-ts);}
break;
}
}
break;
-#line 288 "cmd_parse.c"
+#line 287 "cmd_parse.c"
}
}
@@ -297,11 +296,7 @@ _again:
#line 1 "NONE"
{ts = 0;}
break;
- case 1:
-#line 1 "NONE"
- {act = 0;}
- break;
-#line 305 "cmd_parse.c"
+#line 300 "cmd_parse.c"
}
}
diff --git a/libcmd/cmd_parse.ragel b/libcmd/cmd_parse.ragel
index 02b92ce..8cd8717 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-Z] ([a-zA-Z0-9'._'])*;
+ word = ([a-zA-Z0-9!#$%&'()*+`./:;<=>?@{}|~_])*;
sp = ([' ','\t','\n']);
main := |*