Move token string length from magic number to constant.
parent
b3e5c89ba9
commit
290e1df893
|
@ -119,7 +119,7 @@ fn build_keys() map_int {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_token_str() []string {
|
fn build_token_str() []string {
|
||||||
mut s := [''; 140]// TODO define a const
|
mut s := [''; NrTokens]
|
||||||
s[keyword_beg] = ''
|
s[keyword_beg] = ''
|
||||||
s[keyword_end] = ''
|
s[keyword_end] = ''
|
||||||
s[EOF] = 'EOF'
|
s[EOF] = 'EOF'
|
||||||
|
@ -217,6 +217,7 @@ fn build_token_str() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
NrTokens = 140
|
||||||
TOKENSTR = build_token_str()
|
TOKENSTR = build_token_str()
|
||||||
KEYWORDS = build_keys()
|
KEYWORDS = build_keys()
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue