added jj_temporal source code
This commit is contained in:
10
jj_temporal/parsers/classes/ymd_time_parser.e
Normal file
10
jj_temporal/parsers/classes/ymd_time_parser.e
Normal file
@@ -0,0 +1,10 @@
|
||||
note
|
||||
description: "Summary description for {YMD_TIME_PARSER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
YMD_TIME_PARSER
|
||||
|
||||
end
|
130
jj_temporal/parsers/classes/ymd_time_parser_routines.e
Normal file
130
jj_temporal/parsers/classes/ymd_time_parser_routines.e
Normal file
@@ -0,0 +1,130 @@
|
||||
note
|
||||
description: "[
|
||||
Routines used by the {YMD_TIME_PARSER}. These were put here to
|
||||
ease the editting. The text of class {YMD_TIME_PARSER} is produced
|
||||
by "geyacc" from a discription file, so every time a change is
|
||||
made "geyacc" must be run (from a dos prompt), the files moved, etc.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
copyright: "Copyright 2009, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum License v2 (see forum.txt)"
|
||||
URL: "$URL:$"
|
||||
date: "$Date: 2009-06-25 21:37:23 -0400 (Thu, 25 Jun 2009) $"
|
||||
revision: "$Revision: 7 $"
|
||||
|
||||
class YMD_TIME_PARSER_ROUTINES
|
||||
|
||||
inherit
|
||||
|
||||
YMD_TIME_FORMAT_CONSTANTS
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
YMD_TIME_SCANNER_ROUTINES
|
||||
|
||||
feature -- Access
|
||||
|
||||
format: INTEGER
|
||||
-- How the date should appear (i.e. "dd mmm yyyy", "mm/dd/yy", etc
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_format (a_format: INTEGER)
|
||||
-- Change `format'
|
||||
require
|
||||
valid_format: is_valid_format (a_format)
|
||||
do
|
||||
format := a_format
|
||||
ensure
|
||||
format_was_set: format = a_format
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
process_ambiguous_day (a_possible_day, a_month, a_year: INTEGER): detachable YMD_TIME
|
||||
-- Return a date if `a_possible_day' is valid for the know values of
|
||||
-- `a_month' and `a_year'; void otherwise.
|
||||
require
|
||||
valid_month: a_month >= 1 and a_month <= 12
|
||||
valid_year: a_year /= 0
|
||||
local
|
||||
d: YMD_TIME
|
||||
do
|
||||
create d.set (a_year, a_month, 1)
|
||||
if a_possible_day >= 1 and a_possible_day <= d.last_day_of_month then
|
||||
create Result.set (a_year, a_month, a_possible_day)
|
||||
end
|
||||
end
|
||||
|
||||
process_ambiguous_day_month (a_possible_day, a_possible_month, a_year: INTEGER): YMD_TIME
|
||||
-- Only the year is known; determine which of the other two values is
|
||||
-- the month and which is the day.
|
||||
require
|
||||
valid_year: a_year /= 0
|
||||
unknown_day_from_scanner: a_possible_day <= 12
|
||||
unknown_month_from_scanner: a_possible_month <= 12
|
||||
do
|
||||
create Result.set (a_year, a_possible_month, a_possible_day)
|
||||
end
|
||||
|
||||
process_ambiguous_day_year (a_possible_day, a_month, a_possible_year: INTEGER): YMD_TIME
|
||||
-- Only the month is know for sure.
|
||||
require
|
||||
valid_month: a_month >= 1 and a_month <= 12
|
||||
unknown_day_from_scanner: a_possible_day <= 12
|
||||
unknown_year_from_scanner: a_possible_year <= 12
|
||||
do
|
||||
create Result.set (a_possible_day, a_month, a_possible_year)
|
||||
end
|
||||
|
||||
process_unspecified (a_day, a_month, a_year: INTEGER): YMD_TIME
|
||||
-- One of `a_day' or `a_year' was not specified in the scanned string.
|
||||
-- The unspecified one will be 0.
|
||||
require
|
||||
one_zero: a_day = 0 or a_year = 0
|
||||
valid_month: a_month >= 1 and a_month <= 12
|
||||
local
|
||||
d: YMD_TIME
|
||||
do
|
||||
if a_day = 0 then
|
||||
create Result.set (a_year, a_month, 1)
|
||||
else
|
||||
create d.set_now
|
||||
create Result.set_now
|
||||
Result.set_day (a_day)
|
||||
Result.set_month (a_month)
|
||||
if Result < d then
|
||||
Result.set_year (Result.year + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
process_three_numbers (int_1, int_2, int_3: INTEGER): YMD_TIME
|
||||
-- Scanner encountered a three-integer date and was unable to determine
|
||||
-- from the context what any of them mean.
|
||||
require
|
||||
int_1_is_number: int_1 >= 1 and int_1 <= 31
|
||||
int_2_is_number: int_2 >= 1 and int_2 <= 31
|
||||
int_3_is_number: int_3 >= 1 and int_3 <= 31
|
||||
do
|
||||
|
||||
create Result.set (int_1, int_2, int_3)
|
||||
end
|
||||
|
||||
process_two_numbers (int_1, int_2: INTEGER): YMD_TIME
|
||||
-- Scanner only found 2 numbers and unknow what they represent.
|
||||
require
|
||||
int_1_is_number: int_1 >= 1 and int_1 <= 31
|
||||
int_2_is_number: int_2 >= 1 and int_2 <= 31
|
||||
do
|
||||
create Result.set_now
|
||||
Result.set_day (int_1)
|
||||
Result.set_month (int_2)
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
valid_ymd_time_format: is_valid_format (format)
|
||||
|
||||
end -- Class YMD_TIME_PARSER_ROUTINES
|
69
jj_temporal/parsers/classes/ymd_time_scanner_routines.e
Normal file
69
jj_temporal/parsers/classes/ymd_time_scanner_routines.e
Normal file
@@ -0,0 +1,69 @@
|
||||
note
|
||||
description: "[
|
||||
Routines used by the {YMD_TIME_SCANNER}. These were put here to
|
||||
ease the editting. The text of class {YMD_TIME_SCANNER} is produced
|
||||
by "gelex" from a discription file, so every time a change is
|
||||
made "geyacc" must be run (from a dos prompt), the files moved, etc.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
copyright: "Copyright 2009, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum License v2 (see forum.txt)"
|
||||
URL: "$URL:$"
|
||||
date: "$Date: 2009-06-25 21:37:23 -0400 (Thu, 25 Jun 2009) $"
|
||||
revision: "$Revision: 7 $"
|
||||
|
||||
class
|
||||
YMD_TIME_SCANNER_ROUTINES
|
||||
|
||||
inherit
|
||||
|
||||
YMD_TIME_FORMAT_CONSTANTS
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature {NONE} -- Inititalization
|
||||
|
||||
default_create
|
||||
|
||||
-- Create an instance
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
last_string: detachable STRING
|
||||
-- Last string value read to pass to parser
|
||||
|
||||
last_integer: INTEGER
|
||||
-- Last integer value read to pass to parser.
|
||||
|
||||
last_value: detachable ANY
|
||||
-- Last value read by the scanner
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
comas_removed (a_number_string: STRING): STRING
|
||||
-- Return the string without comas.
|
||||
-- Used to remove comas from reals or strings.
|
||||
local
|
||||
s: STRING
|
||||
i, n: INTEGER
|
||||
c: CHARACTER
|
||||
do
|
||||
create Result.make (200)
|
||||
s := a_number_string
|
||||
n := a_number_string.count
|
||||
from i := 1 until i > n
|
||||
loop
|
||||
c := s.item (i)
|
||||
if c /= ',' then
|
||||
Result.append_character (c)
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end -- class YMD_TIME_SCANNER_ROUTINES
|
49
jj_temporal/parsers/classes/ymd_time_tokens.e
Normal file
49
jj_temporal/parsers/classes/ymd_time_tokens.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
|
||||
description: "Parser token codes"
|
||||
generator: "geyacc version 3.4"
|
||||
|
||||
class YMD_TIME_TOKENS
|
||||
|
||||
|
||||
feature -- Last values
|
||||
|
||||
last_any_value: detachable ANY
|
||||
|
||||
feature -- Access
|
||||
|
||||
token_name (a_token: INTEGER): STRING
|
||||
-- Name of token `a_token'
|
||||
do
|
||||
inspect a_token
|
||||
when 0 then
|
||||
Result := "EOF token"
|
||||
when -1 then
|
||||
Result := "Error token"
|
||||
when SCAN_ERROR_TOKEN then
|
||||
Result := "SCAN_ERROR_TOKEN"
|
||||
when WEEKDAY_TOKEN then
|
||||
Result := "WEEKDAY_TOKEN"
|
||||
when YEAR_TOKEN then
|
||||
Result := "YEAR_TOKEN"
|
||||
when MONTH_TOKEN then
|
||||
Result := "MONTH_TOKEN"
|
||||
when YEAR_OR_DAY_TOKEN then
|
||||
Result := "YEAR_OR_DAY_TOKEN"
|
||||
when NUMBER_TOKEN then
|
||||
Result := "NUMBER_TOKEN"
|
||||
else
|
||||
Result := "Unknown token"
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Token codes
|
||||
|
||||
SCAN_ERROR_TOKEN: INTEGER = 258
|
||||
WEEKDAY_TOKEN: INTEGER = 259
|
||||
YEAR_TOKEN: INTEGER = 260
|
||||
MONTH_TOKEN: INTEGER = 261
|
||||
YEAR_OR_DAY_TOKEN: INTEGER = 262
|
||||
NUMBER_TOKEN: INTEGER = 263
|
||||
|
||||
end
|
BIN
jj_temporal/parsers/gobo_files/gelex.exe
Normal file
BIN
jj_temporal/parsers/gobo_files/gelex.exe
Normal file
Binary file not shown.
BIN
jj_temporal/parsers/gobo_files/geyacc.exe
Normal file
BIN
jj_temporal/parsers/gobo_files/geyacc.exe
Normal file
Binary file not shown.
BIN
jj_temporal/parsers/gobo_files/old_gelex.exe
Normal file
BIN
jj_temporal/parsers/gobo_files/old_gelex.exe
Normal file
Binary file not shown.
BIN
jj_temporal/parsers/gobo_files/old_geyacc.exe
Normal file
BIN
jj_temporal/parsers/gobo_files/old_geyacc.exe
Normal file
Binary file not shown.
7
jj_temporal/parsers/gobo_files/y.bat
Normal file
7
jj_temporal/parsers/gobo_files/y.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
cd d:
|
||||
cd e_source
|
||||
cd parser_tests
|
||||
cd date_parser
|
||||
cd discription_files
|
||||
geyacc -t ymd_time_tokens -o ymd_time_parser.e ymd_time_parser.y
|
||||
gelex -o ymd_time_scanner.e ymd_time_scanner.l
|
191
jj_temporal/parsers/gobo_files/ymd_time_parser.y
Normal file
191
jj_temporal/parsers/gobo_files/ymd_time_parser.y
Normal file
@@ -0,0 +1,191 @@
|
||||
%{
|
||||
indexing
|
||||
description: "[
|
||||
Parser for reading in a string and converting it to a date.
|
||||
This file was produced by 'geyacc' (from the gobo tools cluster)
|
||||
using file 'ymd_time_parser.y'.
|
||||
]"
|
||||
date: "17 Aug 04"
|
||||
author: "Jimmy J. Johnson"
|
||||
copyright: "Copyright 2009, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum License v2 (see forum.txt)"
|
||||
URL: "$URL:$"
|
||||
date: "$Date: 2009-06-25 21:37:23 -0400 (Thu, 25 Jun 2009) $"
|
||||
revision: "$Revision: 7 $"
|
||||
|
||||
class YMD_TIME_PARSER
|
||||
|
||||
inherit
|
||||
|
||||
YY_PARSER_SKELETON
|
||||
rename
|
||||
make as make_parser_skeleton
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
YMD_TIME_PARSER_ROUTINES
|
||||
rename
|
||||
last_value as last_scanner_value
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
YMD_TIME_SCANNER
|
||||
rename
|
||||
last_value as last_scanner_value
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
create
|
||||
default_create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
default_create is
|
||||
-- Create a new Eiffel parser.
|
||||
do
|
||||
Precursor {YMD_TIME_SCANNER}
|
||||
make_parser_skeleton
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
last_value: YMD_TIME
|
||||
-- The result of parsing
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
parse_string (a_string: STRING) is
|
||||
-- Parse `a_string'.
|
||||
local
|
||||
b: KL_CHARACTER_BUFFER
|
||||
yy_buf: YY_BUFFER
|
||||
f: FILE
|
||||
s: STRING
|
||||
do
|
||||
reset
|
||||
-- The `b' must end in "%U%U". I don't know why.
|
||||
-- so append it onto the end of a copy of `a_string'.
|
||||
s := deep_clone (a_string)
|
||||
s.append ("%U%U")
|
||||
create b.make_from_string (s)
|
||||
create yy_buf.make_from_buffer (b)
|
||||
set_input_buffer (yy_buf)
|
||||
parse
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
-------------------- Following created by GeYacc ----------------------------------
|
||||
|
||||
|
||||
%}
|
||||
|
||||
%token SCAN_ERROR_TOKEN
|
||||
|
||||
%token WEEKDAY_TOKEN
|
||||
%token YEAR_TOKEN
|
||||
%token MONTH_TOKEN
|
||||
%token YEAR_OR_DAY_TOKEN
|
||||
%token NUMBER_TOKEN
|
||||
|
||||
%type <YMD_TIME> Date
|
||||
%type <YMD_TIME> Ambiguous_day
|
||||
%type <YMD_TIME> Ambiguous_day_month
|
||||
%type <YMD_TIME> Unspecified
|
||||
%type <YMD_TIME> Weekday_included
|
||||
%type <YMD_TIME> Three_numbers
|
||||
%type <YMD_TIME> Two_numbers
|
||||
|
||||
%type <INTEGER> Month
|
||||
%type <INTEGER> Year
|
||||
%type <INTEGER> Year_or_day
|
||||
%type <INTEGER> Number
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
%%
|
||||
|
||||
Date: -- Empty { parsed_result := "No date entered" }
|
||||
| Ambiguous_day { $$ := $1 last_value := $$ }
|
||||
| Ambiguous_day_month { $$ := $1 last_value := $$ }
|
||||
| Unspecified { $$ := $1 last_value := $$ }
|
||||
| Three_numbers { $$ := $1 last_value := $$ }
|
||||
| Two_numbers { $$ := $1 last_value := $$ }
|
||||
| Weekday_included { $$ := $1 last_value := $$ }
|
||||
-- | SCAN_ERROR_TOKEN { $$ := last_scanner_value last_value := $$ }
|
||||
;
|
||||
|
||||
-- The Month and Year are known.
|
||||
Ambiguous_day: Number Month Year { $$ := process_ambiguous_day ($1, $2, $3) }
|
||||
| Year_or_day Month Year { $$ := process_ambiguous_day ($1, $2, $3) }
|
||||
| Month Year_or_day Year { $$ := process_ambiguous_day ($2, $1, $3) }
|
||||
| Month Number Year { $$ := process_ambiguous_day ($2, $1, $3) }
|
||||
;
|
||||
|
||||
-- Only the Year is certain.
|
||||
Ambiguous_day_month: Year_or_day Number Year { $$ := process_ambiguous_day ($1, $2, $3) }
|
||||
| Number Year_or_day Year { $$ := process_ambiguous_day ($2, $1, $3) }
|
||||
| Year Year_or_day Number { $$ := process_ambiguous_day ($2, $3, $1) }
|
||||
| Year Number Year_or_day { $$ := process_ambiguous_day ($3, $2, $1) }
|
||||
| Number Number Year { $$ := process_ambiguous_day_month ($1, $2, $3) }
|
||||
| Year Number Number { $$ := process_ambiguous_day_month ($2, $3, $1) }
|
||||
;
|
||||
|
||||
-- Two values input and at least one can be identified; assumptions are made about the unknowns.
|
||||
Unspecified: Month Year { $$ := process_unspecified (0, $1, $2) }
|
||||
| Year Month { $$ := process_unspecified (0, $2, $1) }
|
||||
| Year_or_day Month { $$ := process_unspecified ($1, $2, 0) }
|
||||
| Month Year_or_day { $$ := process_unspecified ($2, $1, 0) }
|
||||
| Number Year { $$ := process_unspecified (0, $1, $2) }
|
||||
| Year Number { $$ := process_unspecified (0, $2, $1) }
|
||||
| Number Month { $$ := process_unspecified ($1, $2, 0) }
|
||||
| Month Number { $$ := process_unspecified ($2, $1, 0) }
|
||||
;
|
||||
|
||||
-- A date with the weekday included; the weekday is ignored.
|
||||
Weekday_included: Weekday Ambiguous_day { $$ := $2 }
|
||||
| Weekday Ambiguous_day_month { $$ := $2 }
|
||||
| Weekday Unspecified { $$ := $2 }
|
||||
| Weekday Three_numbers { $$ := $2 }
|
||||
| Weekday Two_numbers { $$ := $2 }
|
||||
;
|
||||
|
||||
-- The date is entered as three numbers and scanner is unable to deduce from
|
||||
-- the values which one is day, year, and so on.
|
||||
Three_numbers: Number Number Number { $$ := process_three_numbers ($1, $2, $3) }
|
||||
| Year_or_day Number Number { $$ := process_three_numbers ($1, $2, $3) }
|
||||
| Number Year_or_day Number { $$ := process_three_numbers ($1, $2, $3) }
|
||||
| Number Number Year_or_day { $$ := process_three_numbers ($1, $2, $3) }
|
||||
;
|
||||
|
||||
-- The date was enterred as only two numbers and the scanner was unable
|
||||
-- to deduce thier meanings.
|
||||
Two_numbers: Number Number { $$ := process_two_numbers ($1, $2) }
|
||||
| Year_or_day Number { $$ := process_two_numbers ($1, $2) }
|
||||
| Number Year_or_day { $$ := process_two_numbers ($1, $2) }
|
||||
;
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Weekday: WEEKDAY_TOKEN { -- do nothing as result is not needed
|
||||
}
|
||||
;
|
||||
|
||||
Month: MONTH_TOKEN { $$ := last_integer }
|
||||
;
|
||||
|
||||
Year: YEAR_TOKEN { $$ := last_integer }
|
||||
;
|
||||
|
||||
Year_or_day: YEAR_OR_DAY_TOKEN { $$ := last_integer }
|
||||
;
|
||||
|
||||
Number: NUMBER_TOKEN { $$ := last_integer }
|
||||
;
|
||||
|
||||
|
||||
%%
|
||||
|
||||
end -- class YMD_TIME_PARSER
|
149
jj_temporal/parsers/gobo_files/ymd_time_scanner.l
Normal file
149
jj_temporal/parsers/gobo_files/ymd_time_scanner.l
Normal file
@@ -0,0 +1,149 @@
|
||||
%{
|
||||
indexing
|
||||
description: "[
|
||||
Scanner for reading in a string and converting it to a date.
|
||||
This file was produced by 'gelex' (from the gobo tools cluster)
|
||||
using file "ymd_time_scanner.l".
|
||||
]"
|
||||
date: "17 Aug 04"
|
||||
author: "Jimmy J. Johnson"
|
||||
copyright: "Copyright 2009, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum License v2 (see forum.txt)"
|
||||
URL: "$URL:$"
|
||||
date: "$Date: 2009-06-25 21:37:23 -0400 (Thu, 25 Jun 2009) $"
|
||||
revision: "$Revision: 7 $"
|
||||
|
||||
class YMD_TIME_SCANNER
|
||||
|
||||
inherit
|
||||
|
||||
YY_COMPRESSED_SCANNER_SKELETON
|
||||
export
|
||||
{NONE} all
|
||||
{ANY} scanning_error
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
UT_CHARACTER_CODES
|
||||
export
|
||||
{NONE} all
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
YMD_TIME_TOKENS
|
||||
export
|
||||
{NONE} all
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
YMD_TIME_SCANNER_ROUTINES
|
||||
export
|
||||
{NONE} all
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
create
|
||||
default_create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
default_create is
|
||||
-- Create a scanner object
|
||||
do
|
||||
make
|
||||
Precursor {YMD_TIME_SCANNER_ROUTINES}
|
||||
end
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
scan_string (a_string: STRING) is
|
||||
-- Scan `a_string'
|
||||
local
|
||||
b: KL_CHARACTER_BUFFER
|
||||
yy_buf: YY_BUFFER
|
||||
f: FILE
|
||||
s: STRING
|
||||
do
|
||||
-- The `b' must end in "%U%U". I don't know why.
|
||||
-- so append it onto the end of a copy of `a_string'.
|
||||
s := deep_clone (a_string)
|
||||
s.append ("%U%U")
|
||||
create b.make_from_string (s)
|
||||
create yy_buf.make_from_buffer (b)
|
||||
set_input_buffer (yy_buf)
|
||||
scan
|
||||
end
|
||||
|
||||
print_values is
|
||||
do
|
||||
io.put_string ("token = ")
|
||||
io.put_string (token_name (last_token))
|
||||
io.put_string (" value = ")
|
||||
if last_value /= Void then
|
||||
io.put_string (last_value.out)
|
||||
else
|
||||
io.put_string ("Void")
|
||||
end
|
||||
io.new_line
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
----------------------- Following code produce by Gelex ----------------------
|
||||
|
||||
%}
|
||||
|
||||
--%x IN_STR -- line 50
|
||||
%option outfile="ymd_time_scanner.e"
|
||||
|
||||
|
||||
IDENTIFIER [a-zA-Z][a-zA-Z]*
|
||||
|
||||
DIGIT [0-9]
|
||||
INTEGER {DIGIT}+|{DIGIT}{1,3}(,{DIGIT}{3})+
|
||||
|
||||
SEPARATORS [:./\\,\- \t\n\r]+
|
||||
|
||||
%%
|
||||
|
||||
{INTEGER} {
|
||||
last_integer := comas_removed (text).to_integer
|
||||
last_value := last_integer
|
||||
if last_integer > 31 then
|
||||
last_token := YEAR_TOKEN
|
||||
elseif last_integer > 12 then
|
||||
last_token := YEAR_OR_DAY_TOKEN
|
||||
else
|
||||
last_token := NUMBER_TOKEN
|
||||
end
|
||||
print_values
|
||||
}
|
||||
|
||||
{IDENTIFIER} { if is_month (text) then
|
||||
last_token := MONTH_TOKEN
|
||||
last_integer := get_month (text)
|
||||
last_value := last_integer
|
||||
elseif is_weekday (text) then
|
||||
last_token := WEEKDAY_TOKEN
|
||||
last_string := text
|
||||
last_value := text
|
||||
else
|
||||
last_token := SCAN_ERROR_TOKEN
|
||||
last_value := last_string
|
||||
print_values
|
||||
end
|
||||
print_values
|
||||
}
|
||||
|
||||
{SEPARATORS} { last_value := text
|
||||
print_values
|
||||
}
|
||||
|
||||
|
||||
%%
|
||||
|
||||
|
||||
end -- class YMD_TIME_SCANNER
|
Reference in New Issue
Block a user