Boo.Lang.Parser.SourceLocationFactory.ToLexicalInfo C# (CSharp) Метод

ToLexicalInfo() публичный статический Метод

public static ToLexicalInfo ( antlr token ) : LexicalInfo
token antlr
Результат LexicalInfo
        public static LexicalInfo ToLexicalInfo(antlr.IToken token)
        {
            return new LexicalInfo(token.getFilename(), token.getLine(), token.getColumn());
        }

Usage Example

Пример #1
0
        public static IntegerLiteralExpression ParseIntegerLiteralExpression(antlr.IToken token, string s, bool asLong)
        {
            const string HEX_PREFIX = "0x";

            NumberStyles style     = NumberStyles.Integer | NumberStyles.AllowExponent;
            int          hex_start = s.IndexOf(HEX_PREFIX);
            bool         negative  = false;

            if (hex_start >= 0)
            {
                if (s.StartsWith("-"))
                {
                    negative = true;
                }
                s     = s.Substring(hex_start + HEX_PREFIX.Length);
                style = NumberStyles.HexNumber;
            }

            long value = long.Parse(s, style, CultureInfo.InvariantCulture);

            if (negative)             //negative hex number
            {
                value *= -1;
            }
            return(new IntegerLiteralExpression(SourceLocationFactory.ToLexicalInfo(token), value, asLong || (value > int.MaxValue || value < int.MinValue)));
        }
All Usage Examples Of Boo.Lang.Parser.SourceLocationFactory::ToLexicalInfo