private static string CreateErrorMessage(ET errorType, Id errorId,
                                          byte errorColumn, int errorLine)
 {
     string[] codes = SourceCode.Split((char)TT.LF);
     HIDebug.Assert(codes.Length > errorLine);
     return(string.Format(Id.ErrorFormat.ToText(), codes[errorLine],
                          "".PadLeft(errorColumn), errorType, errorId.ToText(), errorLine + 1));
 }
Esempio n. 2
0
        public Token(TT type, string identifier, byte column, int line)
        {
            HIDebug.Assert(type == TT.Identifier || type == TT.String);
            Type   = type;
            Column = column;
            Line   = line;

            if (type == TT.Identifier && Keyword.Find(identifier, out KT keywordType))
            {
                Type        = TT.Keyword;
                KeywordType = keywordType;
            }
            else
            {
                StringId = strings.Count;
                strings.Add(identifier);
            }
        }