-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm2-pathnames.amiga.gll
143 lines (99 loc) · 2.61 KB
/
m2-pathnames.amiga.gll
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* M2C Modula-2 Compiler & Translator
* Copyright (c) 2015 Benjamin Kowarsch
*
* @synopsis
*
* M2C is a compiler and translator for the classic Modula-2 programming
* language as described in the 3rd and 4th editions of Niklaus Wirth's
* book "Programming in Modula-2" (PIM) published by Springer Verlag.
*
* In compiler mode, M2C compiles Modula-2 source via C to object files or
* executables using the host system's resident C compiler and linker.
* In translator mode, it translates Modula-2 source to C source.
*
* Further information at http://savannah.nongnu.org/projects/m2c/
*
* @file
*
* m2-pathnames.amiga.gll
*
* Grammar of AmigaOS pathnames.
*
* Alternatives may be enabled in header file m2-pathname-policy.h
*
* @license
*
* M2C is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License (LGPL) version 3
* as published by the Free Software Foundation.
*
* M2C is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. Read the license for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with m2c. If not, see <https://www.gnu.org/copyleft/lesser.html>.
*/
grammar Pathnames;
/*** Non-Terminal Symbols ***/
/* Pathname */
pathname :=
rootPath | parentPath | relativePath | filenameOnly
;
/* Root Path */
rootPath :=
devname? ':' relativePath
;
/* Device Name */
devname :=
Letter ComponentChar* ( ' ' ComponentChar+ )*
;
/* Parent Path */
parentPath :=
'/'+ relativePath
;
/* Relative Path */
relativePath :=
( pathComponent '/' )* pathComponent?
;
/* Path Component */
pathComponent :=
'.'? pathSubComponent ( '.' pathSubComponent )*
;
/* Path Sub-Component */
pathSubComponent :=
ComponentLeadChar ComponentChar* ( ' ' ComponentChar+ )*
;
/* Filename Only */
alias filenameOnly = pathComponent ;
/*** Terminal Symbols ***/
/* Path Component Character */
ComponentChar :=
ComponentLeadChar | '-'
;
/* Alternative Path Component Character #1 */
AltComponentChar1 :=
ComponentLeadChar | '-' | '~'
;
/* Alternative Path Component Character #2 */
AltComponentChar2 :=
ComponentLeadChar | '-' | '^'
;
/* Alternative Path Component Character #3 */
AltComponentChar3 :=
ComponentLeadChar | '-' | '~' | '^'
;
/* Path Component Lead Character */
ComponentLeadChar :=
Letter | Digit | '_'
;
/* Digit */
Digit :=
'0' .. '9'
;
/* Letter */
Letter :=
'a' .. 'z' | 'A' .. 'Z'
;
endg Pathnames.
/* END OF FILE */