xref: /OpenGrok/opengrok-indexer/src/main/jflex/analysis/swift/Swift.lexh (revision d219b4cea555a12b602d2d5518daa22134ad4879)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * See LICENSE.txt included in this distribution for the specific
9 * language governing permissions and limitations under the License.
10 *
11 * When distributing Covered Code, include this CDDL HEADER in each
12 * file and include the License file at LICENSE.txt.
13 * If applicable, add the following below this CDDL HEADER, with the
14 * fields enclosed by brackets "[]" replaced with your own identifying
15 * information: Portions Copyright [yyyy] [name of copyright owner]
16 *
17 * CDDL HEADER END
18 */
19
20/*
21 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
22 * Portions Copyright (c) 2017, Chris Fraire <cfraire@me.com>.
23 */
24
25Identifier = {identifier0} {identifier_n}*
26
27identifier0 = ([a-zA-Z_] | [\u{00A8}\u{00AA}\u{00AD}\u{00AF}] |
28    [\u{00B2}–\u{00B5}] | [\u{00B7}–\u{00BA}] | [\u{00BC}–\u{00BE}] |
29    [\u{00C0}–\u{00D6}] | [\u{00D8}–\u{00F6}] | [\u{00F8}–\u{00FF}] |
30    [\u{0100}–\u{02FF}] | [\u{0370}–\u{167F}] | [\u{1681}–\u{180D}] |
31    [\u{180F}–\u{1DBF}] | [\u{1E00}–\u{1FFF}] | [\u{200B}–\u{200D}] |
32    [\u{202A}–\u{202E}] | [\u{203F}–\u{2040}] | [\u{2054}] |
33    [\u{2060}–\u{206F}] | [\u{2070}–\u{20CF}] | [\u{2100}–\u{218F}] |
34    [\u{2460}–\u{24FF}] | [\u{2776}–\u{2793}] | [\u{2C00}–\u{2DFF}] |
35    [\u{2E80}–\u{2FFF}] | [\u{3004}–\u{3007}] | [\u{3021}–\u{302F}] |
36    [\u{3031}–\u{303F}] | [\u{3040}–\u{D7FF}] | [\u{F900}–\u{FD3D}] |
37    [\u{FD40}–\u{FDCF}] | [\u{FDF0}–\u{FE1F}] | [\u{FE30}–\u{FE44}] |
38    [\u{FE47}–\u{FFFD}] | [\u{10000}–\u{1FFFD}] | [\u{20000}–\u{2FFFD}] |
39    [\u{30000}–\u{3FFFD}] | [\u{40000}–\u{4FFFD}] | [\u{50000}–\u{5FFFD}] |
40    [\u{60000}–\u{6FFFD}] | [\u{70000}–\u{7FFFD}] | [\u{80000}–\u{8FFFD}] |
41    [\u{90000}–\u{9FFFD}] | [\u{A0000}–\u{AFFFD}] | [\u{B0000}–\u{BFFFD}] |
42    [\u{C0000}–\u{CFFFD}] | [\u{D0000}–\u{DFFFD}] | [\u{E0000}–\u{EFFFD}])
43
44identifier_n = ([0-9] | [\u{0300}–\u{036F}] | [\u{1DC0}–\u{1DFF}] |
45    [\u{20D0}–\u{20FF}] | [\u{FE20}–\u{FE2F}] | {identifier0})
46
47ImplicitIdentifier = \$ [0-9]+
48
49Number = ({binary} | {octal} | {hexadecimal} | \-?({decimal} | {floating}))
50binary = 0[bB][01_][01_]*
51octal = 0[oO][0-7][0-7_]*
52hexadecimal = 0[xX] {hexadecimal0}
53hexadecimal0 = [0-9a-fA-F][0-9a-fA-F_]*
54decimal = [0-9][0-9_]*
55floating = ({decimal} ("." {decimal})? ([eE] [\+\-]? {decimal})? |
56    {hexadecimal} ("." {hexadecimal0})? ([pP] [\+\-]? {decimal})?)
57