From 290e1df8931cb76f8c538b760b608e8590d71d84 Mon Sep 17 00:00:00 2001 From: Ivan Sharavuev Date: Wed, 3 Jul 2019 10:14:10 +0300 Subject: [PATCH] Move token string length from magic number to constant. --- compiler/token.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/token.v b/compiler/token.v index 894bc815e4..309125e57a 100644 --- a/compiler/token.v +++ b/compiler/token.v @@ -119,7 +119,7 @@ fn build_keys() map_int { } fn build_token_str() []string { - mut s := [''; 140]// TODO define a const + mut s := [''; NrTokens] s[keyword_beg] = '' s[keyword_end] = '' s[EOF] = 'EOF' @@ -217,6 +217,7 @@ fn build_token_str() []string { } const ( + NrTokens = 140 TOKENSTR = build_token_str() KEYWORDS = build_keys() )