Commit Graph

105 Commits

Author SHA1 Message Date
Matthew Woodcraft 018b14be9d tokens.md: add optional SUFFIX to the Lexer blocks for non-numeric literals 2022-11-20 11:59:45 +00:00
Matthew Woodcraft ccde77edcb Numeric literals: say that the parser is now more lenient
This reflects the changes made in in rust-lang/rust#102944 .

Previously, unknown suffixes were rejected by the parser. Now they are
accepted by the parser and rejected at a later stage.

Similarly, integer literals too large to fit in u128 are now accepted by the
parser.

Forms like 5f32 are now INTEGER_LITERAL rather than FLOAT_LITERAL.

The notion of a 'pseudoliteral' is no longer required.
2022-11-20 11:59:45 +00:00
Matthew Woodcraft b333c25a43 tokens.md: remove the "examples of invalid integer literals"
These are covered under "Reserved forms similar to number literals"
2022-11-20 11:59:45 +00:00
Matthew Woodcraft c36b3c27ac tokens.md: add one more case to the "Reserved forms" lexer block 2022-11-20 11:59:45 +00:00
Marijn Schouten da28385057
Update tokens.md
Fix singular/plural issue.
2022-09-27 14:13:36 +02:00
Michael Goulet 4aff5bed5e Revert "Unify while/while let and if/if let expressions."
This reverts commit b83d8e616c.
2022-08-14 21:00:49 +00:00
Eric Huss b83d8e616c Unify while/while let and if/if let expressions.
This updates the `if` and `while` expressions so that they each are
presented as a single expression kind with multiple condition operators
instead of being logically separated from their `let` counterparts.

This also includes various fixes and additions.
2022-07-25 15:42:28 -07:00
Eric Huss 58e0f34eb1
Merge pull request #1042 from LukasKalbertodt/patch-1
Clarify "string continue" for (byte) string literals
2022-06-13 10:06:39 -07:00
Lukas Kalbertodt efc277f7de
Add note to line continuation section about confusing behavior 2022-06-13 08:14:31 +02:00
Felix S Klock II 299510486e
Merge pull request #1180 from GrishaVar/hash-upper-bound-patch
Upper bound on hashes in raw string literals
2022-05-17 14:01:57 -04:00
Matthew Woodcraft e06b267eeb Stop defining a separate BOOLEAN_LITERAL token
`true` and `false` are already listed as keywords.
2022-04-07 20:20:00 +01:00
Grisha 76c534c31c
Update formal raw string literal token definition 2022-04-01 07:02:52 +02:00
Eric Huss b85bbf4ff5
Merge pull request #1177 from mattheww/2022-03_numeric_literals
Numeric literal expressions and literal suffixes
2022-03-31 17:24:36 -07:00
Grisha beb82ca401
Update 2^16 to 2^8 2022-03-31 13:30:40 +02:00
Matthew Woodcraft d1f3e7fb82 Number pseudoliterals and reserved forms: text improvements from ehuss 2022-03-22 22:40:33 +00:00
Matthew Woodcraft 56105c2482 tokens.md: add missing superscript markup 2022-03-22 22:31:33 +00:00
Matthew Woodcraft 7baad0af5b Make the FLOAT_LITERAL rule about final `.` more accurate
The previous phrasing missed raw identifiers, raw string literals, and byte
literals.

