From e0f9c40f47a39ab9474126f2f5c17725d6551f2e Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 15 Jan 2025 13:49:14 -0800 Subject: [PATCH] Switch some codeblocks to recognized languages. (#4811) Fix syntax highlighting for these code blocks. --- proposals/p0162.md | 6 +++--- proposals/p0285.md | 2 +- proposals/p0339.md | 2 +- proposals/p0340.md | 4 ++-- proposals/p0353.md | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/proposals/p0162.md b/proposals/p0162.md index 2d761a9e44f0..3d193d1b8d42 100644 --- a/proposals/p0162.md +++ b/proposals/p0162.md @@ -315,7 +315,7 @@ the semantic analysis and the specification of runtime behavior. #### Abstract Syntax for Expressions -```C++ +```c++ enum ExpressionKind { Variable, PatternVariable, Int, Bool, PrimitiveOp, Call, Tuple, Index, GetField, IntT, BoolT, TypeT, FunctionT, AutoT }; @@ -384,7 +384,7 @@ alternative: identifier tuple ';' #### Abstract Syntax for Statements -```C++ +```c++ enum StatementKind { ExpressionStatement, Assign, VariableDefinition, If, Return, Sequence, Block, While, Break, Continue, Match }; @@ -410,7 +410,7 @@ struct Statement { #### Abstract Syntax for Declarations -```C++ +```c++ struct FunctionDefinition { string name; Expression* param_pattern; diff --git a/proposals/p0285.md b/proposals/p0285.md index 06956bc360eb..bed42e435437 100644 --- a/proposals/p0285.md +++ b/proposals/p0285.md @@ -45,7 +45,7 @@ A few syntaxes that are likely to influence `if`/`else` are: - C++ - ```cc + ```c++ if (x) { printf("x is true"); } else if (y) { diff --git a/proposals/p0339.md b/proposals/p0339.md index 71a1ff77e93d..70cdbd95d924 100644 --- a/proposals/p0339.md +++ b/proposals/p0339.md @@ -85,7 +85,7 @@ Variables are standard in many languages. Some various forms to consider are: - C++: - ```cc + ```c++ int x; int y = 0; bool a = true, *b = nullptr, c; diff --git a/proposals/p0340.md b/proposals/p0340.md index 2b0bbe9504a3..2c3341783a2f 100644 --- a/proposals/p0340.md +++ b/proposals/p0340.md @@ -38,7 +38,7 @@ similar in many languages, even if details may change. - C++: A couple example languages following C++'s syntax closely are Java and TypeScript. - ```cc + ```c++ while (x) { DoSomething(); } @@ -221,7 +221,7 @@ This proposal does not offer a way to initialize variables in the `while`. For comparison, C++ does allow declaring a variable in the condition, such as: -```cc +```c++ while (optional next = get_next()) { ... } ``` diff --git a/proposals/p0353.md b/proposals/p0353.md index 152d44eec8ec..a94f0d7e3207 100644 --- a/proposals/p0353.md +++ b/proposals/p0353.md @@ -56,7 +56,7 @@ Semisemi `for` loops have been around for a long time, and are in C. Range-based For example, here is a basic semisemi: -```cc +```c++ for (int i = 0; i < list.size(); ++i) { printf("List at %d: %s\n", i, list[i].name); } @@ -64,7 +64,7 @@ for (int i = 0; i < list.size(); ++i) { An equivalent semisemi using iterators and the comma operator may look like: -```cc +```c++ int i = 0; for (auto it = list.begin(); it != list.end(); ++it, ++i) { printf("List at %d: %s\n", i, it->name); @@ -74,7 +74,7 @@ for (auto it = list.begin(); it != list.end(); ++it, ++i) { Range-based syntax can be simpler, but can also make it more difficult if there are multiple pieces of interesting information: -```cc +```c++ int i = 0; for (const auto& x : list) { printf("List at %d: %s\n", i, x.name); @@ -253,7 +253,7 @@ section of the semisemi. The inter-loop evaluation of the third section is important given how it interacts with `continue`. In particular, consider the loops: -```cc +```c++ for (int i = 0; i < 3; ++i) { if (i == 1) continue; printf("%d\n", i);