diff options
author | FreeArtMan <dos21h@gmail.com> | 2016-05-17 23:33:39 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2016-05-17 23:33:39 +0100 |
commit | 4baa01f8cd595cb0517d8f7f665d5be92528b6c2 (patch) | |
tree | 3f717f18473d7caef1375cdd2e1a60b1a0c55bca /libcmd/cmd_parse.ragel | |
parent | 852c7ad1af2e3283425dccd79b0923b7df12a388 (diff) | |
download | ihe-4baa01f8cd595cb0517d8f7f665d5be92528b6c2.tar.gz ihe-4baa01f8cd595cb0517d8f7f665d5be92528b6c2.zip |
Fixed cmd line parsing when 1 symbols strings wherent recognized
Diffstat (limited to 'libcmd/cmd_parse.ragel')
-rw-r--r-- | libcmd/cmd_parse.ragel | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libcmd/cmd_parse.ragel b/libcmd/cmd_parse.ragel index 85aa7d8..dd5ff13 100644 --- a/libcmd/cmd_parse.ragel +++ b/libcmd/cmd_parse.ragel @@ -5,8 +5,8 @@ #define TADD(T,S,E,SZ) {cmd_tok_t *t=cmd_tok_create(S,E,SZ,T);cmd_tok_add(tl,t);tl=tl->next;} //#define TADD(T,S,E) -#define PR_TK_DBG(S) printf(S);fwrite(ts,1,te-ts,stdout);printf("\n"); -//#define PR_TK_DBG(S) +//#define PR_TK_DBG(S) printf(S);fwrite(ts,1,te-ts,stdout);printf("\n"); +#define PR_TK_DBG(S) ; char *new_string( const char *start, const char *end ) { @@ -36,13 +36,13 @@ int print_token( char *s, char *e, int tok) binary = '0b' [0-1]+; string = ('"' ([a-zA-Z0-9' '])+ '"'); seperate = ';'; - word = [a-zA-Z] ([a-zA-Z0-9])+; + word = [a-zA-Z] ([a-zA-Z0-9])*; - sp = (' ' | '\t' | '\n'); + sp = (' ' | '\t' | '\n')*; main := |* hex {PR_TK_DBG("hex = ");TADD(CMDT_HEX, ts,te,te-ts);}; - sp {}; + sp {PR_TK_DBG("sp = ");}; string {PR_TK_DBG("str = ");TADD(CMDT_STR, ts,te,te-ts);}; decimal {PR_TK_DBG("dec = ");TADD(CMDT_INT, ts,te,te-ts);}; binary {PR_TK_DBG("bin = ");TADD(CMDT_BIN, ts,te,te-ts);}; |