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