../lex/scf_lex_util.c
authoryu.dongliang <18588496441@163.com>
Tue, 9 Jun 2026 11:07:52 +0000 (19:07 +0800)
committeryu.dongliang <18588496441@163.com>
Tue, 9 Jun 2026 11:07:52 +0000 (19:07 +0800)
lex/scf_lex_util.c

index 2a09659d1790c7e7e76c30d51247b7d318df94cb..26e6417ed4f7db4170cb53c50b966e93f451fc84 100644 (file)
@@ -2,6 +2,34 @@
 
 int _find_key_word(const char* text);
 
+static scf_key_word_t  number_postfix[] =
+{
+       {"l",   SCF_LEX_WORD_CONST_INT},
+       {"ll",  SCF_LEX_WORD_CONST_I64},
+
+       {"u",   SCF_LEX_WORD_CONST_U32},
+       {"ul",  SCF_LEX_WORD_CONST_U32},
+       {"ull", SCF_LEX_WORD_CONST_U64},
+
+       {"f",   SCF_LEX_WORD_CONST_FLOAT},
+       {"lf",  SCF_LEX_WORD_CONST_DOUBLE},
+};
+
+static int _lex_number_postfix(const char* postfix, int n)
+{
+       scf_key_word_t*  key;
+       int i;
+
+       for (i  = 0; i < sizeof(number_postfix) / sizeof(number_postfix[0]); i++) {
+               key =              &number_postfix[i];
+
+               if (!strncmp(key->text, postfix, n))
+                       return key->type;
+       }
+
+       return -EINVAL;
+}
+
 static int __lex_getc(scf_lex_t* lex)
 {
        if (lex->fp)
@@ -214,34 +242,6 @@ int _lex_op3_ll1(scf_lex_t* lex, scf_lex_word_t** pword, scf_char_t* c0,
        return 0;
 }
 
-static scf_key_word_t  number_postfix[] =
-{
-       {"l",   SCF_LEX_WORD_CONST_INT},
-       {"ll",  SCF_LEX_WORD_CONST_I64},
-
-       {"u",   SCF_LEX_WORD_CONST_U32},
-       {"ul",  SCF_LEX_WORD_CONST_U32},
-       {"ull", SCF_LEX_WORD_CONST_U64},
-
-       {"f",   SCF_LEX_WORD_CONST_FLOAT},
-       {"lf",  SCF_LEX_WORD_CONST_DOUBLE},
-};
-
-static int _lex_number_postfix(const char* postfix, int n)
-{
-       scf_key_word_t*  key;
-       int i;
-
-       for (i  = 0; i < sizeof(number_postfix) / sizeof(number_postfix[0]); i++) {
-               key =              &number_postfix[i];
-
-               if (!strncmp(key->text, postfix, n))
-                       return key->type;
-       }
-
-       return -EINVAL;
-}
-
 int _lex_number_base_10(scf_lex_t* lex, scf_lex_word_t** pword, scf_string_t* s)
 {
        scf_char_t*      c2;