xref: /OpenGrok/opengrok-indexer/src/main/jflex/analysis/rust/Rust.lexh (revision d219b4cea555a12b602d2d5518daa22134ad4879)
1*d219b4ceSAdam Hornacek/*
2*d219b4ceSAdam Hornacek * CDDL HEADER START
3*d219b4ceSAdam Hornacek *
4*d219b4ceSAdam Hornacek * The contents of this file are subject to the terms of the
5*d219b4ceSAdam Hornacek * Common Development and Distribution License (the "License").
6*d219b4ceSAdam Hornacek * You may not use this file except in compliance with the License.
7*d219b4ceSAdam Hornacek *
8*d219b4ceSAdam Hornacek * See LICENSE.txt included in this distribution for the specific
9*d219b4ceSAdam Hornacek * language governing permissions and limitations under the License.
10*d219b4ceSAdam Hornacek *
11*d219b4ceSAdam Hornacek * When distributing Covered Code, include this CDDL HEADER in each
12*d219b4ceSAdam Hornacek * file and include the License file at LICENSE.txt.
13*d219b4ceSAdam Hornacek * If applicable, add the following below this CDDL HEADER, with the
14*d219b4ceSAdam Hornacek * fields enclosed by brackets "[]" replaced with your own identifying
15*d219b4ceSAdam Hornacek * information: Portions Copyright [yyyy] [name of copyright owner]
16*d219b4ceSAdam Hornacek *
17*d219b4ceSAdam Hornacek * CDDL HEADER END
18*d219b4ceSAdam Hornacek */
19*d219b4ceSAdam Hornacek
20*d219b4ceSAdam Hornacek/*
21*d219b4ceSAdam Hornacek * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
22*d219b4ceSAdam Hornacek * Portions Copyright (c) 2016 Nikolay Denev.
23*d219b4ceSAdam Hornacek * Portions Copyright (c) 2017, Chris Fraire <cfraire@me.com>.
24*d219b4ceSAdam Hornacek */
25*d219b4ceSAdam Hornacek
26*d219b4ceSAdam HornacekIdentifier = ([\p{XID_Start}][\p{XID_Continue}]* | [_][\p{XID_Continue}]+)
27*d219b4ceSAdam Hornacek
28*d219b4ceSAdam HornacekHEXDIG = [0-9A-Fa-f]
29*d219b4ceSAdam HornacekDIGIT  = [0-9]
30*d219b4ceSAdam HornacekOCTDIG = [0-7]
31*d219b4ceSAdam HornacekBINDIG = [01]
32*d219b4ceSAdam Hornacek
33*d219b4ceSAdam HornacekInteger_suffix = [_]* ("u8" | "i8" | "u16" | "i16" | "u32" | "i32" | "u64" |
34*d219b4ceSAdam Hornacek    "i64" | "isize" | "usize")
35*d219b4ceSAdam HornacekFp_suffix = [_]* ("f32" | "f64")
36*d219b4ceSAdam HornacekDecimal_integer = {DIGIT} ([_]*{DIGIT})* {Integer_suffix}?
37*d219b4ceSAdam HornacekHex_integer = 0[x] {HEXDIG} ([_]*{HEXDIG})* {Integer_suffix}?
38*d219b4ceSAdam HornacekOctal_integer = 0[o] {OCTDIG} ([_]*{OCTDIG})* {Integer_suffix}?
39*d219b4ceSAdam HornacekBinary_integer = 0[b] {BINDIG} ([_]*{BINDIG})* {Integer_suffix}?
40*d219b4ceSAdam HornacekFloating_point = ({DIGIT} ([_]*{DIGIT})* \. {DIGIT} ([_]*{DIGIT})* |
41*d219b4ceSAdam Hornacek    {DIGIT} ([_]*{DIGIT})*) ([eE][+-]?{DIGIT}+)? {Fp_suffix}?
42*d219b4ceSAdam HornacekNumber = ({Decimal_integer} | {Hex_integer} | {Octal_integer} |
43*d219b4ceSAdam Hornacek    {Binary_integer} | {Floating_point})
44