-
Notifications
You must be signed in to change notification settings - Fork 38
/
implicit.re
105 lines (74 loc) · 2.83 KB
/
implicit.re
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include "yaml.h"
char *Ryaml_find_implicit_tag(const char *str, size_t len)
{
/* This bit was taken from implicit.re, which is in the Syck library.
*
* Copyright (C) 2003 why the lucky stiff */
const char *cursor, *marker;
cursor = str;
/*!re2c
re2c:define:YYCTYPE = "char";
re2c:define:YYCURSOR = cursor;
re2c:define:YYMARKER = marker;
re2c:yyfill:enable = 0;
NULL = [\000] ;
ANY = [\001-\377] ;
DIGIT = [0-9] ;
DIGITSC = [0-9,] ;
DIGITSP = [0-9.] ;
YEAR = DIGIT DIGIT DIGIT DIGIT ;
MON = DIGIT DIGIT ;
SIGN = [-+] ;
HEX = [0-9a-fA-F,] ;
OCT = [0-7,] ;
INTHEX = SIGN? "0x" HEX+ ;
INTOCT = SIGN? "0" OCT+ ;
INTSIXTY = SIGN? DIGIT DIGITSC* ( ":" [0-5]? DIGIT )+ ;
INTCANON = SIGN? ( "0" | [1-9] DIGITSC* ) ;
FLOATFIX = SIGN? ( DIGIT DIGITSC* )? "." DIGITSC* ;
FLOATEXP = SIGN? ( DIGIT DIGITSC* )? "." DIGITSP* [eE] SIGN DIGIT+ ;
FLOATSIXTY = SIGN? DIGIT DIGITSC* ( ":" [0-5]? DIGIT )+ "." DIGITSC* ;
INF = ( "inf" | "Inf" | "INF" ) ;
FLOATINF = [+]? "." INF ;
FLOATNEGINF = [-] "." INF ;
FLOATNAN = "." ( "nan" | "NaN" | "NAN" ) ;
NULLTYPE = ( "~" | "null" | "Null" | "NULL" )? ;
BOOLYES = ( "y" | "Y" | "yes" | "Yes" | "YES" | "true" | "True" | "TRUE" | "on" | "On" | "ON" ) ;
BOOLNO = ( "n" | "N" | "no" | "No" | "NO" | "false" | "False" | "FALSE" | "off" | "Off" | "OFF" ) ;
INTNA = ".na.integer" ;
FLOATNA = ".na.real" ;
STRNA = ".na.character" ;
BOOLNA = ".na" ;
TIMEZ = ( "Z" | [-+] DIGIT DIGIT ( ":" DIGIT DIGIT )? ) ;
TIMEYMD = YEAR "-" MON "-" MON ;
TIMEISO = YEAR "-" MON "-" MON [Tt] MON ":" MON ":" MON ( "." DIGIT* )? TIMEZ ;
TIMESPACED = YEAR "-" MON "-" MON [ \t]+ MON ":" MON ":" MON ( "." DIGIT* )? [ \t]+ TIMEZ ;
TIMECANON = YEAR "-" MON "-" MON "T" MON ":" MON ":" MON ( "." DIGIT* [1-9]+ )? "Z" ;
MERGE = "<<" ;
DEFAULTKEY = "=" ;
NULLTYPE NULL { return "null"; }
BOOLYES NULL { return "bool#yes"; }
BOOLNO NULL { return "bool#no"; }
BOOLNA NULL { return "bool#na"; }
INTHEX NULL { return "int#hex"; }
INTOCT NULL { return "int#oct"; }
INTSIXTY NULL { return "int#base60"; }
INTNA NULL { return "int#na"; }
INTCANON NULL { return "int"; }
FLOATFIX NULL { return "float#fix"; }
FLOATEXP NULL { return "float#exp"; }
FLOATSIXTY NULL { return "float#base60"; }
FLOATINF NULL { return "float#inf"; }
FLOATNEGINF NULL { return "float#neginf"; }
FLOATNAN NULL { return "float#nan"; }
FLOATNA NULL { return "float#na"; }
TIMEYMD NULL { return "timestamp#ymd"; }
TIMEISO NULL { return "timestamp#iso8601"; }
TIMESPACED NULL { return "timestamp#spaced"; }
TIMECANON NULL { return "timestamp"; }
STRNA NULL { return "str#na"; }
DEFAULTKEY NULL { return "default"; }
MERGE NULL { return "merge"; }
ANY { return "str"; }
*/
}