Skip to content

Commit

Permalink
fix: clarify lexical syntax of identifiers (#217)
Browse files Browse the repository at this point in the history
Closes #191
  • Loading branch information
david-christiansen authored Dec 16, 2024
1 parent c4ff825 commit 180f0b7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Manual/Language/Files.lean
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ info: "Failure @0 (⟨1, 0⟩): expected token\nFinal stack:\n <missing>\nRemai
````

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




```lean (show := false)
/-- info: "Success! Final stack:\n `«\n »\nAll input consumed." -/
Expand All @@ -169,6 +174,14 @@ Such identifier components may contain any character at all, aside from `'»'`,
/-- info: "Success! Final stack:\n `««one line\n and another»\nAll input consumed." -/
#guard_msgs in
#eval validIdentifier "««one line\nand another»"

/-- info: "Success! Final stack:\n `«one line\x00and another»\nAll input consumed." -/
#guard_msgs in
#eval validIdentifier "«one line\x00and another»"

/-- info: "Success! Final stack:\n `«one line\x0band another»\nAll input consumed." -/
#guard_msgs in
#eval validIdentifier "«one line\x0Band another»"
```

Some potential identifier components may be reserved keywords.
Expand Down

0 comments on commit 180f0b7

Please sign in to comment.