summaryrefslogtreecommitdiff
path: root/language/hebrew/makor/omega/otp/makor2/m2numeral.otp
blob: 1f56cca68ff00da6634c15c78c290c7c8079d3a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%% Provide for left-to-right numerals in the right-to-left Semitic
%% mode...

input:	
	1
	;
output:
	1
	;
states:
	NUMERIC,
	ALPHA
	;
aliases:
	DIGIT	= (48-57) % the numbers!
		;
	DOT	= 46 % the PERIOD!
		;
%% A NUMBER is any sequence consisting of digits possibly containing a
%% dot.  Currently, we do not allow the possibility of a comma serving
%% as the decimal point.  Nor do we permit leading plus/minus sign---
%% this isn't math mode.  Numbers are terminated by non-number, or by a
%% dot NOT followed by another digit.  
	NONDIGIT	= ^({DIGIT})
		;
	DIGORDOT	= ({DIGIT}|{DOT})
		;
expressions:
%% Special case: single digit
	{NONDIGIT}{DIGIT}{NONDIGIT}	=> \(* - 1)
					<= \$
		;
	{NONDIGIT}{DIGIT} end:	=> \*
		;
%% A number begins...

%% If the number begins with a dot, it must be followed by a pure
%%					digit.
	{DOT}{DIGIT}	=> "\startnum!." 
			<= \$ <push: NUMERIC> 
		;
%% A non-single digit can also start the number.
	{NONDIGIT}{DIGIT}	=> \1 "\startnum!"
				<= \$ <push: NUMERIC>
			;
%% The number ends...
	<NUMERIC>{DIGORDOT}{NONDIGIT}	=> \1 "\endnum!"
					       <= \$ <pop:>
					       ; 
	<NUMERIC>{DIGORDOT} end:    	=> \1 "\endnum!"
					       ; 
%% The number continues...
	<NUMERIC>{DIGORDOT}	=> \1
		;