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) 2015, 2016, Oracle and/or its affiliates. All rights reserved. 22 * Copyright (c) 2017, Chris Fraire <cfraire@me.com>. 23 * 24 * Copyright (c) Simon Peyton Jones. 25 * Copyright (c) Simon Marlow. 26 * The authors and publisher intend this Report to belong to the entire Haskell 27 * community, and grant permission to copy and distribute it for any purpose, 28 * provided that it is reproduced in its entirety, including this Notice. 29 * Modified versions of this Report may also be copied and distributed for any 30 * purpose, provided that the modified version is clearly presented as such, 31 * and that it does not claim to be a definition of the language Haskell 2010. 32 */ 33 34Identifier = ({varid} | {conid}) 35/* 36 * varid → (small {small | large | digit | ' })⟨reservedid⟩ 37 * ; N.b. "except {reservedid} is excluded from OpenGrok's varid definition 38 */ 39varid = {small} ({small} | {large} | {digit} | [\'])* 40/* 41 * conid → large {small | large | digit | ' } 42 */ 43conid = {large} ({small} | {large} | {digit} | [\'])* 44/* 45 * small → ascSmall | uniSmall | _ 46 * ascSmall → a | b | … | z 47 * uniSmall → any Unicode lowercase letter 48 */ 49small = [a-z\p{Ll}_] 50/* 51 * large → ascLarge | uniLarge 52 * ascLarge → A | B | … | Z 53 * uniLarge → any uppercase or titlecase Unicode letter 54 */ 55large = [A-Z\p{Lu}\p{Lt}] 56/* 57 * digit → ascDigit | uniDigit 58 * ascDigit → 0 | 1 | … | 9 59 * uniDigit → any Unicode decimal digit 60 * octit → 0 | 1 | … | 7 61 * hexit → digit | A | … | F | a | … | f 62 */ 63digit = [0-9\p{Nd}] 64octit = [0-7] 65hexit = [0-9\p{Nd}A-Fa-f] 66 67Number = ({integer} | {float}) 68/* 69 * decimal → digit{digit} 70 * octal → octit{octit} 71 * hexadecimal → hexit{hexit} 72 */ 73decimal = {digit}+ 74octal = {octit}+ 75hexadecimal = {hexit}+ 76/* 77 * 78 * integer → decimal 79 * | 0o octal | 0O octal 80 * | 0x hexadecimal | 0X hexadecimal 81 */ 82integer = ({decimal} | [0][oO]{octal} | [0][xX]{hexadecimal}) 83/* 84 * float → decimal . decimal [exponent] 85 * | decimal exponent 86 */ 87float = ({decimal} [\.] {decimal} {exponent}? | 88 {decimal} {exponent}) 89/* 90 * exponent → (e | E) [+ | -] decimal 91 */ 92exponent = [eE] [\+\-]? {decimal} 93 94/* 95 * "For example, '-->' or '|--' do not begin a comment, because both of these 96 * are legal lexemes;" 97 */ 98NotComments = ("-->" | "|--") 99