From 4baa01f8cd595cb0517d8f7f665d5be92528b6c2 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Tue, 17 May 2016 23:33:39 +0100 Subject: Fixed cmd line parsing when 1 symbols strings wherent recognized --- libcmd/cmd_parse.ragel | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libcmd/cmd_parse.ragel') 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);}; -- cgit v1.2.3