forked from jamiejennings/rosie-pattern-language
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic.rpl
54 lines (41 loc) · 1.52 KB
/
basic.rpl
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
---- -*- Mode: rpl; -*-
----
---- basic.rpl A set of basic patterns that can be used to look for interesting things when the
---- input structure is unknown.
----
---- © Copyright IBM Corporation 2016.
---- LICENSE: MIT License (https://opensource.org/licenses/mit-license.html)
---- AUTHOR: Jamie A. Jennings
-- requires common, datetime, network
alias basic.element = (common.number ~) / (common.maybe_identifier ~) / common.identifier_not_word /
common.word / common.path
alias basic.element_quoted = "\"" basic.element "\""
alias basic.element_bracketed = "[" basic.element "]"
basic.unmatched = {![:space:] any}+
basic.datetime_patterns =
datetime.datetime_RFC3339 /
datetime.slash_datetime /
datetime.simple_slash_date /
datetime.shortdate /
datetime.ordinary_date /
datetime.simple_date /
datetime.full_date_RFC3339 /
datetime.date_RFC2822 /
datetime.time_RFC2822 /
datetime.full_time_RFC3339 /
datetime.simple_time /
datetime.funny_time
basic.network_patterns =
network.http_command /
network.url /
-- network.http_version /
network.ip_address /
network.fqdn /
network.email_address
basic.punctuation = [:punct:]
basic.matchall = ( basic.datetime_patterns / basic.network_patterns /
basic.element / basic.element_quoted / basic.element_bracketed /
[:space:]+ /
basic.punctuation /
basic.unmatched
)+