Skip to content

Commit f47dfbe

Browse files
authored
Merge pull request #1873 from idodeclare/feature/use_common_lexh
Include Common *.lexh, and use common macros
2 parents 690f131 + ed60a2e commit f47dfbe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1851
-638
lines changed

src/org/opensolaris/opengrok/analysis/Common.lexh

Lines changed: 0 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -24,168 +24,3 @@
2424
WhspChar = [ \t\f]
2525
WhiteSpace = {WhspChar}+
2626
EOL = ([\n\r] | \r\n)
27-
28-
/*
29-
* See org.opensolaris.opengrok.util.StringUtils FNAME_CHARS_PAT where the
30-
* following regex is mirrored.
31-
*/
32-
FNameChar = [a-zA-Z0-9_\-\.]
33-
34-
Path = "/"? [a-zA-Z]{FNameChar}* ("/" [a-zA-Z]{FNameChar}*[a-zA-Z0-9])+
35-
36-
/*
37-
* From RFC-3986. See
38-
* org.opensolaris.opengrok.util.StringUtils URI_CHARS_PAT where a regex
39-
* in accordance with the following definition is maintained.
40-
*
41-
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
42-
*/
43-
BrowseableURI = {BrowseableURI_scheme} {URI_tail}
44-
URI_tail = ":" {URI_hier_part} ("?" {URI_query})? ("#" {URI_fragment})?
45-
46-
/*
47-
* hier-part = "//" authority path-abempty
48-
* / path-absolute
49-
* / path-rootless
50-
* / path-empty ; N.b. not used in OpenGrok
51-
*/
52-
URI_hier_part = ("//" {URI_authority} {URI_path_abempty} |
53-
"/" ({URI_path_absolute} | {URI_path_rootless}))
54-
55-
/*
56-
* scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
57-
*/
58-
BrowseableURI_scheme = ([Hh][Tt][Tt][Pp][Ss]? | [Ff][Tt][Pp])
59-
60-
/*
61-
* authority = [ userinfo "@" ] host [ ":" port ]
62-
* userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
63-
* host = IP-literal / IPv4address / reg-name
64-
* port = *DIGIT
65-
*/
66-
URI_authority = ({URI_userinfo} "@")? {URI_host} (":" {URI_port})?
67-
URI_userinfo = ({URI_unreserved} | {URI_pct_encoded} | {URI_sub_delims} |
68-
":")*
69-
URI_host = ({URI_IP_literal} | {URI_IPv4address} | {URI_reg_name})
70-
URI_port = {DIGIT}*
71-
72-
/*
73-
* IP-literal = "[" ( IPv6address / IPvFuture ) "]"
74-
*/
75-
URI_IP_literal = "[" ({URI_IPv6address} | {URI_IPvFuture}) "]"
76-
77-
/*
78-
* IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
79-
*/
80-
URI_IPvFuture = "v" {HEXDIG}+ "." ({URI_unreserved} | {URI_sub_delims} |
81-
":")+
82-
83-
/*
84-
* IPv6address = 6( h16 ":" ) ls32
85-
* / "::" 5( h16 ":" ) ls32
86-
* / [ h16 ] "::" 4( h16 ":" ) ls32
87-
* / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
88-
* / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
89-
* / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
90-
* / [ *4( h16 ":" ) h16 ] "::" ls32
91-
* / [ *5( h16 ":" ) h16 ] "::" h16
92-
* / [ *6( h16 ":" ) h16 ] "::"
93-
*/
94-
URI_IPv6address = (
95-
( {URI_h16} ":" ){6} {URI_ls32} |
96-
"::" ({URI_h16} ":"){5} {URI_ls32} |
97-
({URI_h16})? "::" ({URI_h16} ":"){4} {URI_ls32} |
98-
(({URI_h16} ":"){0,1} {URI_h16})? "::" ({URI_h16} ":"){3} {URI_ls32} |
99-
(({URI_h16} ":"){0,2} {URI_h16})? "::" ({URI_h16} ":"){2} {URI_ls32} |
100-
(({URI_h16} ":"){0,3} {URI_h16})? "::" {URI_h16} ":" {URI_ls32} |
101-
(({URI_h16} ":"){0,4} {URI_h16})? "::" {URI_ls32} |
102-
(({URI_h16} ":"){0,5} {URI_h16})? "::" {URI_h16} |
103-
(({URI_h16} ":"){0,6} {URI_h16})? "::"
104-
)
105-
/*
106-
* h16 = 1*4HEXDIG
107-
* ls32 = ( h16 ":" h16 ) / IPv4address
108-
* IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
109-
*/
110-
URI_h16 = {HEXDIG}{1,4}
111-
URI_ls32 = ({URI_h16} ":" {URI_h16} | {URI_IPv4address})
112-
URI_IPv4address = ({URI_dec_octet} "." {URI_dec_octet} "." {URI_dec_octet}
113-
"." {URI_dec_octet})
114-
115-
/*
116-
* dec-octet = DIGIT ; 0-9
117-
* / %x31-39 DIGIT ; 10-99
118-
* / "1" 2DIGIT ; 100-199
119-
* / "2" %x30-34 DIGIT ; 200-249
120-
* / "25" %x30-35 ; 250-255
121-
*/
122-
URI_dec_octet = ({DIGIT} | // 0-9
123-
[\u{31}-\u{39}] {DIGIT} | // 10-99
124-
"1" {DIGIT}{DIGIT} | // 100-199
125-
"2" [\u{30}-\u{34}] {DIGIT} | // 200-249
126-
"25" [\u{30}-\u{35}]) // 250-255
127-
128-
/*
129-
* reg-name = *( unreserved / pct-encoded / sub-delims )
130-
*/
131-
URI_reg_name = ({URI_unreserved} | {URI_pct_encoded} | {URI_sub_delims})*
132-
133-
/*
134-
* path = path-abempty ; begins with "/" or is empty
135-
* / path-absolute ; begins with "/" but not "//"
136-
* / path-noscheme ; begins with a non-colon segment
137-
* / path-rootless ; begins with a segment
138-
* / path-empty ; zero characters
139-
*
140-
* path-abempty = *( "/" segment )
141-
* path-absolute = "/" [ segment-nz *( "/" segment ) ]
142-
* path-noscheme = segment-nz-nc *( "/" segment ) ; N.b. not used in OpenGrok
143-
* path-rootless = segment-nz *( "/" segment )
144-
* path-empty = 0<pchar> ; N.b. not used in OpenGrok
145-
*/
146-
URI_path_abempty = ("/" {URI_segment})*
147-
URI_path_absolute = "/" ({URI_segment_nz} ("/" {URI_segment})*)?
148-
URI_path_rootless = {URI_segment_nz} ("/" {URI_segment})*
149-
150-
/*
151-
* segment = *pchar
152-
* segment-nz = 1*pchar
153-
* segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
154-
* ; non-zero-length segment without any colon ":"
155-
* ; N.b. not used in OpenGrok
156-
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
157-
*/
158-
URI_segment = {URI_pchar}*
159-
URI_segment_nz = {URI_pchar}+
160-
URI_pchar = ({URI_unreserved} | {URI_pct_encoded} | {URI_sub_delims} |
161-
[:@])
162-
163-
/*
164-
* query = *( pchar / "/" / "?" )
165-
*/
166-
URI_query = ({URI_pchar} | [/\?])*
167-
168-
/*
169-
* fragment = *( pchar / "/" / "?" )
170-
*/
171-
URI_fragment = ({URI_pchar} | [/\?])*
172-
173-
/*
174-
* pct-encoded = "%" HEXDIG HEXDIG
175-
*/
176-
URI_pct_encoded = "%" {HEXDIG} {HEXDIG}
177-
178-
/*
179-
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
180-
* reserved = gen-delims / sub-delims ; N.b. not used in OpenGrok
181-
* gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
182-
* ; N.b. not used in OpenGrok
183-
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
184-
* / "*" / "+" / "," / ";" / "="
185-
*/
186-
URI_unreserved = ({ASCII_ALPHA} | {DIGIT} | [\-\._~])
187-
URI_sub_delims = [\!\$&\'\(\)\*\+,;=]
188-
189-
ASCII_ALPHA = [A-Za-z]
190-
HEXDIG = [0-9A-Fa-f]
191-
DIGIT = [0-9]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* CDDL HEADER START
3+
*
4+
* The contents of this file are subject to the terms of the
5+
* Common Development and Distribution License (the "License").
6+
* You may not use this file except in compliance with the License.
7+
*
8+
* See LICENSE.txt included in this distribution for the specific
9+
* language governing permissions and limitations under the License.
10+
*
11+
* When distributing Covered Code, include this CDDL HEADER in each
12+
* file and include the License file at LICENSE.txt.
13+
* If applicable, add the following below this CDDL HEADER, with the
14+
* fields enclosed by brackets "[]" replaced with your own identifying
15+
* information: Portions Copyright [yyyy] [name of copyright owner]
16+
*
17+
* CDDL HEADER END
18+
*/
19+
20+
/*
21+
* Copyright (c) 2017, Chris Fraire <[email protected]>.
22+
*/
23+
24+
/*
25+
* Relaxed from {FPath} in that only the last path segment is required
26+
* to end in {ASCII_ALPHA} or {DIGIT}.
27+
*/
28+
_RMFPSegment = [a-zA-Z]{FNameChar}*
29+
RelaxedMiddleFPath = "/"? {_RMFPSegment} ("/" {_RMFPSegment})+[a-zA-Z0-9]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* CDDL HEADER START
3+
*
4+
* The contents of this file are subject to the terms of the
5+
* Common Development and Distribution License (the "License").
6+
* You may not use this file except in compliance with the License.
7+
*
8+
* See LICENSE.txt included in this distribution for the specific
9+
* language governing permissions and limitations under the License.
10+
*
11+
* When distributing Covered Code, include this CDDL HEADER in each
12+
* file and include the License file at LICENSE.txt.
13+
* If applicable, add the following below this CDDL HEADER, with the
14+
* fields enclosed by brackets "[]" replaced with your own identifying
15+
* information: Portions Copyright [yyyy] [name of copyright owner]
16+
*
17+
* CDDL HEADER END
18+
*/
19+
20+
/*
21+
* Copyright (c) 2017, Chris Fraire <[email protected]>.
22+
*/
23+
24+
/*
25+
* See org.opensolaris.opengrok.util.StringUtils FNAME_CHARS_PAT where the
26+
* following regex is mirrored.
27+
*/
28+
FNameChar = [a-zA-Z0-9_\-\.]
29+
30+
/*
31+
* Path-like, absolute or relative, where the path components each start with
32+
* {ASCII_ALPHA}, where all but the first path component end in {ASCII_ALPHA}
33+
* or {DIGIT}, and are otherwise {FNameChar}.
34+
*/
35+
FPath = "/"? [a-zA-Z]{FNameChar}* ("/" [a-zA-Z]{FNameChar}*[a-zA-Z0-9])+

0 commit comments

Comments
 (0)