Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOIsNumberLiteral.h
Go to the documentation of this file.
1/*
2 OOISNumberLiteral.h
3
4 Utility function to recognize certain number literals, corresponding to
5 C-style decimal integer literals and floating point literals without
6 trailing type suffixes.
7
8
9 Copyright (C) 2008-2013 Jens Ayton
10
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions:
17
18 The above copyright notice and this permission notice shall be included in all
19 copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 SOFTWARE.
28*/
29
30#import "OOCocoa.h"
31
32
33/* Recognise C-style decimal integer or float literals, without type suffix.
34 More formally, it tests against the following grammar:
35
36 number ::= [<whitespace>] [<sign>] basicNumber [<exponent>] [<whitespace>]
37 whitespace ::= <whitespaceChar> [<whitespace>]
38 whitespaceChar ::= " " | "\t"
39 sign ::= "+" | "-"
40 basicNumber = integer [decimal] | decimal
41 integer ::= <digit> [<integer>]
42 digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
43 decimal ::= <decimalPoint> <integer>
44 decimalPoint ::= "."
45 exponent = <e> [<sign>] <integer>
46 e ::= "e" | "E"
47
48 if allowSpaces = NO, the [<whitespace>] terms are excluded.
49*/
50BOOL OOIsNumberLiteral(NSString *string, BOOL allowSpaces);
BOOL OOIsNumberLiteral(NSString *string, BOOL allowSpaces)