-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
292 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
; declarations | ||
(const_section (variable_declaration) @context.end) @context | ||
(var_section (variable_declaration) @context.end) @context | ||
(let_section (variable_declaration) @context.end) @context | ||
(using_section (variable_declaration) @context.end) @context | ||
|
||
; types | ||
(type_section (type_declaration) @context.end) @context | ||
(object_declaration (field_declaration_list) @context.end) @context | ||
(tuple_type . (field_declaration) @context.end) @context | ||
(enum_declaration . (enum_field_declaration) @context.end) @context | ||
|
||
; routines | ||
(proc_declaration body: (statement_list) @context.end) @context | ||
(func_declaration body: (statement_list) @context.end) @context | ||
(method_declaration body: (statement_list) @context.end) @context | ||
(iterator_declaration body: (statement_list) @context.end) @context | ||
(converter_declaration body: (statement_list) @context.end) @context | ||
(template_declaration body: (statement_list) @context.end) @context | ||
(macro_declaration body: (statement_list) @context.end) @context | ||
|
||
; routine expressions | ||
(proc_expression body: (statement_list) @context.end) @context | ||
(func_expression body: (statement_list) @context.end) @context | ||
(iterator_expression body: (statement_list) @context.end) @context | ||
|
||
; calls | ||
(do_block body: (statement_list) @context.end) @context | ||
(call (argument_list ":" (statement_list) @context.end)) @context | ||
|
||
; single line statements | ||
(for body: (statement_list) @context.end) @context | ||
(while body: (statement_list) @context.end) @context | ||
(block body: (statement_list) @context.end) @context | ||
(static_statement body: (statement_list) @context.end) @context | ||
|
||
; multi line statements | ||
(try body: (statement_list) @context.end) @context | ||
(except_branch (statement_list) @context.end) @context | ||
(finally_branch (statement_list) @context.end) @context | ||
|
||
(if consequence: (statement_list) @context.end) @context | ||
(when consequence: (statement_list) @context.end) @context | ||
(elif_branch (statement_list) @context.end) @context | ||
(else_branch (statement_list) @context.end) @context | ||
(case value: (_) . (_) @context.end) @context | ||
(of_branch (statement_list) @context.end) @context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
const | ||
|
||
|
||
|
||
C = 5 | ||
var | ||
|
||
|
||
|
||
v = 5 | ||
let | ||
|
||
|
||
|
||
l = 5 | ||
using | ||
|
||
|
||
|
||
u: int | ||
type | ||
|
||
|
||
|
||
O = object of RootObj | ||
|
||
|
||
|
||
f: int | ||
T = tuple | ||
|
||
|
||
|
||
f: int | ||
E = enum | ||
|
||
|
||
|
||
F1 | ||
F2 | ||
|
||
proc p[ | ||
T | ||
]( | ||
a: int | ||
): | ||
int | ||
{.nimcall.} | ||
= | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
discard | ||
|
||
func f() = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
method m(a: O) = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
iterator i(): int = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
converter c(a: int): int = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
template t() = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
macro ma(body: untyped) = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
let pe = proc (): int = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
let fe = func (): int = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
let ie = iterator (): int = | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
import std/algorithm | ||
var array1 = [3,2,1] | ||
sort(array1) do (x, y: int) -> int: | ||
|
||
|
||
|
||
|
||
1 | ||
|
||
ma: | ||
|
||
|
||
ma: | ||
|
||
|
||
ma: | ||
|
||
|
||
ma: | ||
|
||
|
||
ma: | ||
|
||
|
||
discard | ||
|
||
|
||
# Foot of Mount Doom | ||
for x in | ||
[0,1,2]: | ||
|
||
|
||
|
||
while | ||
true: | ||
|
||
|
||
|
||
block label: | ||
|
||
|
||
|
||
static: | ||
|
||
|
||
|
||
try: | ||
|
||
|
||
|
||
discard | ||
|
||
except | ||
ValueError as e: | ||
|
||
|
||
|
||
|
||
|
||
|
||
discard | ||
|
||
finally: | ||
|
||
|
||
|
||
if | ||
true: | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
elif | ||
true: | ||
|
||
|
||
|
||
discard | ||
|
||
else: | ||
|
||
when | ||
true: | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
elif | ||
true: | ||
|
||
|
||
|
||
|
||
discard | ||
|
||
else: | ||
let en = E.F2 | ||
case en: | ||
of | ||
F1: | ||
|
||
|
||
|
||
discard | ||
|
||
elif | ||
true: | ||
|
||
|
||
|
||
discard | ||
|
||
else: | ||
|
||
|
||
|
||
echo "You have climbed Mount Doom!" | ||
|