mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 06:21:04 +01:00
The images beside the samples were screenshots taken by hand, so they drifted: they still showed `package Carbon api;`, syntax the language dropped in 2024. `render_sample.py` renders a sample the way the grammar in this repository actually highlights it, using `tmlanguage.py`, a small TextMate tokenizer. VS Code runs grammars under Oniguruma, which we cannot depend on here, but this grammar uses no Oniguruma-only syntax, so `re` runs its regexes unchanged and the two agree on every character of every Carbon file in the repository. The output is SVG, so regenerating needs nothing but Python, and a later grammar change gets a same-path image diff showing what it did to real code. The samples change where a construct left the language (`api`, `Carbon` as the package name, `StringView`, `destructor`), refresh the `keywords.carbon` inventory against `token_kind.def`, and add sections for octal, raw and block literals, character literals, lambdas, and raw identifiers. `interop.carbon` is new, covering inline C++. These are highlighting fixtures rather than programs, so the deliberately invalid lines stay. Assisted-by: Claude Code --------- Co-authored-by: Dana Jansens <danakj@orodu.net>
54 lines
1.0 KiB
Plaintext
54 lines
1.0 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
// --- operators
|
|
|
|
>>= <=> <<= ->? &= ^= := :? == => != >= >> <= <> << <- -= -> -- %= |= += ++ /=
|
|
*= ~= & @ ^ : = ! > < - % . | + ? / * ~ \
|
|
and as impls in like not or where
|
|
|
|
// --- special-keywords
|
|
|
|
break case continue else if for match return returned then while
|
|
default =>
|
|
|
|
// --- introducer-keywords
|
|
|
|
adapt alias choice class constraint fn import inline interface let library
|
|
match_first namespace observe require var
|
|
base
|
|
export
|
|
impl
|
|
package
|
|
|
|
// --- modifier-keywords
|
|
|
|
abstract const eval extend extern final generic musteval override partial
|
|
private protected ref runtime static template unsafe unused val virtual
|
|
base class
|
|
default
|
|
export import
|
|
impl fn
|
|
impl library
|
|
impl package
|
|
|
|
// --- misc-keywords
|
|
|
|
forall form friend
|
|
.base
|
|
|
|
// --- self-keywords
|
|
|
|
self Self
|
|
|
|
// --- package-roots
|
|
|
|
Core Cpp
|
|
|
|
// --- underscore
|
|
|
|
;
|
|
_
|
|
_some_var
|