Writing in terms of characters rather than tokens matches the implementation
more closely.
2022-03-22 22:17:50 +00:00
Matthew Woodcraft 8aa8b9af5b Cover two missing cases of number pseudoliterals 2022-03-21 21:39:56 +00:00
Grisha a082aa14e2
Raw string token style change 2022-03-16 15:46:21 +01:00
Grisha 272b13f9e9
Add upper bound to hashes in raw string literals 2022-03-16 15:30:03 +01:00
Matthew Woodcraft e5ef69aecb tokens.md: add two zero-width spaces to placate linkchecker
A LINKCHECK_EXCEPTIONS entry in linkchecker/main.rs seems to be the right
way to do this, but that's not in this repository.
2022-03-06 16:46:44 +00:00
Matthew Woodcraft 6e1979203b Document reserved forms similar to number literals 2022-03-06 16:46:44 +00:00
Matthew Woodcraft 6a379ac850 Add a Lexer rules block for number literals with arbitrary suffixes 2022-03-06 16:46:44 +00:00
Matthew Woodcraft e2015cc3a8 Add some examples of possibly confusing hexadecimal literals 2022-03-06 16:46:44 +00:00
Matthew Woodcraft 71fd6e3985 Add the 5f32 case to the text description of floating-point literals 2022-03-06 16:46:44 +00:00
Matthew Woodcraft 5f81f6a423 Make the FLOAT_LITERAL rule mention keywords as well as identifiers 2022-03-06 16:46:44 +00:00
Matthew Woodcraft 46d4a279f9 Say that out-of-range suffixed integer literals are valid lexer tokens 2022-03-06 16:46:44 +00:00
Matthew Woodcraft 1913a4f12a Notes about negated literals 2022-03-06 16:46:44 +00:00
Matthew Woodcraft 8fbbbda6ab Describe the effect of floating-point literal suffixes in literal-expr.md rather than tokens.md 2022-03-06 16:46:44 +00:00
Matthew Woodcraft 9b32e40eb7 Describe the effect of integer literal suffixes in literal-expr.md rather than tokens.md 2022-03-06 16:46:44 +00:00
Matthew Woodcraft e06fea070a Move the general description of literal expressions from tokens.md to literal-expr.md 2022-03-06 16:46:44 +00:00
Matthew Woodcraft 34e7e5fc28 tokens.md: move the link reference definitions to the end of the file 2022-03-05 22:29:31 +00:00
pushkine 6fc7f89282
Commit suggestion
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-01-30 23:39:17 +01:00
pushkine efda29c73b
Update tokens.md 2022-01-29 18:04:27 +01:00
varkor 9b91e9b825 Address comments 2022-01-17 13:05:14 +01:00
Eric Huss be704f3a7e Fix lexer edition. 2022-01-05 20:17:20 -08:00
Matthew Woodcraft c934ea9546 Add a Lexer rules block for reserved prefixes 2022-01-05 21:06:44 +00:00
Matthew Woodcraft 9f8acfc976 Say that `_#`, `_'`, and `_"` are reserved prefixes 2022-01-04 21:56:28 +00:00
Matthew Woodcraft 13ef57cffc Reword the first sentence describing literal suffixes.
Make it say that a suffix of the same form as a keyword is permitted.

Make it clearer that the "Reserved prefixes" rule doesn't apply to suffixes.
2022-01-03 21:07:21 +00:00
Matthew Woodcraft 6f47be4611 Add a 'Reserved prefixes' section to the Tokens page 2022-01-03 21:05:27 +00:00
Ömer Sinan Ağacan d8cce6597b Byte literal and string syntax: add missing quote escapes
Current definitions of byte characters and byte literals do not allow
escaped single and double quotes. Updated lexical syntax for byte
characters and strings to allow these characters. This is in sync with
the implementation.
2021-11-22 10:42:53 +03:00
Eric Huss df5799c00f
Merge pull request #900 from workingjubilee/rangefrom-pat
Document RangeFrom patterns
2021-09-16 17:25:28 -07:00
Lukas Kalbertodt b615c2b9b6
Clarify "string continue" for (byte) string literals
The previous version just said "whitespace at the beginning of the next
line is ignored", but that is not quite correct. Currently, exactly four
characters are ignored in that position. This is different from the
definition of `char::is_whitespace` and `char::is_ascii_whitespace`.

Additionally "at the beginning of the next line" is confusing as
additional \n are also ignored.

595088d602/compiler/rustc_lexer/src/unescape.rs (L281-L287)

595088d602/compiler/rustc_lexer/src/unescape.rs (L300-L307)
2021-06-09 11:55:35 +02:00
Jubilee Young abcacb2ce4 More formal writing and links 2021-04-06 15:42:35 -07:00
Havvy (Ryan Scheel) 8e62ab3e5d Add a float examle without a `.`.
This seems to me to me the only actionable thing to the confusion in
pr #922.

Also, move a link ref down to the rest of the link refs.
2021-01-11 15:12:22 -08:00
Eric Huss dd1b9c331e Escape brackets so they don't appear like a broken link reference. 2020-09-15 12:02:06 -07:00
Eric Huss 3dafca5069 Update token usage table. 2020-08-02 21:00:51 -07:00
matthewjasper becdca9477
Merge pull request #814 from ehuss/update-tuple-index
Update tuple index token.
2020-05-21 21:08:02 +01:00
Roberto Vidal ecfd876182 Fixes minor errors 2020-05-21 19:55:01 +02:00
Eric Huss 1a36151029 Update tuple index token. 2020-05-16 15:03:57 -07:00