Skip to content

Commit 180f0b7

Browse files
fix: clarify lexical syntax of identifiers (#217)
Closes #191
1 parent c4ff825 commit 180f0b7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Manual/Language/Files.lean

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ info: "Failure @0 (⟨1, 0⟩): expected token\nFinal stack:\n <missing>\nRemai
159159
````
160160

161161
Identifiers components may also be surrounded by double guillemets (`'«'` and `'»'`).
162-
Such identifier components may contain any character at all, aside from `'»'`, even `'«'` and newlines.
162+
Such identifier components may contain any character at all aside from `'»'`, even `'«'`, `'.'`, and newlines.
163+
The guillemets are not part of the resulting identifier component, so `«x»` and `x` denote the same identifier.
164+
`«Nat.add»`, on the other hand, is an identifier with a single component, while `Nat.add` has two.
165+
166+
167+
163168

164169
```lean (show := false)
165170
/-- info: "Success! Final stack:\n `«\n »\nAll input consumed." -/
@@ -169,6 +174,14 @@ Such identifier components may contain any character at all, aside from `'»'`,
169174
/-- info: "Success! Final stack:\n `««one line\n and another»\nAll input consumed." -/
170175
#guard_msgs in
171176
#eval validIdentifier "««one line\nand another»"
177+
178+
/-- info: "Success! Final stack:\n `«one line\x00and another»\nAll input consumed." -/
179+
#guard_msgs in
180+
#eval validIdentifier "«one line\x00and another»"
181+
182+
/-- info: "Success! Final stack:\n `«one line\x0band another»\nAll input consumed." -/
183+
#guard_msgs in
184+
#eval validIdentifier "«one line\x0Band another»"
172185
```
173186

174187
Some potential identifier components may be reserved keywords.

0 commit comments

Comments
 (0)