Commit 80be31bbaf12f45f948bc0844a1033b972fe04fd
1 parent
13dffd5d
[~] comment some print into fast_lexer_4 which made low performance when printing
[+] add various datetime formating into L3 lib
Showing
2 changed files
with
65 additions
and
9 deletions
Show diff stats
anubis_dev/library/lexical_analysis/fast_lexer_4.anubis
1 | - | |
1 | + | |
2 | 2 | |
3 | 3 | |
4 | 4 | The Anubis Project |
... | ... | @@ -1980,7 +1980,7 @@ public define LexerOutput($Token) |
1980 | 1980 | ( |
1981 | 1981 | /* the lexeme may still be accepted after the buffer is reloaded */ |
1982 | 1982 | //update_start_line_col(*buffer_v,start,token_start_v,line_v,col_v); |
1983 | - print("======== reload 1 (rejected)\n"); | |
1983 | + //print("======== reload 1 (rejected)\n"); | |
1984 | 1984 | if reload_buffer(unique) is |
1985 | 1985 | { |
1986 | 1986 | failure then |
... | ... | @@ -2037,7 +2037,7 @@ public define LexerOutput($Token) |
2037 | 2037 | else |
2038 | 2038 | ( |
2039 | 2039 | /* the lexeme may still be accepted after the buffer is reloaded */ |
2040 | - print("======== reload 2 (accepted)\n"); | |
2040 | + //print("======== reload 2 (accepted)\n"); | |
2041 | 2041 | if reload_buffer(unique) is |
2042 | 2042 | { |
2043 | 2043 | failure then |
... | ... | @@ -2075,7 +2075,7 @@ public define LexerOutput($Token) |
2075 | 2075 | /* we are at end of input buffer */ |
2076 | 2076 | //update_start_line_col(*buffer_v,lgbuf,token_start_v,line_v,col_v); |
2077 | 2077 | current_v <- lgbuf; |
2078 | - print("======== reload 3 (ignored to end)\n"); | |
2078 | + //print("======== reload 3 (ignored to end)\n"); | |
2079 | 2079 | if reload_buffer(unique) is |
2080 | 2080 | { |
2081 | 2081 | failure then | ... | ... |
anubis_dev/library/locale/L3LanguageInfo.anubis
... | ... | @@ -39,12 +39,68 @@ public define String datee_dmy = "dd/mm/yyyy". |
39 | 39 | public define String dhour_format ( Date_and_Time d ) = |
40 | 40 | zero_pad_n(2,hour(d))+":"+zero_pad_n(2,minute(d))+":"+zero_pad_n(2,second(d)). |
41 | 41 | |
42 | -public define String dhour_format ( Int dat ) = | |
43 | - dhour_format( convert_time(dat) ). | |
44 | - | |
45 | - | |
46 | - | |
42 | + | |
43 | +public define String | |
44 | + dhour_format | |
45 | + ( | |
46 | + Int date //in UTC | |
47 | + ) = | |
48 | + dhour_format( convert_time(date) ). | |
47 | 49 | |
50 | +public define String | |
51 | + l3_time_hm | |
52 | + ( | |
53 | + Int date_time //in UTC | |
54 | + )= | |
55 | + with date_time = convert_time(date_time), | |
56 | + since date_time is date_and_time(_,_,_,h,m,_,_,_,_), | |
57 | + zero_pad_n(2,h)+":"+zero_pad_n(2,m). | |
58 | + | |
59 | +public define String | |
60 | + l3_time_hms | |
61 | + ( | |
62 | + Int date_time //in UTC | |
63 | + )= | |
64 | + with date_time = convert_time(date_time), | |
65 | + since date_time is date_and_time(_,_,_,h,m,s,_,_,_), | |
66 | + zero_pad_n(2,h)+":"+zero_pad_n(2,m)+":"+zero_pad_n(2,s). | |
67 | + | |
68 | +public define String | |
69 | + l3_datetime_ymd_hms | |
70 | + ( | |
71 | + Int date_time //in UTC | |
72 | + )= | |
73 | + with date_time = convert_time(date_time), | |
74 | + since date_time is date_and_time(y,mon,d,h,min,s,_,_,_), | |
75 | + zero_pad_n(4,y)+"-"+zero_pad_n(2,mon)+"-"+zero_pad_n(2,d)+" "+zero_pad_n(2,h)+":"+zero_pad_n(2,min)+":"+zero_pad_n(2,s). | |
76 | + | |
77 | +public define String | |
78 | + l3_datetime_ymd_hm | |
79 | + ( | |
80 | + Int date_time //in UTC | |
81 | + )= | |
82 | + with date_time = convert_time(date_time), | |
83 | + since date_time is date_and_time(y,mon,d,h,min,s,_,_,_), | |
84 | + zero_pad_n(4,y)+"-"+zero_pad_n(2,mon)+"-"+zero_pad_n(2,d)+" "+zero_pad_n(2,h)+":"+zero_pad_n(2,min). | |
85 | + | |
86 | +public define String | |
87 | + l3_datetime_dmy_hms | |
88 | + ( | |
89 | + Int date_time //in UTC | |
90 | + )= | |
91 | + with date_time = convert_time(date_time), | |
92 | + since date_time is date_and_time(y,mon,d,h,min,s,_,_,_), | |
93 | + zero_pad_n(2,d)+"-"+zero_pad_n(2,mon)+"-"+zero_pad_n(4,y)+" "+zero_pad_n(2,h)+":"+zero_pad_n(2,min)+":"+zero_pad_n(2,s). | |
94 | + | |
95 | +public define String | |
96 | + l3_datetime_dmy_hm | |
97 | + ( | |
98 | + Int date_time //in UTC | |
99 | + )= | |
100 | + with date_time = convert_time(date_time), | |
101 | + since date_time is date_and_time(y,mon,d,h,min,s,_,_,_), | |
102 | + zero_pad_n(2,d)+"-"+zero_pad_n(2,mon)+"-"+zero_pad_n(4,y)+" "+zero_pad_n(2,h)+":"+zero_pad_n(2,min). | |
103 | + | |
48 | 104 | *** (2) L3LanguageInfo |
49 | 105 | |
50 | 106 | public define L3LanguageInfo | ... | ... |
-
Concernant FastLexer4, le gain de performance se situe à quel niveau ? Au niveau de la compilation du lexer ou de son utilisation ?