use strbuff instead of str_buff & str_idx
[build-config.git] / src / config / lxrgmr-code / token / envar.var
blobab164053c603c821491b499ccc1deb78f35c6a08
2 /*
3  * envar:
4  * `environment\` variable` `expanssion proc`.
5  */
8 /**
9  ** prefix char.
10  **/
11 const struct token_id dollar_pfx_char_array[] = {
12         { {NULL},                                       NULL,                           0,                                      0,                              0,                              NULL },
15 int on_dollar_proc (int evt, int token, register const char *str, register unsigned int len, SRC_FILE_DESC *psrcfile);
16 int on_dquote (int evt, int token, register const char *str, register unsigned int len, SRC_FILE_DESC *psrcfile);
17 int on_quote (int evt, int token, register const char *str, register unsigned int len, SRC_FILE_DESC *psrcfile);
18 int on_bquote (int evt, int token, register const char *str, register unsigned int len, SRC_FILE_DESC *psrcfile);
19 int on_bracket1 (int evt, int token, register const char *str, register unsigned int len, SRC_FILE_DESC *psrcfile);
20 int on_bracket2 (int evt, int token, register const char *str, register unsigned int len, SRC_FILE_DESC *psrcfile);
21 int on_bracket3 (int evt, int token, register const char *str, register unsigned int len, SRC_FILE_DESC *psrcfile);
24  * eg: (), it is used in sh-script in those kinds.
25  * @ $(), sub-script. it seperate $ and (). $ is a pfx char, it set 'dollar\' flags,
26  * @ (), sub-script. if '(' is detected, it check 'dollar' flags to entering $() sub-script state.
27  *   if no 'dollar' flags, it checks if it is first token in curr statement.
28  * @ func(), function parameter.
29  *    
30  */
31 const struct token_id dollar_paired_char_array[] = {
32         { {"\"\""},                             "T_DQUOTE",                             STATE_CODE,                     T_DQUOTE,               TF_OPCHAR,              on_dquote },
33         { {"''"},                               "T_QUOTE",                              STATE_CODE,                     T_QUOTE,                TF_OPCHAR,              on_quote },
34         { {"``"},                               "T_BACK_QUOTE",                 STATE_CODE,                     T_BACK_QUOTE,   TF_OPCHAR,              on_bquote },
35         { {"[]"},                               "T_LBRACKET2",                  STATE_CODE,                     T_LBRACKET2,    TF_OPCHAR,              NULL },
37         { {NULL},                               NULL,                                   0,                                      0,                              0,                              NULL },
40 /**
41  ** calc-expr opr char.
42  **/
43 const struct token_id dollar_opr_char_array[] = {
44         /* extension */
45         { {"##%%"},             "T_STR_QUOTE",                          STATE_CODE,                     T_STR_QUOTE,                    TF_OPCHAR,      NULL },
46         { .chars={"#%"},                "T_SIDECUT",                            STATE_CODE,                     T_SIDECUT,                      TF_OPCHAR,      NULL },
47         { .chars={"|"},         "T_SPLIT",                              STATE_CODE,                     T_SPLIT,                        TF_OPCHAR,      NULL },
48         { .chars={"<>"},                "T_STRIP",                              STATE_CODE,                     T_STRIP,                        TF_OPCHAR,      NULL },
49         { .chars={"<|>"},               "T_SPLIT_STRIP",                                STATE_CODE,                     T_SPLIT_STRIP,                  TF_OPCHAR,      NULL },
50         { .chars={"~"},         "T_WILDCAST",                           STATE_CODE,                     T_WILDCAST,                     TF_OPCHAR,      NULL },
52         /* standard */
53         { .chars={"!"},                 "T_ENVREF",                                     STATE_CODE,                     T_ENVREF,                       TF_OPCHAR,      NULL },
54         { .chars={"#"},                 "T_SHARP",                              STATE_CODE,                     T_SHARP,                TF_OPCHAR,      NULL },
55         { .chars={"/"},                 "T_SPLASH",                             STATE_CODE,                     T_SPLASH,                       TF_OPCHAR,      NULL },
56         { .chars={"//"},                "T_DSPLASH",                            STATE_CODE,                     T_DSPLASH,                      TF_OPCHAR,      NULL },
57 //      { .chars={"#"},                 "T_SHARP",                              STATE_CODE,                     T_SHARP,                        TF_OPCHAR,      NULL },
58         { .chars={"##"},                "T_DSHARP",                             STATE_CODE,                     T_DSHARP,                       TF_OPCHAR,      NULL },
59         { .chars={"%"},                 "T_PERCENT",                            STATE_CODE,                     T_PERCENT,                      TF_OPCHAR,      NULL },
60         { .chars={"%%"},                "T_DPERCENT",                           STATE_CODE,                     T_DPERCENT,                     TF_OPCHAR,      NULL },
61         { .chars={"@"},                 "T_AT",                         STATE_CODE,                     T_AT,           TF_OPCHAR,      NULL },
62 //      { .chars={"$"},                 "T_DOLLAR",                             STATE_CODE,                     T_DOLLAR,               TF_OPCHAR,      NULL },
63         { .chars={"*"},                 "T_STAR",                               STATE_CODE,                     T_STAR,         TF_OPCHAR,      NULL },
64         
65         { .chars={":"},                 "T_COLON",                              STATE_CODE,                     T_COLON,                        TF_OPCHAR,      NULL },
66         { .chars={",,"},                "T_DCOMMA",                             STATE_CODE,                     T_DCOMMA,                       TF_OPCHAR,      NULL },
67         { .chars={"^^"},                "T_DCARET",                             STATE_CODE,                     T_DCARET,                       TF_OPCHAR,      NULL },
68         
69         { .chars={"-"},                 "T_SUB",                                STATE_CODE,                     T_SUB,                  TF_OPCHAR,      NULL },
70         { .chars={":-"},                "T_COLONSUB",                           STATE_CODE,                     T_COLONSUB,                     TF_OPCHAR,      NULL },
71         { .chars={"="},                 "T_EQUAL",                              STATE_CODE,                     T_EQUAL,                        TF_OPCHAR,      NULL },
72         { .chars={":="},                "T_COLONEQUAL",                         STATE_CODE,                     T_COLONEQUAL,                   TF_OPCHAR,      NULL },
73         { .chars={"+"},                 "T_ADD",                                STATE_CODE,                     T_ADD,                  TF_OPCHAR,      NULL },
74         { .chars={":+"},                "T_COLONADD",                           STATE_CODE,                     T_COLONADD,                     TF_OPCHAR,      NULL },
75         { .chars={"?"},                 "T_QUESTION",                           STATE_CODE,                     T_QUESTION,                     TF_OPCHAR,      NULL },
76         { .chars={":?"},                "T_COLONQUESTION",                              STATE_CODE,                     T_COLONQUESTION,                        TF_OPCHAR,      NULL },
77         
78 //      { .chars={"."},                 "T_POINT",                              STATE_CODE,                     T_POINT,                TF_OPCHAR,      NULL },
79         
80         { {NULL},                               NULL,                                   0,                                      0,                              0,                      NULL },