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 * Copyright (c) 2017, Chris Fraire <cfraire@me.com>. 23 */ 24 25Identifier = [a-zA-Z_] [a-zA-Z0-9_-]* 26SimpleVariable = [\$] [a-zA-Z_] [a-zA-Z0-9_:-]* 27ComplexVariable = [\$] "{" [^}]+ "}" 28 29Label = {WhspChar}* ":" {Identifier} 30 31Operator = "-" [a-zA-Z]+ 32Break = "break" {WhspChar}+ {Identifier} 33Continue = "continue" {WhspChar}+ {Identifier} 34DataType = "[" [a-zA-Z_] [a-zA-Z0-9_.-]* "[]"? "]" 35 36/* The following should be matched by the 'Number' pattern below. 37 * '\$ [0-9]+' : 38 * $1 $2 $10 ... (references to a regex match operation) 39 * 40 * '0[xX][0-9a-fA-F]+[lL]?' : 41 * 0xA 0X12A 0x12L ... (hex values with optional 'L'ong data type) 42 * 43 * '(\.[0-9]+|[0-9]+(\.[0-9]*)?)' : 44 * .45 0.45 12. 34 ... (integers and real numbers) 45 * 46 * '([eE][+-]*[0-9]+)?' : (optional exponential) 47 * e+12 in 32.e+12 48 * E-231 in 123.456E-231 49 * 50 * '[dDlL]?' : (optional 'double' or 'long' data type designation) 51 * 1.20d 1.23450e1d 1.2345e-1D 52 * 53 * {MultiplierSuffix} : (optional multiplier suffix) 54 * kb, Kb, KB (kilobyte, 1024) 55 * mb, Mb, MB (megabyte, 1024 x 1024) 56 * gb, Gb, GB (gigabyte, 1024 x 1024 x 1024) 57 * tb, Tb, TB (terabyte, 1024 x 1024 x 1024 x 1024) 58 * pb, Pb, PB (petabyte, 1024 x 1024 x 1024 x 1024 x 1024) 59 * 60 * 1kb 1.30Dmb 0x10Gb 1.4e23Tb 0x12Lpb 61 */ 62RegExGroup = \$ [0-9]+ 63MultiplierSuffix = ([kKmMgGtTp][bB])? 64 65Number = {RegExGroup} | (0[xX][0-9a-fA-F]+[lL]? | 66 (\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][+-]*[0-9]+)?[dDlL]? ) {MultiplierSuffix} 67