%% 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!." <= \$ ; %% A non-single digit can also start the number. {NONDIGIT}{DIGIT} => \1 "\startnum!" <= \$ ; %% The number ends... {DIGORDOT}{NONDIGIT} => \1 "\endnum!" <= \$ ; {DIGORDOT} end: => \1 "\endnum!" ; %% The number continues... {DIGORDOT} => \1 ;