@@ -8,18 +8,126 @@ scope: source.fstab
88
99contexts:
1010 main:
11− - match: '^\s*\#.*'
12− scope: comment.line.number-sign
13− comment: just a comment line
14− - match: ^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(0|1)\s+(0|1|2)\s*$
11+ - include: comment
12+ - match: '^'
13+ push: fstab_device
14+ comment: leading spaces
15+
16+ fstab_device:
17+ - include: comment
18+ - match: '\s*([^=\s]+=)([^\s]+)\s*'
19+ comment: device by uuid or label
20+ set: fstab_mountpoint
21+ captures:
22+ 1: punctuation.accessor
23+ 2: keyword.other.device
24+ - match: '\s*(//|\\\\)([^\s]+)\s*'
25+ comment: device by samba share
26+ set: fstab_mountpoint
27+ captures:
28+ 1: punctuation.accessor
29+ 2: keyword.other.device
30+ - match: '\s*([^\s]+)(:)([^\s]+)\s*'
31+ comment: device by server
32+ set: fstab_mountpoint
33+ captures:
34+ 1: keyword.other.device
35+ 2: punctuation.accessor
36+ 3: keyword.other.device
37+ - match: '\s*[^\s/\\]+\s*'
38+ comment: device by dev name
39+ set: fstab_mountpoint
40+ scope: keyword.other.device
41+ - match: '\s*(/dev/)([^\s]+)\s*'
42+ comment: device by dev path
43+ set: fstab_mountpoint
44+ captures:
45+ 1: punctuation.accessor
46+ 2: keyword.other.device
47+ - match: '\s*([^\s/]*/)*([^\s]+)\s*'
48+ comment: device by unknown path
49+ set: fstab_mountpoint
50+ captures:
51+ 1: punctuation.accessor
52+ 2: keyword.other.device
53+ - include: clear
54+
55+ fstab_mountpoint:
56+ - include: comment
57+ - match: '\s*/[^\s]*\s*'
58+ comment: mount point
59+ set: fstab_filesystem
60+ scope: string.unquoted.mountpoint
61+ - match: '\s*[^\s]+\s*'
62+ comment: mount point without leading slash (invalid)
63+ set: fstab_filesystem
64+ scope: invalid.illegal
65+ - include: clear
66+
67+ fstab_filesystem:
68+ - include: comment
69+ - match: '\s*[^\s]+\s*'
70+ comment: filesystem type
71+ set: fstab_options
72+ scope: variable.parameter.filesystem
73+ - include: clear
74+
75+ fstab_options:
76+ - include: comment
77+ - match: '([^\s,=]+)(=)([^\s,]+)'
78+ comment: key-value option
1579 captures:
16− 1: entity.name.device.fstab
17− 2: entity.name.mountpoint.fstab
18− 3: entity.name.type.fstab
19− 4: entity.name.options.fstab
20− 5: constant.numeric.dump.fstab
21− 6: constant.numeric.pass.fstab
22− comment: a valid fstab line with 6 space-separated token groups
23− - match: '^.*$'
24− scope: invalid.illegal.fstab
25− comment: everything else, probably an error
80+ 1: entity.name.option
81+ 2: entity.other.separator
82+ 3: variable.parameter
83+ - match: '[^\s,]+'
84+ comment: flag option
85+ scope: entity.name.option
86+ - match: ','
87+ comment: option separator
88+ scope: punctuation.separator
89+ - match: '\s+'
90+ comment: next field
91+ set: fstab_dump
92+ - include: clear
93+
94+ fstab_dump:
95+ - include: comment
96+ - match: '\s*[01]\s*'
97+ comment: dump field
98+ scope: constant.numeric
99+ set: fstab_pass
100+ - match: '\s*[^\s]+\s*'
101+ comment: invalid dump field
102+ scope: invalid.illegal
103+ set: fstab_pass
104+ - include: clear
105+
106+ fstab_pass:
107+ - include: comment
108+ - match: '\s*[01]\s*'
109+ comment: pass field
110+ scope: constant.numeric
111+ set: expected_eol
112+ - match: '\s*[^\s]+\s*'
113+ comment: invalid pass field
114+ scope: invalid.illegal
115+ set: expected_eol
116+ - include: clear
117+
118+ expected_eol:
119+ - include: comment
120+ - include: clear
121+ - match: '.*'
122+ scope: invalid.illegal
123+
124+ comment:
125+ - match: '\s*#.*$'
126+ comment: comment using the number sign
127+ scope: comment.line
128+
129+ clear:
130+ - match: '.*$'
131+ comment: used for clearing the context
132+ pop: true
133+