Add a real Pygments lexer for Wren (finally!).
This commit is contained in:
+10
-10
@@ -13,13 +13,13 @@ bytecode for efficiency, but that's an implementation detail.)
|
||||
|
||||
Line comments start with `//` and end at the end of the line:
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
// This is a comment.
|
||||
|
||||
Block comments start with `/*` and end with `*/`. They can span multiple lines
|
||||
or be within a single one. Unlike C, block comments can nest in Wren:
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
/* This is /* a nested */ comment. */
|
||||
|
||||
## Reserved words
|
||||
@@ -27,7 +27,7 @@ or be within a single one. Unlike C, block comments can nest in Wren:
|
||||
Some people like to see all of the reserved words in a programming language in
|
||||
one lump. If you're one of those folks, here you go:
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
break class construct else false for foreign if import
|
||||
in is null return static super this true var while
|
||||
|
||||
@@ -37,7 +37,7 @@ Naming rules are similar to other programming languages. Identifiers start with
|
||||
a letter or underscore and may contain letters, digits, and underscores. Case
|
||||
is sensitive.
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
hi
|
||||
camelCase
|
||||
PascalCase
|
||||
@@ -52,7 +52,7 @@ to indicate [fields](classes.html#fields) in classes.
|
||||
|
||||
Newlines (`\n`) are meaningful in Wren. They are used to separate statements:
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
// Two statements:
|
||||
System.print("hi") // Newline.
|
||||
System.print("bye")
|
||||
@@ -61,7 +61,7 @@ Sometimes, though, a statement doesn't fit on a single line and jamming a
|
||||
newline in the middle would trip it up. To handle that, Wren has a very simple
|
||||
rule: It ignores a newline following any token that can't end a statement.
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
System.print( // Newline here is ignored.
|
||||
"hi")
|
||||
|
||||
@@ -76,7 +76,7 @@ statement is allowed, like in [control flow](control-flow.html) statements.
|
||||
blocks. For example, here we have a block for the then case, and a single
|
||||
statement for the else:
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
if (happy && knowIt) {
|
||||
hands.clap
|
||||
} else System.print("sad")
|
||||
@@ -84,7 +84,7 @@ statement for the else:
|
||||
Blocks have two similar but not identical forms. Typically, blocks contain a
|
||||
series of statements like:
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
{
|
||||
System.print("one")
|
||||
System.print("two")
|
||||
@@ -99,7 +99,7 @@ However, it's pretty common to have a method or function that just evaluates
|
||||
and returns the result of a single expression. For that, Wren has a more
|
||||
compact notation:
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
{ "single expression" }
|
||||
|
||||
If there is no newline after the `{` (or after the parameter list in a
|
||||
@@ -107,7 +107,7 @@ If there is no newline after the `{` (or after the parameter list in a
|
||||
expression, and it automatically returns the result of it. It's exactly the
|
||||
same as doing:
|
||||
|
||||
:::dart
|
||||
:::wren
|
||||
{
|
||||
return "single expression"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user